D as A Better C?

Adam Wilson flyboynw at gmail.com
Tue Feb 11 15:28:14 PST 2014


On Tue, 11 Feb 2014 15:25:23 -0800, Xavier Bigand  
<flamaros.xavier at gmail.com> wrote:

> Le 12/02/2014 00:12, Adam Wilson a écrit :
>> On Tue, 11 Feb 2014 15:10:13 -0800, Xavier Bigand
>> <flamaros.xavier at gmail.com> wrote:
>>
>>> Le 11/02/2014 20:43, Walter Bright a écrit :
>>>> 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?
>>>
>>> If I correctly understand class will stay usable?
>>> So IMO it's just like if you said : "I want do a fork of D2 without
>>> GC". If you are going to this way some people will certainly fork this
>>> D2-BetterC version and add it a new standard library more like QtCore.
>>>
>>> In this case why not simply improve the D modularity and put features
>>> you want remove as options? The main issue is about how phobos have to
>>> manage memory, with or without GC, maybe both?
>>>
>>> If you want go to the modularity, it's really nice, but maybe it will
>>> simpler to remove only GC and reboot phobos. Maybe it can help D
>>> contributors to be focused on system aspects of language instead of
>>> full-featured that can be reached only with a big community or
>>> commercial patterns.
>>>
>>
>> Classes rely on Object. It's better C, not C++. You'll still have  
>> structs.
>>
> Object isn't only for runtime type info and others basics properties of  
> classes?

IIRC every class, if it inherits from nothing else, inherits from Object.  
The compiler expects Object on all classes. Beyond that I can't speak to  
how dependent the compiler is on the inheritance to make classes work.

-- 
Adam Wilson
GitHub/IRC: LightBender
Aurora Project Coordinator


More information about the Digitalmars-d mailing list