# Re: Using lists "containing" arrays as lvalues

```HaloO,

Ingo Blechschmidt wrote:
```
`But there is a problem with the ordinary assignment form:`
```

If the LHS is an ordinary list (i.e., if we don't use help from the
grammar/macros),
```
```
What is a 'ordinary List' to you? I thought (,) constructs a Lazy list?

```
```then the @tail would get flattened before it reached
the assignment operator. This is turn would cause the statement not to
DWIM:

my (\$head, @tail) = foo();  # is really

(\$head, @tail) = foo();     # is really (as @tail is empty)
```
```
Aren't you making the silent transition here from the Array type
to the List type? I would argue that the LHS is a Lazy that stores
internal refs to \$head and @tail until it is actually iterated.
What I don't know is how lvalue iteration is distinguished from
rvalue iteration.

Then foo is called and the = is dispatched according to the type
of the return value. The outcome hinges on that and on the type
of (\$head, @tail) which could be the 2-Tupel (Item,Array) or if
you want 'List of ::X' ::X has to be the LUB of Item and Array,
e.g. Object.

Now assume foo() returns (1,2,3) which is a List of Int. Now
&infix:<=> just iterates the LHS and RHS. LHS is iterated for
lvalues, of course. This results in the three assignments:

@tail[0] = 2; # lvalue delivered from LHS list
@tail[1] = 3;

Which is what you expected, or not? For two scalars (\$x,\$y) = (1,2,3)
the above nicely throws a undef assignment exception:

\$x   = 1;
\$y   = 2;
undef = 3; # iterator ran out of values

```
```    (\$head, ())    = foo();     # is really

(\$head)        = foo();     # is really

```
```for this I think we need an easier solution... Perhaps flattenning
it's arguments away silently:

my (\$foo, \$bar, ...) := foo();
```
```
What has become of nullary * for list construction?

my (\$foo, \$bar, *) := foo();
--
\$TSa.greeting := "HaloO"; # mind the echo!
```
• Re: Using lists "containing" arrays as lvalues TSa