I was looking over an example of named parameter passing:

        foo(:a<1>, :b<2>)

And had the thought that we might be able to get away with treating named parameters as lvalues, making the above:

        foo(:a=1, :b=2)

Would this be unreasonable? Does it break anything else? I'm not sure that subscripting-like notation would be a bad thing to have, but if we could "assign" an arbitrary expression to a name parameter, I think subroutine and method calls would be a heck of a lot more like their own documentation. It also makes things like this easier to write:

        arc(:radians=pi);

If you use this syntax for something that would be auto-quoted, it's one extra character:

        add_user(:username="ajs");

but later edits are less complicated:

        add_user(:username="ajs-1");

Thoughts? Is it too late?

Reply via email to