[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: bitwise ops and opcodes
- From: Gavin Wraith <gavin@...>
- Date: Fri, 10 Feb 2006 09:01:34 GMT
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.10) POPstar/2.05
Content-Type: text/plain; charset=us-ascii
On the topic of bitwise operations for Lua, RiscLua has had
these for 6 years, initially with Reuben Thomas's bitlib, but
more recently with new infix operators:
& (and), | (or), ^^ (xor), ~ (not), << (lshift), >> (rshift)
For opcodes I simply took the next available ones (after ... ).
The point of this email is to suggest that it might be sensible
for the sake of portability and compatibility if the Lua team
were to reserve a block of opcodes for further expansions of
this kind. People like myself who create extensions - in my
case for a very minor platform - might then be able to register
a subblock of this "user block". The upside is more
bytecode compatibility, the downside that very occasionally
the team would have the burden of registering, or refusing
to register, a subblock. Conceivably there could be pressure
on opcode real estate in the future, and registration would
underline the Lua team's ownership of it.
One more snippet about syntax: RiscLua uses "\" as an
abbreviation for "function" and "=>" as an abbreviation
for "return". This gives the potential for a snappier
Haskell-like syntax, e.g.
curry = \(f)=>\(x)=>\(y)=>f(x,y) end end end
Yes, I know it is out of the Pascal-style tradition of
using words, but I find it very readable. It is an extremely
simple patch to llex.c.
Gavin Wraith (email@example.com)
Home page: http://www.wra1th.plus.com/