[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua Observations/Questions
- From: David Jeske <jeske@...>
- Date: Thu, 8 Jul 1999 10:39:23 -0700
On Thu, Jul 08, 1999 at 01:50:10PM -0300, Norman Ramsey wrote:
> To my mind, the most significant defect of Lua (and there are very few
> such!) is that it's hard to add a new primitive type to the language.
It's not too hard to add custom "complex" data-types in my
experience. Basic datatypes are a bit harder.
For example, I want a proper boolean type. I want a real boolean type,
and I have not yet found a suitable solution because even if I make
"proper" TRUE/FALSE values:
1) I can't control the output of the equality operator so that
it returns my TRUE and FALSE values
2) I can't control the way conditionals interpret their values
so that they see my FALSE as false.
The reason I want a proper boolean type is this:
I use a "parent inheritence scheme" similar to that explained in some
older Lua documentation. This makes object methods and values chain up
to the next parent in the chain. However, because the "nil" value is
"not present" I can never store a nil value to override another
value. Consider this scenerio:
-- Obj sets up my parent chaining mechanism
parent = Obj{ value = 1 }
child = Obj{ parent = parent }
print child.value -- yeilds 1
child.value = 2
print child.value -- yeilds 2
child.value = nil
print child.value -- yeilds 1 <<-- not what I wanted
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net