3 ms·
My (least) favorite example of a complicated minor feature is method overloading. This seems like it's a small feature, it isn't heavily used or discussed, but
by recursivedoubts 5y ago
My (least) favorite example of a complicated minor feature is method overloading. This seems like it's a small feature, it isn't heavily used or discussed, but it had huge implementation implications in the JVM language I used to work on:
- it makes parameter-position based inference harder
- it makes generics harder
- it ends up bleeding into bytecode, since methods can't be uniquely identified by just a name
I would say that 15-20% of the total compiler complexity arose from this one, seemingly minor language feature. All the more unfortunate that there are other, better language features that can handle the problems that method overloading addresses, but we had to be compatible w/ Java.
In this case, it is the interaction of the minor feature with other features that is the killer.
- enriquto 5y ago> seemingly minor language feature This is not at all a "minor" language feature. Allowing different functions with the same name is an obvious atrocity that necessarily leaches to the whole language. For every function call you need to find all instances where its name is defined, not just one. Imagine allowing variables with the same name but different types; the actual variable to be determined according to the context. Wouldn't that make interpreting the language much more difficult? The same thing happens with overloaded functions or methods.