[fpc-devel] for-in-index loop
Michael Van Canneyt
michael at freepascal.org
Thu Jan 24 23:36:44 CET 2013
On Fri, 25 Jan 2013, Alexander Klenin wrote:
> On Fri, Jan 25, 2013 at 4:45 AM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> Enumerators are not iterators.
> Eh... actually, they are? Why do you think otherwise?
>
>> If you want a full-fledged iterator, you should use classes.
> Enumerators *are* classes, except for built-in ones.
>
>> The for syntax is not meant for that.
> That's debatable.
> There is no for-index support in Java, but there is in most (all?)
> other modern languages --
> Python, PHP, Ruby, etc.
> I suggest that Java is inferior in this regard.
>
>> If you want full fledged iterators, use classes.
> Please provide example of your suggesion for the case in the wiki.
You have your priorities wrong.
I don't need to provide *anything*.
Let's get something clear:
FPC is not the playground for every possible idea out there.
If someone wants to implement some weird syntax: please;
use FPC to try and test it, create your dissertation, whatnot.
But to expect that it is incorporated in the mainstream FPC distribution is a completely different thing.
Out in the real world, you'll need to prove that this actually is useful and will be used a lot.
"For in" is debatable by itself. It is syntactical sugar,
it provides nothing that for a:=b to c does not give.
Now you propose to extend this "sugar" syntax with something even more exotic,
which I have not even encountered in other languages.
I can probably find plenty of use cases for the most weird syntaxes ever.
That doesn't mean they
a) should be implemented at all,
b) should be included in FPC.
I do not want FPC to become Perl where every possible idea of every contributor
that popped up on a blue monday was implemented and incorporated.
Go and propose your idea to the gcc team as an extension to C.
let's see how far you get...
Michael.
More information about the fpc-devel
mailing list