lua-users home
lua-l archive

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


Chris Pressey wrote:
On Sun, 4 Sep 2005 15:32:00 +0200
Mike Pall <mikelu-0509@mike.de> wrote:

[...]
And I really don't want to write things like this anymore:

  local opcode = op == "movzx" and 4023 or 4031

But rather:

  local opcode = op == "movzx" and 0x0fb7 or 0x0fbf

If you do write a patch for this, may I suggest the following syntax,
borrowed from Erlang (which possibly borrowed it from somewhere else):

Maybe from Ada 95:
http://www.grammatech.com/rm95html-1.0/rm9x-02-04-02.html

  local opcode = op == "movzx" and 16#0fb7 or 16#0fbf

simply because it is far more general and orthogonal - if you want octal
constants you can prefix them with 8#, and binary constants with 2#. There's no need to remember arbitrary conventions for which prefix goes
with which base, and (FWIW!) you can recognize odd bases like 3# or 9#
just as easily.

Nice notation for big numbers too:
http://www.grammatech.com/rm95html-1.0/rm9x-02-04-01.html

1_202_303_404 for occidentals
1_20_23_03_404 for some Asian countries (India?)
1_20_230_3404 if you feel playful...

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --