D as A Better C?
Justin Whear
justin at economicmodeling.com
Tue Feb 11 14:56:52 PST 2014
On Tue, 11 Feb 2014 22:19:12 +0000, Gary Willoughby wrote:
> On Tuesday, 11 February 2014 at 19:43:00 UTC, Walter Bright wrote:
>> I've toyed with this idea for a while, and wondered what the interest
>> there is in something like this.
>>
>> The idea is to be able to use a subset of D that does not require any
>> of druntime or phobos - it can be linked merely with the C standard
>> library. To that end, there'd be a compiler switch (-betterC) which
>> would enforce the subset.
>>
>> (First off, I hate the name "better C", any suggestions?)
>>
>> The subset would disallow use of any features that rely on:
>>
>> 1. moduleinfo 2. exception handling 3. gc 4. Object
>>
>> I've used such a subset before when bringing D up on a new platform, as
>> the new platform didn't have a working phobos.
>>
>> What do you think?
>
> What will this language's niche be? What job is it targeted at? Why
> would somebody use better C rather than just plain C?
Here are the reasons I use D even when writing very C-style code:
- Symbolic imports
- Static asserts, conditional compilation, etc. that doesn't depend on a
macro language which I've never been entirely comfortable with.
- Templates. Also, templates. Seriously, templates.
- Sane type names (I'm biased on this, but I don't like "unsigned long
long" or the fact the '*' binds to the right.
- Array types which carry length.
- I also like to use exceptions, which I understand would not be
supported by this proposal.
More information about the Digitalmars-d
mailing list