Nice article, learned a lot about Swift, love the named parameters and argument labels, makes calling functions with many parameters much more reliable and with labels reads like English, which is great for immediate comprehension. Lack of Named parameters in Javascript, is for me, a critical glaring missing capability, that should be fixed urgently.
Indeed. What that pattern also solves, and AFAIK most static languages lack, is argument forwarding (though Python solves this even more elegantly than JS):
Syntax special-cased to function parameters/arguments is more elegant than reusing the same object&spread syntax everywhere to achieve the same effect? I don't think so.
JS parameters are named to some extent, as in you can refer to them by name within the function body - BUT (a critical shortcoming in my view) you can’t assign values by name when calling functions, you can only assign values by position.
AFAIK the first only works for positional (non-keyword) arguments. The second works, I guess? Not an expert in JS, especially not the "new parts", splats are definitely an improvement!
Yes an object is better than nothing, but is awkward syntax compared to proper named parameters and I don’t see it being used very often. In Postgres I find named paremeters far more convenient than positional paremters for calling functions, also conveys intention much better, also great for defaults (you can use default=null to get around ordering retstriction Postgres has).