Marc Weustink wrote:

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

I aggree. Why not use new keywords 'template', 'generic', like the current 'array' or record'? That would make the code more readable, and remove ambiguity problems. It won't cost much, compared to the total size of a template.

It's also more pascal-like, as opposed to C, where e. g. a pointer is denoted with '*' and, at the same time, identifies an array etc.

(sorry if this is out of time or had already been discussed - I just entered this thread here).

Anton


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to