Named arguments in Swift


Today I learned! Via kornel on

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 like init_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

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!

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.