D on quora ...

Walter Bright newshound2 at digitalmars.com
Sat Oct 7 23:44:43 UTC 2017


On 10/7/2017 1:36 PM, Laeeth Isharc wrote:
> Would it make sense to have a BetterC version define for Phobos? Or is this a 
> terrible idea?  So you could still use some subset of Phobos from BetterC mode, 
> and maybe this subset could be expanded over time?  And maybe people would write 
> a complimentary set of functions to cover the missing most useful things in a 
> way that doesn't depend on the runtime?

It does make sense in general for library functions to be less dependent on 
linking to the rest of the library. For example, I discovered recently that 
core.stdc.stdio and core.stdc.errno relied on linking in druntime, making them 
unusable for BetterC.

Fortunately, I found a way to remove those dependencies without any compromises. 
Of course, this won't always be possible, but it is worth thinking about when 
designing Phobos code.

(One way to do this is to use more templates, as the templates will get 
instantiated into the user program rather than needing to be linked in from Phobos.)


More information about the Digitalmars-d mailing list