On 2016-01-23 14:19:03 +0000, Jacob Carlborg <d...@me.com> said:

This is mostly to prevent ugly hacks like Flag [1].

http://wiki.dlang.org/DIP88

[1] https://dlang.org/phobos/std_typecons.html#.Flag

Interesting.

This is somewhat similar to an experiment of mine from 5 years ago. My implementation was a bit of a hack, but my intent was to have a proof of concept done quickly. All arguments were considered optionally named in this experiment (there was no syntax to enable this in the function prototype). Also it didn't extend to templates arguments.

You can my discussion with Walter about it here:
https://github.com/michelf/dmd/commit/673bae4982ff18a3d216bc1578f50d40f4d26d7a

Mixing reordering with overloading can become quite complicated. It's good that you leave that out at first. Adding reordering should be left as a separate task for later, if desired. Small steps.

Have you considered supporting separate variable names? Like this:

        void login(string username: name, string password:) {
                writeln(name ~ ": " ~ password);
        }

where an identifier following the colon, if present, would be the name of the variable inside the function. That way you can use a shorter variable when it makes sense to do so. Or change the variable name without affecting the API.

--
Michel Fortin
http://michelf.ca

Reply via email to