[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The meaning of pattern variables
- Subject: Re: The meaning of pattern variables
- From: nml <arumakanil@xxxxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Fri, 8 Dec 2017 20:01:11 +0800
- To: myrddin-dev@xxxxxxxxxxxxxx
It makes sense now after reading up the spec.
I should have done that before making stubborn assumptions.
On 7 December 2017 at 14:25, nml <arumakanil@xxxxxxxxx> wrote:
>
> As far as I understand the assignment operator (=) can have two meanings.
> The first is binding a value to an identifier, which is a compile-time
> operation, which does not map directly to generated machine code.
> The second is storing a value to a location represented by a variable.
>
>
> What is the case for pattern variables like `i` in `for i : [Foo Bar Baz]`?
>
> I suppose they are identifier binding and no new variable allocations and
> assignment(storing) is involved. So `i` should have exactly the same lvalue
> as the variables it is bound to.
>
> Which means &i == &Foo when i is bound to Foo. Do I understand it
> correctly?
>
>
> --
> mura
>