[fpc-devel] for-in-index loop

Alexander Klenin klenin at gmail.com
Fri Jan 25 20:54:58 CET 2013


On Sat, Jan 26, 2013 at 5:30 AM, Florian Klämpfl <florian at freepascal.org> wrote:
> Am 25.01.2013 18:17, schrieb Alexander Klenin:
>>> Using indicies is against all principles of iterators.
>> I am not sure what princilpes you are talking about,
>
> The theory of iterators.

You mean Alexander Stepanov's ideas which served as a basis for STL?
If so, you may notice that STL does include the concept of <key, value>
pair which is returned by iterators on maps.
Also note that Pascal and C++ is are quite different designs --
C++ usually sacrifices readability for the sake of reducing the number
of language features,
while Pascal traditionally followed an opposite direction.
(E.g. built-in String vs, std::string).
So while with the latest improvements to the generics it is almost possible
to replicate C++ STL design, I think that it is not correct way.
I would prefer the approach of Go language, which does include direct
syntax support for
the most often used constructs even if they can be simulated using libraries.
For example, I do think that despite existence of fcl-stl, Pascal
would benefit from direct
inclusion of simple associative arrays:
var a: array [String] of Integer;
Yes, it is a duplication of concepts, but it would make a life of a
programmer simpler.

>> I have already provided examples.
>
> Where? Concrete code of a serious language! Not some "oh, yes, this
> language has it and that as well"
I am afraid that it is very hard for me to discuss against such statements.
Do you consider Java "serious" while Python, Ruby, PHP, Objective C
etc "not serious"?
What is "concrete code"? The code I provided only missed loop bodies.
I can provide that too, but I do not think it will add anything to the
discussion.

--
Alexander S. Klenin



More information about the fpc-devel mailing list