Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Sven Barth
On 25.01.2013 19:59, Michael Van Canneyt wrote: On Sat, 26 Jan 2013, Alexander Klenin wrote: Pascal needs more useful libraries. It is important to note that default libraries ARE part of the language You are wrong there. Well, this is a matter of opinion of course, but note that your

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Daniël Mantione
Op Sat, 26 Jan 2013, schreef Alexander Klenin: On Sat, Jan 26, 2013 at 5:12 AM, Daniël Mantione daniel.manti...@freepascal.org wrote: Consider these arguments: 1) Even for simple arrays, depending on array element type, and optimizer implementation, for-in can be more efficient since it can

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Sven Barth
On 25.01.2013 20:24, Alexander Klenin wrote: MyDataSet.First; while not MyDataset.Eof do begin // ... MyDataSet.Next; end; // on a sidenote: what about a TDataSet enumerator? :) It is not clear what should loop variable contain: for v in MyDataSet do ... -- what is v? Right... forget

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 5:30 AM, Florian Klämpfl flor...@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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Mark Morgan Lloyd
Sven Barth wrote: Languages evolve. Natural languages as well as programming languages. We might not agree with every change (e.g. in German there has been established the nasty habit of saying that makes sense (das macht Sinn) while the correct equivalent would be that has sense (das hat

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 6:59 AM, Sven Barth pascaldra...@googlemail.com wrote: 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. I believe he wants to have real world examples (of other

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Florian Klämpfl
Am 25.01.2013 21:18, schrieb Alexander Klenin: On Sat, Jan 26, 2013 at 6:59 AM, Sven Barth pascaldra...@googlemail.com wrote: 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. I believe he

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 7:10 AM, Mark Morgan Lloyd markmll.fpc-de...@telemetry.co.uk wrote: However, I'd suggest that there are two possible category of extension: those that implement a clearly-delimited first-class object with interesting properties, and those that don't. Something like a

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Sven Barth
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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 5:30 AM, Florian Klämpfl flor...@freepascal.org wrote: Where? Concrete code of a serious language! Not some oh, yes, this language has it and that as well On Sat, Jan 26, 2013 at 7:34 AM, Florian Klämpfl flor...@freepascal.org wrote: No. I want to see a language which

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Florian Klämpfl
Am 25.01.2013 22:44, schrieb Alexander Klenin: On Sat, Jan 26, 2013 at 5:30 AM, Florian Klämpfl flor...@freepascal.org wrote: Where? Concrete code of a serious language! Not some oh, yes, this language has it and that as well On Sat, Jan 26, 2013 at 7:34 AM, Florian Klämpfl

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread waldo kitty
On 1/25/2013 13:59, Michael Van Canneyt wrote: On Sat, 26 Jan 2013, Alexander Klenin wrote: I certainly agree that Pascal has some advantages -- and they often outweigh disadvantages. Otherwise, I would be in Python's mailing list now, arguing to add some of the Pascal's features :) However,

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 8:54 AM, Florian Klämpfl flor...@freepascal.org wrote: Maybe I wouldn't have to ask if there would be a clear proposal what shall be implemented, what are alternatives, what do other languages, why is a so strange approach chosen etc. I agree that the quality of initial

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Mark Morgan Lloyd
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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Sven Barth
On 25.01.2013 22:44, Alexander Klenin wrote: On Sat, Jan 26, 2013 at 5:30 AM, Florian Klämpfl flor...@freepascal.org wrote: Where? Concrete code of a serious language! Not some oh, yes, this language has it and that as well On Sat, Jan 26, 2013 at 7:34 AM, Florian Klämpfl

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Sven Barth
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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 9:31 AM, Sven Barth pascaldra...@googlemail.com wrote: 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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Marco van de Voort
In our previous episode, Alexander Klenin said: On Sat, Jan 26, 2013 at 9:31 AM, Sven Barth pascaldra...@googlemail.com wrote: TFPGListLongInt = specialize TFPGList with (Integer); Whatever the particular syntax, I do agree that the decision to use angular brackets was unnecessarily

Anonymous procedures (Was: Re: [fpc-devel] for-in-index loop)

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 5:17 AM, Sven Barth pascaldra...@googlemail.com wrote: One could also do an alternative (though currently not with arrays, but with type helper support even that would be possible...): Yes, this is certainly the most interesting alternative. Actually, anonymous

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Alexander Klenin
On Sat, Jan 26, 2013 at 9:50 AM, Marco van de Voort mar...@stack.nl wrote: Whatever the particular syntax, I do agree that the decision to use angular brackets was unnecessarily copied from C++ -- round ones (or, at least, square ones) would be much better. Delphi got its generics from .NET.

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Paul Ishenin
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? I think now

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Paul Ishenin
26.01.13, 4:47, Sven Barth пишет: 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

Re: [fpc-devel] for-in-index loop

2013-01-25 Thread Hans-Peter Diettrich
Alexander Klenin schrieb: 2) Indeed, introducing tuples to Pascal might be an alternative solution. Below is a proposal: 2.1) Tuple definition. Tuple is an anonymous list of values, possibly of different types. OPL: array of Variant. Also: Open Array. Where both are slow and clumsy to use,

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 4:45 AM, Michael Van Canneyt mich...@freepascal.org wrote: Enumerators are not iterators. Eh... actually, they are? Why do you think otherwise? If you want a full-fledged iterator, you should use classes. Enumerators *are* classes, except for built-in ones. The for

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Jeppe Græsdal Johansen
Den 23-01-2013 00:54, vrt277 skrev: Hi FPC team, There is good proposed extension of for-in loop on fpc wiki: get enumerator Position if available http://wiki.freepascal.org/for-in_loop#Proposed_extensions. From my point of view it's essential part of iterators. Especially for data

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Florian Klämpfl
Am 24.01.2013 20:36, schrieb Alexander Klenin: That's debatable. As long as there is only some few line idea, there cannot debated much. Just an example: what happens with i if I start to delete from s during the for loop? ___ fpc-devel maillist -

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 7:18 AM, Jeppe Græsdal Johansen jjoha...@student.aau.dk wrote: I think the idea is good if the feature is implemented as optional. That way: - If the enumerator class implements a CurrentIndex method then the for loop can have an index variable. - If not then the for

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Marco van de Voort
In our previous episode, Florian Kl?mpfl said: As long as there is only some few line idea, there cannot debated much. http://www.freepascal.org/faq.var#extensionselect ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 7:30 AM, Florian Klämpfl flor...@freepascal.org wrote: Am 24.01.2013 20:36, schrieb Alexander Klenin: That's debatable. As long as there is only some few line idea, there cannot debated much. It is more: an idea with implementation and tests ;) Just an example: what

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 7:34 AM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Florian Kl?mpfl said: As long as there is only some few line idea, there cannot debated much. http://www.freepascal.org/faq.var#extensionselect Yes, current discussion is based on that

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Florian Klämpfl
Am 24.01.2013 21:35, schrieb Alexander Klenin: On Fri, Jan 25, 2013 at 7:30 AM, Florian Klämpfl flor...@freepascal.org wrote: Am 24.01.2013 20:36, schrieb Alexander Klenin: That's debatable. As long as there is only some few line idea, there cannot debated much. It is more: an idea with

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Florian Klämpfl
Am 24.01.2013 22:26, schrieb Alexander Klenin: On Fri, Jan 25, 2013 at 7:56 AM, Florian Klämpfl flor...@freepascal.org wrote: Just an example: what happens with i if I start to delete from s during the for loop? Exactly the same thing as in the current for-in loop: either a range check

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Florian Klämpfl
Am 24.01.2013 21:41, schrieb Alexander Klenin: On Fri, Jan 25, 2013 at 7:34 AM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Florian Kl?mpfl said: As long as there is only some few line idea, there cannot debated much. http://www.freepascal.org/faq.var#extensionselect

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 8:44 AM, Florian Klämpfl flor...@freepascal.org wrote: Am 24.01.2013 22:26, schrieb Alexander Klenin: in all three cases, the effect will be more-or-less the same. In the first two cases the programmer knows that he does something strange, actually he can even adjust i

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Graeme Geldenhuys
On 01/24/13 19:36, Alexander Klenin wrote: Enumerators are not iterators. Eh... actually, they are? Why do you think otherwise? Enumerators are limited in functionality. Iterators are the full-blown thing. Common Iterator API is something like Next, Prev, Reset, HasNext, HasPrev etc.

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 9:36 AM, Michael Van Canneyt mich...@freepascal.org wrote: If you want full fledged iterators, use classes. Please provide example of your suggestion for the case in the wiki. I don't need to provide *anything*. Of course you do not, this is why I said please :)

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 10:13 AM, Graeme Geldenhuys gra...@geldenhuys.co.uk wrote: On 01/24/13 19:36, Alexander Klenin wrote: Enumerators are not iterators. Eh... actually, they are? Why do you think otherwise? Enumerators are limited in functionality. Iterators are the full-blown thing.

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Graeme Geldenhuys
On 01/24/13 23:26, Alexander Klenin wrote: If you want full fledged iterators, use classes. Please provide example of your suggestion for the case in the wiki. I don't need to provide *anything*. Of course you do not, this is why I said please :) However, it is impossible to have a

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Alexander Klenin
On Fri, Jan 25, 2013 at 10:38 AM, Graeme Geldenhuys gra...@geldenhuys.co.uk wrote: On 01/24/13 23:26, Alexander Klenin wrote: If you want full fledged iterators, use classes. Please provide example of your suggestion for the case in the wiki. I don't need to provide *anything*. Of course

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Василий Кевролетин
Hi all, I want to clarify what *feature will be optional* and will not break compatibility. I suppose what back compatibility is required for all minor changes. *I was thinking it's always by default :)* *Michael Van Canneyt*, FPC is not the playground for every possible idea out there. If

Re: [fpc-devel] for-in-index loop

2013-01-24 Thread Paul Ishenin
25.01.2013 11:47, Василий Кевролетин пишет: May be you understood what I'm from university in wrong way. It does *not* mean what I need to quickly do any changes anywhere. It means what I have resources /(time, motivation, direct support of very good programmer) /to improve good open project.

<    1   2