[fpc-pascal] Generic type declaration example versus
Marco van de Voort
marcov at stack.nl
Sun Nov 22 18:08:27 CET 2009
In our previous episode, Michael Van Canneyt said:
> > 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.
(Redundancy plays its main role in case of detecting errors and
error-recovery. Both in natural as artificial languages. Errormessage
quality is one of the main benefits of FPC/Delphi IMHO )
More information about the fpc-pascal