Things that may be removed

Yigal Chripun yigal100 at gmail.com
Tue Dec 23 23:04:55 PST 2008


Nick Sabalausky wrote:
> "Don"<nospam at nospam.com>  wrote in message
> news:gio27n$2o0f$1 at digitalmars.com...
>> bearophile wrote:
>>> There are some things I'd like to see added to the D language, but what
>>> things can be removed from it?
>>>
>> * C-style declarations
>
> I certainly wouldn't mind seeing these go. But then, I haven't tried to port
> much C/C++ code to D.
>
>> * \n, \r as a string (free up the backslash character)
>> * #line (make it a pragma instead)
>
> Agreed.
>
>> * Octal (it's not 1952 any more)
>
> Disagree. Octal can often useful on low-level embedded stuff. Heck, I've
> worked on a recent microcontroller where even base-4 was extremely handy. If
> anything, I'd recommend adding base-4 to D, and certainly not removing
> octal.
>

If I decided to develop my own custom micro-controller as well, only 
mine uses base [put random number here] or what ever other valid reason 
I have for working with numbers in some base, should I ask for that base 
to be added to the language as well?
A more general solution is to allow arbitrary base representations. don 
suggested toBase!(base)(number) or something similar. adding syntax 
sugar for that is better IMO than just adding base 4.
here's a first attempt:
<number>B<base>. so 01010101B2 is a binary number. compiler will check 
that the digits are in the proper range, so 123B2 is a compile-time 
error.To represent the digits we can use English letters as in Hex or 
have another syntax form like 123#112#323#334B1000



>> * the comma operator (allow in selected places, eg for(; ;++a, ++b)).
>> * Object.toString(). Encourages bad design. It's not powerful enough to be
>> useful.
>
> What is the problem with these?
>
>> * The postincrement and postdecrement operators (make x++, x-- identical
>> to ++x, --x, except that it is illegal to use the return value. Allowing
>> operator overloading of the postfix operators was a silly hack in C++.
>> It's a freedom nobody wants).
>
> I'm certainly not a fan of post??crement. They lead to confusing
> code/results. Plus, I don't know if this is still relevent, but back when I
> was using C++, doing "foo++;" instead of "++foo;" on a non-primitive was
> considered bad because (IIRC) it created a useless temp copy (or something
> like that). Granted, I'd much rather type "x++" than "++x", but the behavior
> of post??crement is something I could certainly do without.
>
>




More information about the Digitalmars-d mailing list