Re: Multi-assign
- Posted by mattlewis (admin) Nov 17, 2011
- 2545 views
A new keyword is a really bad idea.
I agree with you, but I am curious as to why you think that.
I just thought using a keyword would be too confusing, as it'd be too easy to think it was a variable name or something.
I agree with those reasons, and also believe that we should generally be parsimonious about adding keywords.
I think we need to have a glyph of some sort, and a visually prominent one would be preferable. We should try to avoid characters that are potentially typos.
Agreed. This arguably takes the underscore out of the equation as well (as it could be a typo on either side - variable named "_math" turned into "_,math" or something).
Yes, I agree with these. However, I think I may be the only one who still thinks the $ is perfect.
{ A, @, B } = SomeFunc(1, @, 2)
I could live with this.
This is not awful, though I'd always imagined using @ for implicit routine id's or something in the future.
{ A, %, B } = SomeFunc(1, %, 2) { A, ^, B } = SomeFunc(1, ^, 2) { A, &, B } = SomeFunc(1, &, 2) { A, *, B } = SomeFunc(1, *, 2) { A, ?, B } = SomeFunc(1, ?, 2)
These all look like operations to me. Even the caret (we don't use it, but it reminds me of power() in other languages).
Yes. I was thinking modulo (%) and bitwise xor (^).
I think my preferences, so far, in order, are: $, ~, @.
Matt