How to do labels and how to do wildcards/partial application are slightly orthogonal decisions. The first help the later, but can be designed separately. Of course the two should be compatible.
Also, not sure why you want => instead of the simpler and clearer =.
addNewControl("New", 50, 20, 100, 50);
What does that mean? Types don't help, it's just &str, int, int, int, int
agree that the named arguments are a nice solution here (which is why i like the python idea, you get the ability to annotate with names routinely)...
.. but with the C++ overloading, you can "say it with types". How about..
'addNewControl' could have all sorts of overloads, - e.g. omit the 'size', and you expect it to figure it out itself. Omit position, and you expect it to place somewhere sensible in the parent window.
Its funny how divisive this is. I've seen people argue against keyword args claiming that leveraging types is superior. (You're creating more semantics the compiler understands) - but I don't see them as mutually exclusive. I'd like both
Also, not sure why you want => instead of the simpler and clearer =.
that doesn't fit in rusts' grammar already; = can be used within expressions. (but it returns () unlike c++.. not sure of the use)
I believe Iām also a bit late, but Iām glad that this thread is still alive.
I just wanted to say that I really like @Drupās idea about wildcards/placeholders foo(_, 2, _, 3) for a few reasons:
The original function doesnāt need to be modified in order to allow this
As he suggests, it could also be used with operators and I believe that more complex expressions too, although Iām not sure to what degree it could be nested without ambiguity (for example, in _ + _.f(1, _) is the third ā_ā the identity function or the third parameter of the entire expression?)
Thereās no syntactic noise at all
I have one doubt though. What if the arguments arenāt exactly in that order? Could it be possible to use ordered placeholders to get something like $2.f($1)? I guess that repeating the dollar or whatever character is prefered could be used to escape nested expressions and avoid the ambiguity problem I mentioned in the second bullet: $1 + $2.f(1, $$1). Iām not sure that this fixes all the cases, though:
Perhaps it could be resolved by the type checker or should nested placeholders be forbidden? They donāt seem to be necessary at all.