[fpc-devel] New feature discussion: for-in loop
Michael Van Canneyt
michael at freepascal.org
Wed Oct 21 10:17:10 CEST 2009
On Wed, 21 Oct 2009, Micha Nelissen wrote:
> Michael Van Canneyt wrote:
>> Ideally, the compiler has no knowledge at all of specific classes, and a
>> new keyword such as Iterator (or whatever) helps in ensuring that the
>> compiler
>> is not contaminated with knowledge of specific classes or methods.
>
> I'm not sure how things are helped by "slapping" a keyword onto it? If we
> call the thing a "class" then it's evil, but if it's called an "iterator"
> which is actually the exact same thing as a class, it's fine? Correct me if
> wrong.
Because with something like
Type
MyIterator = Iterator(TSomeResultType,Func1,Func2,Func3);
Function MyIterator.Func1 : TSomeResultType;
begin
end;
Etc.
You're free to choose the names of the functions, so nothing has to be
hardcoded in the compiler. It's a bit like operators, where you can also
choose the names of the operands.
Michael.
More information about the fpc-devel
mailing list