[fpc-pascal] Generic type declaration example versus manual.

Michael Van Canneyt michael at freepascal.org
Sun Nov 22 18:03:54 CET 2009

On Sun, 22 Nov 2009, Anthony Walter wrote:

> On Sun, Nov 22, 2009 at 10:27 AM, Marco van de Voort <marcov at stack.nl> wrote:
>> Apparantly it didn't sink in:-)
> Oh it has sunk in, and I've come to expect it. I was/am only trying to
> move the discussion beyond that point (which seems like a brick wall).
> IMO a discussion would serve us better than stonewalling.
>> Implementing something once or twice.
> Okay, but let's take these issues one by one rather than grouping them
> together. Is that more reasonable. Blocking off discussion about some
> feature after it has been started or implemented seems short sighted.
> Sure, you resolve the issue, but it's done by shutting down opinions.
> To address this issue directly (which is what I'd prefer to do), is it
> really that much trouble to convert the syntax from:
> A) generic TStack<T> = class(TObject)
> versus
> B) TStack<T> = class(TObject)
> Points:
> The work that has been done I am guessing is mostly in the generation
> of code templates, rather than the syntax parsing.
> Version A repeats redundant information. Of couse TStack<T> is
> generic, it has those angle brackets after the identifier. They
> wouldn't be legal in a type block unless it was a generic declaration.
> Therefore the word generic is redundant.

Well, in

   A : Integer;

The 'Var' is strictly speaking also redundant, as the : is used only in 
variable declarations. But the 'var' makes it easier to read, and 
Pascal is a verbose language. Additionally, the parsing is easier 
to do, as you know what to expect next. By that rationale, the 'generic' 
keyword was deemed appropriate when FPC made it's implementation.

We'll resolve the incompatibility - remaining backwards compatible to 
FPC itself - when someone finds the time and desire to do so.

Or when someone from our beloved users sends us a patch to this effect.


More information about the fpc-pascal mailing list