Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-03

Pascal type-parametric definitions

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lukasz Stafiniak

Why are type-parametric definitions called generics in Pascal? It seems to me their semantics is like templates in C++, not like generics in Java/C# (or ML languages).

Regards.

Reply by email

Sven Barth
to Lukasz Stafiniak
"Lukasz Stafiniak" wrote
Why are type-parametric definitions called generics in Pascal? It seems to me their semantics is like templates in C++, not like generics in Java/C# (or ML languages).

They are named generics, because they are "generic" as in "can be used for everything". We do not need to follow the naming of other languages. Also there is the possibility that FPC's generics might be optimized a bit for inheritable types (class, object, interface) once they are feature complete. Then they would behave more like Java generics for such types.

Regards,
Sven

Reply by email