Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Sun, Jan 27, 2013 at 12:35 PM, Hans-Peter Diettrich wrote: >> (a, b) := (b, a); // the compiler needs to ensure the correct usage of >> temps here! > > > What will happen here? > > At compile time a tuple type (integer; integer) has to be defined, and an > instance must be allocated for it. I

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Sun, 27 Jan 2013, Alexander Klenin wrote: On Sun, Jan 27, 2013 at 4:43 AM, Sven Barth wrote: Based on the results of the "for-in-index" thread I've decided to come up with a draft for the Tuple type which is thought by many people to be a better alternative to "for-in-index". Please note

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Sven Barth
On 27.01.2013 02:35, Hans-Peter Diettrich wrote: Sven Barth schrieb: * Description What are tuples? Tuples are an accumulation of values of different or same type where the order matters. Sounds familiar? They are in this regard similar to records, but it's only the order of an element that ma

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Sun, Jan 27, 2013 at 10:10 PM, Michael Van Canneyt wrote: >> 2.1) Tuples are always temporary and anonymous. You can not store a >> tuple, define tuple type, of variable of tuple type. >> So tuples are 100% static, compile-time feature -- no change to >> RTTI, variants etc. > No. > > I think t

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Sun, 27 Jan 2013, Alexander Klenin wrote: On Sun, Jan 27, 2013 at 10:10 PM, Michael Van Canneyt wrote: 2.1) Tuples are always temporary and anonymous. You can not store a tuple, define tuple type, of variable of tuple type. So tuples are 100% static, compile-time feature -- no change to

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Sun, Jan 27, 2013 at 11:29 PM, Michael Van Canneyt wrote: >> >> Let me restate: >> 1) Tuple as a type does nothing new compared to a record, except for >> possibility to omit field names. > That's all we need. I disagree. In fact, the ability to omit field names is, in my opinion, the least val

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Paul Ishenin
27.01.13, 1:43, Sven Barth wrote: Based on the results of the "for-in-index" thread I've decided to come up with a draft for the Tuple type which is thought by many people to be a better alternative to "for-in-index". I think it is big overkill to implement a new base type for such a small tas

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Sun, 27 Jan 2013, Paul Ishenin wrote: 27.01.13, 1:43, Sven Barth wrote: Based on the results of the "for-in-index" thread I've decided to come up with a draft for the Tuple type which is thought by many people to be a better alternative to "for-in-index". I think it is big overkill to im

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Jonas Maebe
On 26 Jan 2013, at 21:45, Alexander Klenin wrote: > 2.2.2) Any record or array type may be converted to a tuple of its > elements using either assignment or "Tuple" intrinsic. > For example: Tuple(ARectangle) is a tuple of 4 elements; > x, y := APoint; // same as x := APoint.x; y := APoint.y; [sn

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 1:26 AM, Paul Ishenin wrote: > 27.01.13, 1:43, Sven Barth wrote: >> >> Based on the results of the "for-in-index" thread I've decided to come >> up with a draft for the Tuple type which is thought by many people to be >> a better alternative to "for-in-index". > I think it

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Martin
On 27/01/2013 14:42, Alexander Klenin wrote: On Mon, Jan 28, 2013 at 1:26 AM, Paul Ishenin wrote: 27.01.13, 1:43, Sven Barth wrote: Based on the results of the "for-in-index" thread I've decided to come up with a draft for the Tuple type which is thought by many people to be a better alternati

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 1:38 AM, Jonas Maebe wrote: > you no longer have a tuple type, but rather a > deconstruct_into_component_types() > type conversion operator along with anonymous records. Yes, this is quite close to what I wanted to propose. I am glad someone has understood me :) Please see

[fpc-devel] Freebsd 9.1 -liconv not found

2013-01-27 Thread Leonardo M . Ramé
I'm trying to compile fpc on a new FreeBsd 9.1 machine, I've installed iconv and libiconv from ports, but /usr/bin/ld keeps complaining about cannot finding -liconv.  Any hint?.   Leonardo M. Ramé http://leonardorame.blogspot.com___ fpc-devel maillist

Re: [fpc-devel] Freebsd 9.1 -liconv not found

2013-01-27 Thread Jonas Maebe
On 27 Jan 2013, at 16:03, Leonardo M. Ramé wrote: > I'm trying to compile fpc on a new FreeBsd 9.1 machine, I've installed iconv > and libiconv from ports, but /usr/bin/ld keeps complaining about cannot > finding -liconv. Install libiconv-dev, libiconv-devel or something like that. Jonas

Re: [fpc-devel] Freebsd 9.1 -liconv not found

2013-01-27 Thread Leonardo M . Ramé
> > From: Jonas Maebe >To: "FPC developers' list" >Sent: Sunday, January 27, 2013 12:13 PM >Subject: Re: [fpc-devel] Freebsd 9.1 -liconv not found > > > > >On 27 Jan 2013, at 16:03, Leonardo M. Ramé wrote: > >I'm trying to compile fpc on a new FreeBsd 9.1 machin

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 2:01 AM, Martin wrote: >> Of course. But note that in this thread, many more uses of tuples >> (which I do NOT want to make a type -- see my previous mail for >> lengthy explanation why). >> Some of the uses are: record and array constructors, adaptation of >> inconvenient

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

2013-01-27 Thread luiz americo pereira camara
2013/1/26 Sven Barth : > On 26.01.2013 12:52, Alexander Klenin wrote: >> >> On Sat, Jan 26, 2013 at 10:50 PM, Sven Barth >> wrote: Generics was implemented without my knowledge. I only found out when suddenly the classes unit had been changed to use them. After a horrible

Re: [fpc-devel] Freebsd 9.1 -liconv not found

2013-01-27 Thread Marco van de Voort
In our previous episode, Leonardo M. Ram? said: > I'm trying to compile fpc on a new FreeBsd 9.1 machine, I've installed iconv > and libiconv from ports, but /usr/bin/ld keeps complaining about cannot > finding -liconv.? >Any hint?. Pass -Fl/usr/local/lib in OPT="" _

Re: [fpc-devel] Freebsd 9.1 -liconv not found

2013-01-27 Thread Leonardo M . Ramé
- Original Message - > From: Marco van de Voort > To: Leonardo M. Ramé ; FPC developers' list > > Cc: > Sent: Sunday, January 27, 2013 12:28 PM > Subject: Re: [fpc-devel] Freebsd 9.1 -liconv not found > > In our previous episode, Leonardo M. Ram? said: >> I'm trying to compile fpc on

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Mon, 28 Jan 2013, Alexander Klenin wrote: On Mon, Jan 28, 2013 at 1:26 AM, Paul Ishenin wrote: 27.01.13, 1:43, Sven Barth wrote: Based on the results of the "for-in-index" thread I've decided to come up with a draft for the Tuple type which is thought by many people to be a better alter

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 2:59 AM, Michael Van Canneyt wrote: > > > On Mon, 28 Jan 2013, Alexander Klenin wrote: >> I have a compromise suggestion: >> Implement for-index extension with the syntax: >> for (k, v) in a do >> this syntax is forward-compatible with both tuples proposals, >> is simple to

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Mon, 28 Jan 2013, Alexander Klenin wrote: On Mon, Jan 28, 2013 at 2:59 AM, Michael Van Canneyt wrote: On Mon, 28 Jan 2013, Alexander Klenin wrote: I have a compromise suggestion: Implement for-index extension with the syntax: for (k, v) in a do this syntax is forward-compatible with bo

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

2013-01-27 Thread Sven Barth
On 27.01.2013 16:27, luiz americo pereira camara wrote: 2013/1/26 Sven Barth : On 26.01.2013 12:52, Alexander Klenin wrote: On Sat, Jan 26, 2013 at 10:50 PM, Sven Barth wrote: Generics was implemented without my knowledge. I only found out when suddenly the classes unit had been changed to

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Hans-Peter Diettrich
Preface: In the following I assume that tuples can be implemented by records. The proposed syntax extensions can be applied to records as well, they are not restricted to a new type. Alexander Klenin schrieb: On Sun, Jan 27, 2013 at 12:35 PM, Hans-Peter Diettrich wrote: (a, b) := (b, a); /

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Hans-Peter Diettrich
Sven Barth schrieb: The lack of element names results in bloated code and runtime overhead. See below. I don't see why it should result in bloated code and runtime overhead. ---> See below ;-) (a, b) := (b, a); // the compiler needs to ensure the correct usage of temps here! What wil

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

2013-01-27 Thread Michael Van Canneyt
On Sun, 27 Jan 2013, Sven Barth wrote: On 27.01.2013 16:27, luiz americo pereira camara wrote: 2013/1/26 Sven Barth : On 26.01.2013 12:52, Alexander Klenin wrote: On Sat, Jan 26, 2013 at 10:50 PM, Sven Barth wrote: Generics was implemented without my knowledge. I only found out when sud

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 4:19 AM, Michael Van Canneyt wrote: > Define an iterator type/operator. > > - No interface > - No 'specially named function' in the class. The iterator should be > separate from the class. > Now they promoted 1 function with a special name to a special status: > 'GetEnumera

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Michael Van Canneyt
On Mon, 28 Jan 2013, Alexander Klenin wrote: On Mon, Jan 28, 2013 at 4:19 AM, Michael Van Canneyt wrote: Define an iterator type/operator. - No interface - No 'specially named function' in the class. The iterator should be separate from the class. Now they promoted 1 function with a special

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

2013-01-27 Thread luiz americo pereira camara
2013/1/27 Sven Barth : > On 27.01.2013 16:27, luiz americo pereira camara wrote: >> >> >> I did some test with generics last year: >> http://lazarusroad.blogspot.com.br/2012/06/cost-of-using-generics.html >> >> I would not use in classes unit > > > That's mostly about the "duplication" problem, whi

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Alexander Klenin
On Mon, Jan 28, 2013 at 4:46 AM, Hans-Peter Diettrich wrote: > Preface: In the following I assume that tuples can be implemented by > records. The proposed syntax extensions can be applied to records as well, > they are not restricted to a new type. Ok, with a few caveats listed below. >> Any ti

Re: [fpc-devel] RFC: Support for new type "tuple" v0.1

2013-01-27 Thread Sven Barth
On 27.01.2013 20:16, Alexander Klenin wrote: Borland did a world of good for (Object) Pascal, up to Delphi 7. After that, it went seriously downhill in my opinion; Adding randomly features without clear direction or regard for the intent and philosophy of the Pascal language - or so it seems to m

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

2013-01-27 Thread Sven Barth
On 27.01.2013 20:46, luiz americo pereira camara wrote: What would have been more interesting is the performance of the generated code compared with e.g. a TStringList or a TObjectList. Independent of the performance, what's the benefit of replacing the current implementation by one based in ge

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

2013-01-27 Thread Sven Barth
On 27.01.2013 19:09, Michael Van Canneyt wrote: On Sun, 27 Jan 2013, Sven Barth wrote: On 27.01.2013 16:27, luiz americo pereira camara wrote: 2013/1/26 Sven Barth : On 26.01.2013 12:52, Alexander Klenin wrote: On Sat, Jan 26, 2013 at 10:50 PM, Sven Barth wrote: Generics was implemente

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

2013-01-27 Thread luiz americo pereira camara
2013/1/27 Sven Barth : > On 27.01.2013 20:46, luiz americo pereira camara wrote: >>> >>> What would have been more >>> interesting is the performance of the generated code compared with e.g. a >>> TStringList or a TObjectList. >> >> >> Independent of the performance, what's the benefit of replacing