lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8 November 2012 19:31, Coda Highland <chighland@gmail.com> wrote:
> On Thu, Nov 8, 2012 at 11:24 AM, liam mail <liam.list@googlemail.com> wrote:
>> On 8 November 2012 17:53, David Given <dg@cowlark.com> wrote:
>>> Therefore:
>>>
>>> a = a + 1
>>>
>>> ...does not *change* the value of the thing a points at. Instead it
>>> creates a new number with the value (a+1) and then reassigns a to point
>>> at the new number instead of the old one.
>>
>> How did you come to this conclusion ?
>> 'a' is a place on the stack, yes a temp lua_Number is created to store
>> the result of a+1 yet 'a'(stack slot) is then assigned the value of
>> this temp.
>>
>> --Liam
>>
>
> Read the context.
>
> It doesn't matter what the language *actually* does.
>
> If you have to explain it in terms of stack slots, you've already lost
> most beginning programmers. When you say "a = a + 1" you're saying "I
> want the name 'a' to refer to the value 'a + 1' " and that's it. Don't
> complicate it more than that.
>
> /s/ Adam
>

Funny you should say this because I seem not to be the norm in this
thread where people are suggesting that graphics and high levels of
abstraction should be used to teach children. I am currently teaching
a Eight year old the VM byte code as an introduction to assembly but
thanks for your opinion.

--Liam