lua-users home
lua-l archive

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

On Fri, Sep 22, 2006 at 03:54:12PM +0200, Grellier, Thierry wrote:
> Yes.
> The fact that patches exist (powerpatch or risclua, ...) shows that
> bitlib isn't a de facto standard, maybe only for those using simple
> expressions, or not motivated to rely on a patch or to create a user
> data.
oops, sorry, not precise enough:
I meant "de facto standard" for bitops as functions, that is:
anything wrong with their semantics, names or whatever?

I didn't want to touch the operator vs. function discussion,
however, a function version does not hurt even if you are using
a patched lua or if some future lua should introduce operators.

Just to offer a stable interface for those which are mostly
concerned with a portable way to express this
(with the option to have it really fast on LuaJIt supported systems).
The LuaBit pure lua implementation has a similar but
not identical set of functions.
Would be nice to agree on common semantics,
which should apply regardless of whether a function or operator is used.

> probably not so easy when one use local bor = bitlib.bor anywhere.
didn't check right now, but IIRC Mike's JIT can catch those.

> I really don't like the idea to go to function. Operators are not
> function.
well, C++ has kind of a different view on that (which I don't share).

> I'd much prefer |, &, ^, <<, >> to be operators with extensible
> semantic.
With the extensible semantic you are going to end up with functions.

> Would people using +, *, -, /, % be happy to use function
> instead? 
Probably they would be happy if the operators are nothing but
sugar for functions calls, which, to some extend,
they are in contemporary Lua.

As Lua already entered the dungeons of operator overloading,
I gather one could turn a lot of unrecognized tokens into
metatable lookups on their left hand operand.
Boy would that make for a weird language!

Personally, I'd for now be ok with a stable function interface.

best regards