lua-users home
lua-l archive

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

Some options :) languages.html#MthmtNmbrSntx

Erlang isn't in the list, but it looks to me pretty similar to Ada in the numeric syntax. I suspect that syntaxes are like people's names: they go in and out of fashion.


On 4-Sep-05, at 1:00 PM, Chris Pressey wrote:

On Sun, 4 Sep 2005 15:32:00 +0200
Mike Pall <> 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):

  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.

(Note that I'm not suggesting # as an infix operator - it's a purely
lexical delimiter... a lot like a decimal point, actually.)