[fpc-devel] Templates / Generics

Marc Weustink marc at dommelstein.net
Mon Nov 7 21:07:42 CET 2005


Bram Kuijvenhoven wrote:
> Micha Nelissen wrote:
> 
>> Bram Kuijvenhoven wrote:
>>
>>> Florian Klaempfl wrote:
>>>
>>>> - we'll use a syntax as close as possible to Chrome, e.g.
>>>> type
>>>>   TList<T> = class
>>>>     ...
>>>>   end;
>>>
>>>
>>> I greatly favor this syntaxis above the generic-modifier. It will 
>>> look at a lot more familiar to most programmers (due to e.g. C++ and 
>>> Java), 
>>
>>
>> "Must look familiar" programmers should be fired.
> 
> 
> Of course, the implementation of generics in Pascal should not depend 
> solely on how it is implemented in other languages. I should in the 
> first place fit into Pascal.

Since it is already decided that it would be <> I didn't mix into the 
discussion anymore. However, I'll make a comment on this.

> Does <> for generics fit into Pascal? Well, we use [] for array 
> indexing, and () for parameter passing to procedures/functions/methods. 
> So why not use <> for passing parameters to generic types? And, similar 
> to the case of function calls and array indexing, these <> could follow 
> the type identifier directly.

Params are passed to a procedure define like

   procedure MyProc(param, param, ..)

Arrays are declared like

   A: array[0..9] of ...

And generics.... they are soly defined by the fact that a type has <> in it.

That is imo inconsequent.

Marc




More information about the fpc-devel mailing list