Re: [fpc-devel] Dynamically Loading Libraries

2009-11-04 Thread Jonas Maebe
On 04 Nov 2009, at 02:37, Ivo Steinmann wrote: The more important question is: should we do it this way or should I also write a 2nd implementation by modifying the compiler (branched)? Then we don't need an external tool at all. I prefer the compiler not to be modified for something like thi

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Paul Ishenin
Alexander Klenin wrote: Yet another bug: --- type T = (a1, b1=5); var ch: T; begin for ch in T do Writeln(ch); end. This is caused by the problem in the for-to loop: for ch := Low(T) to High(T) do WriteLn(ch) How should I solve the problem in the for-in loop? I tried the next way:

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Florian Klaempfl
Paul Ishenin schrieb: > Alexander Klenin wrote: >> Yet another bug: >> >> --- >> type T = (a1, b1=5); >> var >> ch: T; >> begin >> for ch in T do Writeln(ch); >> end. >> > This is caused by the problem in the for-to loop: > > for ch := Low(T) to High(T) do > WriteLn(ch) > > How should I

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Alexander Klenin
On Wed, Nov 4, 2009 at 22:36, Paul Ishenin wrote: > Alexander Klenin wrote: >> >> Yet another bug: >> >> --- >> type T = (a1, b1=5); >> var >>  ch: T; >> begin >>  for ch in T do Writeln(ch); >> end. >> > > This is caused by the problem in the for-to loop: > > for ch := Low(T) to High(T) do >  Wri

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Paul Ishenin
Florian Klaempfl wrote: You can use the rtti generated for those enums. For me it is still the question if for-to loop should work: for ch := Low(T) to High(T) do WriteLn(ch) Best regards, Paul Ishenin. ___ fpc-devel maillist - fpc-devel@list

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Paul Ishenin said: > > Yet another bug: > > > > --- {$apptype console} > > type T = (a1, b1=5); > > var > > ch: T; > > begin > > for ch in T do Writeln(ch); > > end. CodeGear Delphi for Win32 compiler version 20.0 Copyright (c) 1983,2008 CodeGear testx.dpr(6) Error: E

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Vincent Snijders
Marco van de Voort schreef: In our previous episode, Paul Ishenin said: Yet another bug: --- {$apptype console} type T = (a1, b1=5); var ch: T; begin for ch in T do Writeln(ch); end. CodeGear Delphi for Win32 compiler version 20.0 Copyright (c) 1983,2008 CodeGear testx.dpr(6) Error: E2

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Micha Nelissen
Vincent Snijders wrote: Does it work on not sparse enums? Those are "dense" enums? :-) Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Micha Nelissen said: > > Does it work on not sparse enums? > > Those are "dense" enums? :-) "true" enums. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Paul Ishenin
Vincent Snijders wrote: Since I suspected that D2009 doesn't work on sparse enums, I tried, and the above is the result. Does it work on not sparse enums? Delphi compiler does not support for-in loop for types (enums, integer, ...). This is fpc extension :) Best regards, Paul Ishenin. ___

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Vincent Snijders said: yy> >>> end. > > > > > > CodeGear Delphi for Win32 compiler version 20.0 > > Copyright (c) 1983,2008 CodeGear > > testx.dpr(6) Error: E2029 '(' expected but 'DO' found > > testx.dpr(7) Error: E2430 for-in statement cannot operate on collection > >

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Paul Ishenin said: > >> Since I suspected that D2009 doesn't work on sparse enums, I tried, > >> and the > >> above is the result. > > > > Does it work on not sparse enums? > Delphi compiler does not support for-in loop for types (enums, integer, > ...). This is fpc exten

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Paul Ishenin
Marco van de Voort wrote: Do you have unit tests for multidimensional arrays. I saw quite funky examples (involving dummy variables) in the D2009 help for that. No. I know delphi allows to enumerate multidimensional arrays but fpc traverses only the first dimension. Best regards, Paul Ishen

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Alexander Klenin said: > > ? WriteLn(ch); > > ? inc(ch); > > > > But it fails the same way. > > ch := succ(ch); > > OTOH, I am not sure -- obviously either Succ or Inc is buggy, but which one? > Maybe runtime instead of compile-time error is actually correct? Sparse enum

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Matt Emson
Marco van de Voort wrote: Sparse enums are simply a kludge. They were needed because they exist in the Windows API, and afaik for that only. IOW for easy translation of Windows types. They were added to Delphi in version 6. I though they added them to support Qt and the CLX, which relied o

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Marco van de Voort
In our previous episode, Matt Emson said: > > Sparse enums are simply a kludge. They were needed because they exist in > > the Windows API, and afaik for that only. IOW for easy translation of > > Windows types. > > They were added to Delphi in version 6. I though they added them to > support Q

Re: [fpc-devel] Dynamically Loading Libraries

2009-11-04 Thread Ivo Steinmann
Jonas Maebe schrieb: > > On 04 Nov 2009, at 02:37, Ivo Steinmann wrote: > >> The more important question is: should we do it this way or should I >> also write a 2nd implementation by modifying the compiler (branched)? >> Then we don't need an external tool at all. > > I prefer the compiler not to

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Paul Ishenin
Paul Ishenin wrote: Marco van de Voort wrote: Do you have unit tests for multidimensional arrays. I saw quite funky examples (involving dummy variables) in the D2009 help for that. No. I know delphi allows to enumerate multidimensional arrays but fpc traverses only the first dimension. To b

Re: [fpc-devel] Dynamically Loading Libraries

2009-11-04 Thread Sergei Gorelkin
Ivo Steinmann wrote: but one thing would be nice to have. A compiler switch and/or built in function to check wheter a symbol is used or not. With this information is easy to implement "smart loading". The problem is that when compiling a unit, you never know which symbols will be used in the p

Re: [fpc-devel] Re: Testing for..in feature

2009-11-04 Thread Vinzent Höfler
Matt Emson : > The problem I always had with Pascal supporting them was that a Pascal > enum was designed to represents the position in a sequence and not > necessarily an underlying integral value - where as a sparse enum is > simply a grouping for a bunch of numerical values at the whim of th