[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Why no metamethods for logical operators?
- From: "Firestone, Rameses" <rameses.firestone@...>
- Date: Wed, 24 Mar 2004 09:24:58 -0800
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:email@example.com]On Behalf Of > > RLake@oxfam.org.pe
> Sent: Wednesday, March 24, 2004 8:53 AM
> To: Lua list
> Subject: RE: Why no metamethods for logical operators?
> > I believe C++ must also decide at runtime.
> C++ can tell at compile time because the short-circuit behaviour
> only applies to primitive types, not classes. (You cannot subclass
> a primitive type in C++).
Ok yes I agree, I misunderstood the original answer.
> In my opinion, the fact that you can override short-circuiting
> operators in C++ is just plain wierd. But the fact that you
> can override , is pretty wierd too. C++ gives you lots of
> latitude to write unreadable programs.
This is true. Like many other tools it can be abused. But it is
also powerful in it's own way. Also there is almost no other choice
of language if you wish to write fast reasonably portable object
What I like about Lua is it is mainly targeted as an extension
language. It doesn't try to claim it's the best language for all
applications. It seems like some people like to push Java in this
this manner and in my experience it often falls flat on It's face.
> In any event, the use of "+" for "or" and "*" for "and" makes
> a lot of sense; few datatypes would require different semantics.
My main problem is I need + for + and * for *. So this wouldn't
work for me. I can always use a function. The only problem is the
syntax doesn't look so clear.