3 ms·
It's funny that generics are supported in Pascal, but not in its spiritual successor, Go. (Of course, Go's succession goes not directly from Pascal, but throug
by nine_k 8y ago
It's funny that generics are supported in Pascal, but not in its spiritual successor, Go.
(Of course, Go's succession goes not directly from Pascal, but through Modula-2 and Oberon.)
- agumonkey 8y agois the discussion about Generics over in golang-dev ?
- magicalhippo 8y agoDelphi has compile-time generics, which is kind of a "worst of both worlds" approach. It has all the constraints of templates, but none of the benefits of run-time instantiated generics like .Net has. For example you can't make a generic function that uses the + operator to add two parameterized elements together, because there's no way to constrain the types to only those which has the + operator defined. But unlike templates in C++, the compiler doesn't just try and see if it works but rather emits an error.