lua-users home
lua-l archive

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


RLake:
> Adding a special type that traps assignments strikes me as a really bad
> idea. By the time you got to that point, you would have lost the
> information about the container of the object. Consider the case where the
> container is actually a userdata with metamethods implemented in C. Now,
> what you are asking = to do is to call the __index metamethod of the
> object in order to see if the value is a "trigger value", before calling
> the __newindex metamethod of the object (or instead of calling the
> __newindex metamethod). But what if the object wants to distinguish
> between "read" and "write" accesses? Now, it is going to get a "read"
> access even on "write". Leaving it up to the object to decide what to do
> with its members is a much cleaner approach.

You have a very good point there! The idea does, indeed, have potentially
bad effects if "index / newindex" are involved. Sounds like a good reason to
stick to the current method I suppose.

*cheers*
Peter Hill.

Ki: Contractors... high-paid leeches stealing our work.
Fooker: If you think of them as disposable employees, you'll feel much
better...