[fpc-pascal] for .. in loop implementation
florian at freepascal.org
Thu Jan 8 10:05:59 CET 2009
Vinzent Höfler schrieb:
> Jürgen Hestermann wrote:
>>> Mantra: First make it work, then make it fast.
>> In general that's true from the programmer's viewpoint. But this does
>> not apply to adding language details because there is no 'first make
>> it work'. Why obscure important implementation details if the only
>> benefit is saving some writing?
> I won't judge on the "only save some writing" here, but generally it
> *does* apply to language features: If a particular language feature
> helps you writing correct code faster (by supporting you to make it work
> instead of relying on your abilities to use the debugger), then it does
> The real question is if the (or any other) proposal is "good enough" to
> do just that, or if it's really some syntactic sweetener (not even
> sugar, sugar at least contains energy). That's something to discuss.
There is not much to discuss: Who has time to implement it without
hurting the implementation of other maybe more important stuff. If
someone provides usable (readable, commented code with tests, full
implementation support also the iterating interfaces) patches to
implement the for in ... stuff I'am sure they get applied.
> Let me take a rather extreme point of view: After all, all those for-,
> while-, and repeat-until-loops are only there to save you from some
> typing work, because Pascal already has a perfectly good
> loop-construct with which you can do all that: goto. Would you agree
> here? Probably not.
Not really because the use case of typical while/for/repeat loops is
much wider. How often do you iterate over the odd days of a week?
More information about the fpc-pascal