[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: flexible syntax?
- From: David Jeske <jeske@...>
- Date: Thu, 21 May 1998 23:21:38 -0700
On Fri, May 22, 1998 at 01:30:44AM -0300, Dan Marks wrote:
> I have written matrix manipulation commands on top of Lua
> and I would like to have them be as Matlab like as possible.
> Is it possible to somehow have Lua read the syntax
It would be very "meta-language" oriented to have some kind of operator
overloading system in Lua. However, I tend to agree with the
anti-operator-overloading camps in most languages.
> and have that passed to the gettable tag method (or settable?)
> So far I have done this:
That's bizarre. I assume you are never actually accessing a table, but
rather just using the fallback.
> because it will pass a single object (the table) but not multiple
> objects as in x[-5,5]. The reason I want to use this syntax is that
> because there is both a gettable and settable tag method I can
> use the same syntax for assigning and reading a location. Does
> creating the table for each access of the element slow down Lua
You can have the same syntax be used for assigning and reading a location
matrix_access(-5,5) can return something which is tagged with get/set
fallbacks so that both:
> a = matrix_access(-5,5)
> matrix_access = a
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + email@example.com