Syntactic sugar poll

Maurice Castro maurice@REDACTED
Mon Jan 14 02:52:13 CET 2002

Vote NO! to adding 0x for hexadecimal constants.

The case for leaving the language alone.

In general I am against adding syntactic sugar to a language, in this
case in particular I suspect that we might be on a slippery slope.

Erlang has a well worked out consistent mechanism for handling
constants with many bases. There is no need to extend the language to
satisfy these programmers as they are free to pre-process their files
to use their prefered convention. (eg. sed 's/0x/16#/g' file in this

Furthermore, the case made for changing the language to include the
0x construct has the following additional problems:

1) We are giving a favored place to a particular assembler's convention.
Assembler codes are far from standardised. Although GNU as borrowed C's
convention other assemblers use other conventions.  For example the
very popular tasm used a number followed by an `h' is a heaxadecimal
constant, `b' for binary, `o' for octal, `d' for decimal, or nothing
use the radix defined in the code.

2) A better argument might be to adopt the C convention, however, if we
are going to extend the language to embrace C's way of denoting a
hexadecimal number we had best take the octal notation too ie 0x for
hexadecimal 0 for octal. The octal extension may well break existing

3) Although embracing the 0x convention in the current popular compiler
is simple, it may not be easy to implement it in other compilers
(fortunately for me, ec -- my pet project -- would also be simple to
modify to support the 0x convention)

Please vote NO and save Erlang from the 0x convention.

Written and presented by Maurice Castro for the NO case.

More information about the erlang-questions mailing list