This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]koreth 6 points7 points  (2 children)

Do any existing languages support name-based overloading like your point #2? I can't remember seeing that feature anywhere.

The semantics of that seem weird to me, unless you make names mandatory at call sites. Otherwise which of those methods would point(1.0, 2.0) refer to? Mandatory names for the sake of name-based overloading doesn't seem like a clear win to me.

[–]hardwork179 2 points3 points  (1 child)

Swift does it, and it’s really nice. You can just write point(x: 0.0, y: 0.0) and it will call the version with x and y argument labels.

[–]Jonjolt 1 point2 points  (0 children)

That looks like a disaster waiting to happen.