Hi,

In message "Re: Semantics of Multiple Values (updated RCR)"
    on 04/04/27, Kristof Bastiaensen <kristof / vleeuwen.org> writes:

|TITLE
|
|Semantics of Multiple Values

Interesting, but I'm afraid this one is too big (and too complex)
change.  I'd like to see a language with this semantics though.

|*[a, *b] = [1, 2, 3]
|=> a == 1, b == [2, 3]
|
|or perhaps with hashes:
|
|*{:a => c, :b => d} = {a: 1, b: 2}
|=> c == 1; b == 2
|
|*{:a => c, *b} = {a: 1, b: 2, c: 3}
|=> c = 1, b = {:b => 2, :c => 3}

|        func3((1, 2), 4)
|        => [1, 4]
|        #or maybe signal error?  not sure about this one

Making (1,2) as values is not a good idea.  Perhaps we should prepare
"array to values" converter (opposite of your "values" method).

|        func2(*values(multi), 4)
|        => [1, 2, 3, 4]

I'm still against argument splat in the middle of actual argument
list.  It's not consistent with formal argument list, where splat is
only allowed at the end.

|There may be other features of multiple assignment that could be taken
|from argument passing, for example hash parameters(?). Other may not
|be appropriate (i.e. blocks).
|
|example:
|
|def func6
|  return 4, b: 5, c:6
|end
|
|a, b:, **keys = func6
|=> a == 4; b == 5; keys == {:c=>6}

I just don't feel right about this.  Maybe arguments and return values
are different beasts in my brain, even though continuation tells us
their similarity.

|*  Comparing multiple values
|*  Unify operator

I have to confess I couldn't understand those two proposals, how they
behave, and how they are useful.

							matz.