Does D have too many features?

foobar foo at bar.com
Tue May 8 10:38:04 PDT 2012


On Tuesday, 8 May 2012 at 17:24:24 UTC, foobar wrote:
> On Tuesday, 8 May 2012 at 17:03:10 UTC, Lars T. Kyllingstad 
> wrote:
>> On Tuesday, 8 May 2012 at 16:35:05 UTC, foobar wrote:
>>> On Tuesday, 8 May 2012 at 14:59:43 UTC, Lars T. Kyllingstad 
>>> wrote:
>>>> On Tuesday, 8 May 2012 at 14:48:27 UTC, foobar wrote:
>>>>> [...], what if I find it useful to use e.g. FORTRAN code, 
>>>>> should the relevant functions also be in the stdlib?
>>>>
>>>> No, FORTRAN has absolutely nothing to do with D.  C, on the 
>>>> other hand, does.  Both druntime and Phobos depend heavily 
>>>> on the C stdlib.  The GC uses malloc/free, std.stdio.File is 
>>>> a wrapper around FILE*, etc.
>>>>
>>>> -Lars
>>>
>>> Irrelevant. For all I care druntime could be implemented in 
>>> Klingon. That doesn't mean its API needs to include Klingon 
>>> as well. That's called "encapsulation".
>>
>> Um... so you don't mind the C/POSIX declarations being there, 
>> you just want them to be private so you aren't tempted to use 
>> them in your own code?
>>
>> -Lars
>
> Yes, pretty much.
> They are an implementation detail of druntime/phobos.
>
> Other vendors may choose to implement the tool-chain with 
> another language in mind and as long as the API remains the 
> same I shouldn't need to care e.g. how the GC allocation is 
> implemented (Perhaps it's done with FORTRAN's memory allocation 
> routines).
>
> If I ,the user, want to interface with C I need to use the 
> "official" C headers in Deimos. This is after all the official 
> location for that.

BTW, it makes sense even if druntime is implemented with C/POSIX 
- it decouples the user-facing headers from those used by the 
runtime. the runtime could depend on an older stable version than 
the one exposed to the users.

I assume druntime/phobos uses some windows APIs in their 
implementations. Now consider the new winRT API for windows. It 
should be a matter of updating the headers in a separate 
repository so that it would be exposed to end-users without 
waiting on a druntime update to utilize those APIs.


More information about the Digitalmars-d mailing list