[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using closures was:Re: Lua5.0 new "For" question
- From: "Peter Hill" <corwin@...>
- Date: Sun, 29 Dec 2002 18:05:11 -0000
Peter Hill:
> I'm having trouble trying to imagine a way to get the same functionality
> (which doesn't mean it can't be done of course!). As an example, let's try
> to implement complex numbers as an abstract type.
Eero Pajarre:
> This is a quick (late night) implementation of an idea I got,
Excellent! Thank you. I wasn't really sure it could be done.
> I think it has reasonable overhead. It is heavyweight for something as
> simple as a complex number, but maybe reasonable for something more
> complex. (I think that the cost of a small function is ok)
The overhead doesn't seem too bad. Each object is a function closure plus a
static variable. I notice that this method would also work in Lua4 using
upvalues instead.
> Btw, this is still not safe against someone who is actively trying to
> cheat
How so?
*thanks again*
Peter Hill.
- References:
- Lua5.0 new "For" question, Peter Hill
- Re: Lua5.0 new "For" question, Björn De Meyer
- Re: Lua5.0 new "For" question, Peter Hill
- Re: Lua5.0 new "For" question, Vincent Penne
- Re: Lua5.0 new "For" question, Peter Hill
- Re: Lua5.0 new "For" question, Björn De Meyer
- Re: Lua5.0 new "For" question, Eero Pajarre
- Re: Lua5.0 new "For" question, Björn De Meyer
- Re: Lua5.0 new "For" question, Eero Pajarre
- Re: Lua5.0 new "For" question, Peter Hill
- Using closures was:Re: Lua5.0 new "For" question, Eero Pajarre