most of the loops in Unreal Tournament Engine could be replaced easily by higher-level, more readable and less error-prone abstractions, if only C++ allowed this.
If only C++ was a different language it could have done things differently.
for (std::vector<person>::const_iterator i = persons.begin(); i != persons.end(); ++i)
if (*i.uses("C++"))
cout << i -> name;
The second one is overspecified, and you can't do much about it. You can't abstract away "looping" as a separate concern, while in functional paradigm you can. That is why most functional programs are much shorter than their imperative counterparts, and therefore - higher level.
There is no need to complicate a language with such things you say Scala does.The beauty of c++ is that it is both simple and powerful at the same time
WTF? LOL. Language with 3 semantics of parameter passing, ambiguous grammar, redundant and conflicting features, lack of automatic memory management you call simple? It is neither simple, nor powerful. The language with the best power-to-complexity ratio is probably LISP. Then go all the hybrid functional languages like F#, OCaml, Scala etc. C++ is far, far away, even behind Java in this regard. If you think it is simple, you don't know it well enough.
I actually do not remember why I did it (it was months ago). After your comment, I looked at it, and it looks damn stupid.
I should check for initialization *before* the loop.
[Edit:] Umm, surely what I did is weird, but the remainder of the code is:
1 2 3 4 5 6
for (; parabolicsCounter<StartingNilradicalsNoRepetition.size; parabolicsCounter++, owner.flagNilradicalComputationInitialized=false)
{ if (!owner.flagNilradicalComputationInitialized)
{ /*initialization that doesn't flip the owner.flagNilradicalComputationInitialized*/
}
functionthatDoesTheWork(owner); //this function uses the fact that the flag is not flipped
}
I think I actually did it the right way: note that the if condition doesn't flip the initialization flag.
Any language that separates the two I automatically put in the category "languages I will never use".
Oh, so you are the kind of person that sorts 1GB of data by handcoded quicksort, instead of firing up a database system and issuing a simple SQL. But if your ego is satisfied with it... Why not?
Get a life.Seriously.All you do is make 100 big statements and when people start replying you change the topic,try to back your statement up using another 100 big statements with no evidence,or reply someone else.Your arguments proof nothing.c++ is indeed simple and powerful,that is one of the quotes you will find in any serious c++ textbook.But i doubt you understand the language,since your life in this forum is just trolling.You are either 13 yr old kid or a 40 yr basement dweller still living with his mum.BTW,i enjoy c++ parameter-passing semantics.It gives a lot of freedom and choice when designing a system.If c++ lacked them you would probably said it is a crappy language because of that.Guys like you can never be wrong.I give you a hint: join the church of Scientology or go see a psychiatrist.Cheers.
*yawn* Not getting along is so last year. Can't we all just drink our cans of TrollBGone and be happy even when someone tries to burst our bubbles? Or do we have to spray our cans of TrollBGone?
The second one is overspecified, and you can't do much about it. You can't abstract away "looping" as a separate concern, while in functional paradigm you can. That is why most functional programs are much shorter than their imperative counterparts, and therefore - higher level
No offense, but duh. Have you even read the rationale for creating C++?? "To be as close to assembly as possible, but no closer." Hence why we have raw pointers, access to memory, etc, that other languages don't.
Oh, so you are the kind of person that sorts 1GB of data by handcoded quicksort, instead of firing up a database system and issuing a simple SQL. But if your ego is satisfied with it... Why not?
I was generating all possible nilradicals that can be attached to a root subalgebra up to isomorphism of the ambient Lie algebra and ran a simplex algorithm for each possibility.
To compute whether two root subalgebras are isomorphic, you gotta run a group action, which, for the cases I needed, meant a cycle of tops 51 840 elements. Each action of a group element in turn less than or equal to Constant*7*126 operations. The total number of subalgebras computed in the end was 73834.
If I wasn't able to abort my "for" cycles whenever I wanted however I wanted, I would end up doing ~ 7*126*51 840* 73834 operations, which is not desired.
***
I am not aware of a database server that can enumerate root subalgebras of Lie algebras.
To compute whether two root subalgebras are isomorphic, you gotta run a group action, which, for the cases I needed, meant a cycle of tops 51 840 elements. (...)
Seems like an ideal application for logical or functional programming, without loops.
The more complex is the algorithm, the higher level language you usually need.
If I wasn't able to abort my "for" cycles whenever I wanted however I wanted
But how is that related to my post?
I am not aware of a database server that can enumerate root subalgebras of Lie algebras
Any Turing complete system can do this. Database systems are usually Turing complete.
You are either 13 yr old kid or a 40 yr basement dweller still living with his mum
Yeah! Argument ad personam! I won! :D Do you feel better now? Oh, and I'm really looking forward to seeing any quote from serious publication or any scientist, saying C++ is simple and powerful. Even BS is very conservative at making such claims.