lua-users home
lua-l archive

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


<20050903232418.A5774@lua.tecgraf.puc-rio.br>
<431AABAA.4020404@GMX.net> 
 <20050904122458.GA4371@mike.de>
<4E9BC0D4-08AB-4720-A02C-523EE40762A5@dnainternet.net>
<20050904133200.GA4621@mike.de> 
<20050904110020.2a80dd5f.cpressey@catseye.mine.nu>
<2781f020602090739w412159c9q17145a29584d8971@mail.gmail.com> 
 <2781f020602090745n2dfc7cebp8cea9c9f9be5989@mail.gmail.com>
<43EBA247.3050807@innocon.com> 
 <2781f020602091306t7f3512b4s1fd494229ceded29@mail.gmail.com>
In-Reply-To:
<2781f020602091306t7f3512b4s1fd494229ceded29@mail.gmail.com>
X-Organization: Home
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.10) POPstar/2.05
Reply-To: lua@bazar2.conectiva.com.br
MIME-Version: 1.0
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 (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/