[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Deep __newindex on assignment?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 23 Dec 2009 09:34:00 -0200
> i think formally there's no difference between primitives 'value
> based' types and 'reference based'
>
> to me, it's more like this:
>
> - values have type
> - variables have no type
> - variables reference values
> - simple assignment and function parameters copy variables (that is,
> references), not values
> - there are immutable types (number, string, lightuserdata), and
> mutable types (table, function, full userdata)
>
> implementation detail: numbers and lightuserdatas are small enough to
> reside in the variable themselves and are copied around; but since
> they're immutable, it doesn't make any difference.
>
> IOW, the 'by value vs. by reference' is only an implementation detail
> and not a formal specification. the behaviour must conform to the
> theoretical specification where every variable holds only a reference.
Quite good explanation.
-- Roberto
- References:
- Deep __newindex on assignment?, Todd Berkebile
- Re: Deep __newindex on assignment?, Alexander Gladysh
- RE: Deep __newindex on assignment?, Todd Berkebile
- Re: Deep __newindex on assignment?, Peter Cawley
- RE: Deep __newindex on assignment?, Todd Berkebile
- Re: Deep __newindex on assignment?, Peter Cawley
- Re: Deep __newindex on assignment?, Alexander Gladysh
- Re: Deep __newindex on assignment?, Ted Unangst
- Re: Deep __newindex on assignment?, Alexander Gladysh
- Re: Deep __newindex on assignment?, Javier Guerra