Named arguments in Swift
SoftwareToday I learned! Via kornel on lobste.rs:
Yeah, I think Swift nailed it. Its overloading/default args aren’t even a special calling convention or kwargs object. They are merely part of function’s name cleverly split into pieces.
init(withFoo:f andBar:b)
is something likeinit_withFoo_andBar_(f, b)
under the hood.
It’s been a while since I was a full-time developer, but I loved the Objective-C/Smalltalk messaging style over the C/C++ style for parameters, even just for the sake of readability:
Human age: 18 height : 180
Human(18,180)
I might need to mess with Smalltalk again one day. Is there a modern implementation in regular use that isn’t wed to C? Objective Rust, make it happen!