[fpc-devel] for-in-index loop
Michael Van Canneyt
michael at freepascal.org
Sat Jan 26 12:34:03 CET 2013
On Sat, 26 Jan 2013, Paul Ishenin wrote:
> 26.01.13, 2:32, Michael Van Canneyt пишет:
>
>> Pascal is an explicitly declarative language. Anonymous functions go
>> 100% against this. It is the readability horror I associate with
>> Javascript.
>
> I wonder where you were when Operators feature has been added to pascal? Or
> generics?
Generics was implemented without my knowledge. I only found out when suddenly
the classes unit had been changed to use them. After a horrible discussion, this
was reversed, because of the drop in speed you got when using generics.
Operators are a natural thing:
Pascal defines some basic types and operations on them.
Pascal allows you to define extra types, so it is natural
that it allows you to define these operations on them.
> I think now when operators for simple types are present in the language it is
> too late to care about explicitly declarative language. It is simple not
> explicit anymore.
>
> And index (or better to call it key) extension for for-in loop will not make
> it less explicit for sure.
Personally, I think the tuple approach proposal is more general, and therefor better.
Once more, I do not think that language extensions are bad.
I judge them on a case by case basis.
But if I must choose between
for a,b in c do
(with C a tuple enumerator/iterator) or
for a in c index b do
Then the former is ten times (well, a lot) better.
So if someone were to introduce that to solve the original poster's problem,
you will not hear me protesting, it will have been well worth the energy
I put in this discussion.
Michael.
More information about the fpc-devel
mailing list