[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why no metamethods for logical operators?
- From: Jamie Webb <j@...>
- Date: Fri, 26 Mar 2004 20:30:11 +0000
On Wednesday 24 March 2004 16:36, Firestone, Rameses wrote:
> I need the (+ - * /) operators for similar things to what they do now.
> The (.. ^) operators are a possibility but their precedence makes them
> problematic. Another possibility would be a generic user definable
> operator such as ~operator_name~. I could then write something like
> "e1.x - e2.x < 50 ~or~ e1.x - e2.x > 200". I realize this is probably
> a major change. I'm just thinking out loud.
Perhaps not such a major change... it's already possible to simulate a
high-precedence operator which looks like this:
(e1.x - e2.x < 50) :otherwise (e1.x - e2.x > 200)
Perhaps just one new level of precendece would suffice? E.g.
e1.x - e2.x < 50 !otherwise e1.x - e2.x > 200
would have exactly the same semantics, but using the ! would imply a low
precedence. That ought to be a fairly simple change to the parser.
-- Jamie Webb