4 ms·
I don't know about Smalltalk, but in other languages, a constructor is just a function, and you can "override" it by passing in a different function. The flaw
by skybrian 7y ago
I don't know about Smalltalk, but in other languages, a constructor is just a function, and you can "override" it by passing in a different function.
The flaw in Java is that constructors aren't functions, so you need to wrap them. Wrapping is easy in simple cases but gets annoying fast when you have lots of arguments.
To get around this, you can group arguments using a struct, and sometimes there's a natural way to do it, but that gets annoying in languages without lightweight, easy-to-use structs.