3 ms·
The whole page, beside being really outdated, feels to be written by multiple people, each of them disliking different aspects of different languages, thus real
by yedpodtrzitko 7y ago
The whole page, beside being really outdated, feels to be written by multiple people, each of them disliking different aspects of different languages, thus really inconsistent.
- jakear 7y agoSome are downright silly: > C#: You can't perform any operations, even simple arithmetic, with objects inside a generic method (e.g. T plus<T>(T t1, T t2) { return t1+t2; } Well... obviously.
- nmca 7y agoObviously? Surely that's just a type constraint.
- 1000units 7y agoYes, you have to specify the constraint for code that assumes the constraint to type-check.
- jakear 7y agoC# doesn't claim to have powerful type inference a la. Haskell, so there's no reason to expect it to extract type information from usage of parameters inside generic functions. If you need functionality inside the body, you gotta declare that functionality in the type constraints.