removal of cruft from D

Justin Johansson no at spam.com
Fri Nov 20 17:22:33 PST 2009


Andrei Alexandrescu Wrote:

> Ellery Newcomer wrote:
> > Nick Sabalausky wrote:
> >> 2. Octal literals! I think it'd be great to have a new octal syntax, or even 
> >> better, a general any-positive-inter-base syntax. But until that finally 
> >> happens, I don't want "010 == 8" preserved. And I don't think the ability to 
> >> have an octal literal is important enough that lacking it for a while is a 
> >> problem. And if porting-from-C really has to be an issue, then just make 
> >> 0[0-9_]+ an error for a transitionary period (or forever - it'd at least be 
> >> better than maintaining "010 == 8").
> >>
> >> 3. Also the comma operator, but that's already been recently discussed.
> > <bikeshed>
> > 
> > hex literal prefix: 0x, not 0h
> > =>
> > octal literal prefix: 0c, not 0o
> > 
> > </bikeshed>
> 
> This I'm on board with. 0o is too much like a practical joke.

Okay let's go for some consistency then.

First try. Radix character comes from 3rd character of radix name.

hexadecimal   0x
octal             0t
binary           0n

Or, second try, how about first non-digit-looking character in radix name?

hexadecimal   0h
octal             0c
binary           0b

My point being ... if there were to be a change in lexical form, a simple rule would be nice.  Of course the rule can be anything that can be coerced to a rule.  Hope this doesn't sound like a false choice :-)

--Justin




More information about the Digitalmars-d mailing list