[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: New Lua 4.1 (work) event (handler) tables
- From: "Joshua Jensen" <jjensen@...>
- Date: Thu, 20 Dec 2001 12:32:18 -0700
> This version contains the changes in the previous work
> versions plus the ones recently mentioned by Roberto.
>
> Of course, none of these changes is definitive. This is
> simply a work version that is being made available so that
> you can experiment with it and send us your feedback.
I'm wondering why you chose to only make the event tables (handler
tables) available to tag methods only? That is:
Events =
{
Var = 5
}
MyTable =
{
Var = 10
}
eventtable(MyTable, Events)
print(MyTable.Var)
print(eventtable(MyTable).Var)
As I have stated in previous postings, having these handler tables
available for storing functions can save considerably on memory. Sure,
I can put whatever functions I want in the handler table, but I have to
use the ugly syntax in the second print() above to access the data.
Also, why aren't handler tables available for the basic types? Powerful
namespace and/or OOP-like abilities can be provided for the basic types
if they have handler tables, too. For instance, if you have a string:
ansiStr = "Hello"
print(ansiStr->len()) -- Assuming -> is a : operator that accesses the
handler table
Even better, if there was an additional string type, say for Unicode:
unicodeStr = L"Hello"
print(unicodeStr->len())
You can't tell the difference. Both ansiStr and unicodeStr appear to
have the same interface, which makes the learning curve even less.
Thanks,
Josh