On 25.01.2013 23:20, Mark Morgan Lloyd wrote:
Sven Barth wrote:
On 25.01.2013 21:10, Mark Morgan Lloyd wrote:
Something like
>>>> for a in a index i do
falls squarely into the latter category: it's messy to parse, worse to
read, and is completely unlike any existing language idioms.
I definitely have to disagree here (while still not having an opinion
on the topic "for-in-index" itself): once you've worked on Delphi
style generics you know what messy parsing is... and I already get
nightmares thinking about what I still need to add for Delphi's
generics support... This for-in-index is a peace of cake to parse in
comparison.
I wasn't trying to say that it was easy so much as it would have been
worse if it weren't for the unambiguous delimiters.
After implementing support for Delphi style generics I came to the
conclusion that I would have preferred the following syntax:
type
TFPGListLongInt = specialize TFPGList as (Integer);
or
type
TFPGListLongInt = specialize TFPGList with (Integer);
This could also have appeared inline without to many headaches. For the
first one the "specialize" keyword would have definitely been necessary,
but for second syntax idea it would have worked without the "specialize"
keyword as well...
In fact I bet that with what you know now you'd be able to move generic
support into a run-time library loaded when the <> idiom was recognised.
No, I wouldn't. This would make the code in no way more maintainable or
even more understandable. Quite the contrary.
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel