Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Peter Vreman
> Peter Vreman wrote: >> Expiriment, feed g++ code with errors in the statements. With macro's >> those errors won't be show until the macro is used. But with templates >> this is diffent: > > Smart indeed :) > >> This is more important than the syntactical sugar. The rules where to >> declare gene

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Micha Nelissen
Peter Vreman wrote: Expiriment, feed g++ code with errors in the statements. With macro's those errors won't be show until the macro is used. But with templates this is diffent: Smart indeed :) This is more important than the syntactical sugar. The rules where to declare generics and how/when

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Peter Vreman
> Peter Vreman wrote: >> I did some tests with g++. It looks like it parses the template >> 'normally' >> and don't handle it like a macro. When instantiating the template the >> generic type is replaced. > > What tests did you do to come to this conclusion ? I mean, how can one > see how g++ parse

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Vinzent Hoefler
On Friday 04 November 2005 13:48, Vinzent Hoefler wrote: Stupid KMail. Deleted the text after file's eof. After the file there was supposed to be a remark about that the example does not compile as is, because generics in Ada are different from C++ templates, which are merely more like macros,

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Vinzent Hoefler
On Friday 04 November 2005 13:27, Marco van de Voort wrote: ["<>"] > The evil is in > > - using characters instead of modifiers. > - worse, recycling already used characters. Alright, I completely understand at least the first part, so perhaps they should simply not be overused. :-) Just for th

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Micha Nelissen
Peter Vreman wrote: I did some tests with g++. It looks like it parses the template 'normally' and don't handle it like a macro. When instantiating the template the generic type is replaced. What tests did you do to come to this conclusion ? I mean, how can one see how g++ parses things ? f

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Peter Vreman
> Micha Nelissen wrote: >> >> type >> TGenericCollection = generic(T: TCollectionItem) class(TComponent) >> ...implement TCollection and use T >> end; >> >> TCollection = TGenericCollection of (TCollectionItem); >> TFieldDefs = TGenericCollection of (TFieldDef); >> > > So generic procs

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Marco van de Voort
> types _at least_ in Ada's generics back in 1983[*] already. > Perhaps someone should take a look at those, because these are also > quite different from C++-templates. > > > Vinzent. > > [*] That would be the same year the term "C++" just appeared first in > history of programming languages

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Marc Weustink
Mattias Gaertner wrote: On Fri, 04 Nov 2005 13:44:55 +0100 Marc Weustink <[EMAIL PROTECTED]> wrote: Mattias Gaertner wrote: On Fri, 04 Nov 2005 10:47:42 +0100 Marc Weustink <[EMAIL PROTECTED]> wrote: Daniël Mantione wrote: Op Thu, 3 Nov 2005, schreef Mattias Gaertner: Here is a p

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Vinzent Hoefler
On Friday 04 November 2005 13:00, Micha Nelissen wrote: > Combining some of the wiki ideas, and has no "evil" <> characters > :-). I don't understand the fuzz about using "<>". It's not even close to being C(++)-ish, because it was used for describing discrete range types _at least_ in Ada's ge

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Micha Nelissen
Micha Nelissen wrote: type TGenericCollection = generic(T: TCollectionItem) class(TComponent) ...implement TCollection and use T end; TCollection = TGenericCollection of (TCollectionItem); TFieldDefs = TGenericCollection of (TFieldDef); So generic procs could look like: function

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Vincent Snijders
Ales Katona wrote: Example: procedure MyProc(T); // generic procedure without parameters ver i: T; begin ... end; procedure MyProc(T: TClass); // non generic procedure begin end; Call MyProc(TObject); What will happen? Mattias Sky will reign fire: procedure (var T); begin // gener

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Micha Nelissen
Ales Katona wrote: Are the () required? Why not TSomeList = TGenericList of Pointer; ? I guess, but in general one can use multiple generic types when coding a class, so this is to point out that it's ordered and defined. Micha ___ fpc-devel maill

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Marc Weustink
Ales Katona wrote: Micha Nelissen wrote: Marc Weustink wrote: BTW, what woud be the problem with type TMySpecificClass = TGenericClass(TObject, Integer); Or: type TGenericCollection = generic(T: TCollectionItem) class(TComponent) ...implement TCollection and use T end; TColl

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Ales Katona
Example: procedure MyProc(T); // generic procedure without parameters ver i: T; begin ... end; procedure MyProc(T: TClass); // non generic procedure begin end; Call MyProc(TObject); What will happen? Mattias Sky will reign fire: procedure (var T); begin // generic or not?? end; ___

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Ales Katona
Micha Nelissen wrote: Marc Weustink wrote: BTW, what woud be the problem with type TMySpecificClass = TGenericClass(TObject, Integer); Or: type TGenericCollection = generic(T: TCollectionItem) class(TComponent) ...implement TCollection and use T end; TCollection = TGenericColl

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Mattias Gaertner
On Fri, 04 Nov 2005 13:44:55 +0100 Marc Weustink <[EMAIL PROTECTED]> wrote: > Mattias Gaertner wrote: > > On Fri, 04 Nov 2005 10:47:42 +0100 > > Marc Weustink <[EMAIL PROTECTED]> wrote: > > > > > >>Daniël Mantione wrote: > >> > >>>Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > >>> > >>> > >>> >

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Micha Nelissen
Marc Weustink wrote: BTW, what woud be the problem with type TMySpecificClass = TGenericClass(TObject, Integer); Or: type TGenericCollection = generic(T: TCollectionItem) class(TComponent) ...implement TCollection and use T end; TCollection = TGenericCollection of (TCollectionItem

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Marc Weustink
Mattias Gaertner wrote: On Fri, 04 Nov 2005 10:47:42 +0100 Marc Weustink <[EMAIL PROTECTED]> wrote: Daniël Mantione wrote: Op Thu, 3 Nov 2005, schreef Mattias Gaertner: Here is a proposal of the syntax: type TGenericClass = class public procedure Add(Item: T; Flag: F); end; This sy

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Mattias Gaertner
On Fri, 04 Nov 2005 10:47:42 +0100 Marc Weustink <[EMAIL PROTECTED]> wrote: > Daniël Mantione wrote: > > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > > > >>Here is a proposal of the syntax: > >> > >>type > >> TGenericClass = class > >> public > >>procedure Add(Item: T; Flag: F)

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Florian Klaempfl
Daniël Mantione wrote: > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > >>Here is a proposal of the syntax: >> >>type >> TGenericClass = class >> public >>procedure Add(Item: T; Flag: F); >> end; > > > This syntax is almost impossible to implement since in one of your other > mai

Re: [fpc-devel] Templates / Generics Syntax

2005-11-04 Thread Marc Weustink
Daniël Mantione wrote: Op Thu, 3 Nov 2005, schreef Mattias Gaertner: Here is a proposal of the syntax: type TGenericClass = class public procedure Add(Item: T; Flag: F); end; This syntax is almost impossible to implement since in one of your other mails the symbols to mark the para

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Mattias Gaertner
On Thu, 03 Nov 2005 22:35:34 +0100 Peter Vreman <[EMAIL PROTECTED]> wrote: > At 20:41 3-11-2005, you wrote: > >On Thu, 3 Nov 2005 20:25:07 +0100 (CET) > >Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > > > > > Right. I didn't thi

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Peter Vreman
At 20:41 3-11-2005, you wrote: On Thu, 3 Nov 2005 20:25:07 +0100 (CET) Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > Right. I didn't think of that. > > > > What about edged brackets? > > > > type > > TGenericClass[T,F] = class > > public

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Mattias Gaertner
On Thu, 3 Nov 2005 20:25:07 +0100 (CET) Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > Right. I didn't think of that. > > > > What about edged brackets? > > > > type > > TGenericClass[T,F] = class > > public > > procedure Add(Item:

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Daniël Mantione
Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > Right. I didn't think of that. > > What about edged brackets? > > type > TGenericClass[T,F] = class > public > procedure Add(Item: T; Flag: F); > end; At first sight it looks okay. If necessary it is possible to introduce a two charac

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Mattias Gaertner
On Thu, 3 Nov 2005 20:10:35 +0100 Mattias Gaertner <[EMAIL PROTECTED]> wrote: > On Thu, 3 Nov 2005 19:59:40 +0100 (CET) > Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > > > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > > > > > > Here is a proposal of the syntax: > > > > > > type

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Mattias Gaertner
On Thu, 3 Nov 2005 19:59:40 +0100 (CET) Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > > > > Here is a proposal of the syntax: > > > > type > > TGenericClass = class > > public > > procedure Add(Item: T; Flag: F); > > end; > > Thi

Re: [fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Daniël Mantione
Op Thu, 3 Nov 2005, schreef Mattias Gaertner: > > Here is a proposal of the syntax: > > type > TGenericClass = class > public > procedure Add(Item: T; Flag: F); > end; This syntax is almost impossible to implement since in one of your other mails the symbols to mark the parameters

[fpc-devel] Templates / Generics Syntax

2005-11-03 Thread Mattias Gaertner
Here is a proposal of the syntax: type TGenericClass = class public procedure Add(Item: T; Flag: F); end; procedure TGenericClass.Add(Item: T; Flag: F); // Note: No redundant after TGenericClass. begin end; I think, the parameters should be at the identifier name, not in the class b