memory management and the standard library

JN 666total at wp.pl
Thu Mar 14 21:32:21 UTC 2019


On Thursday, 14 March 2019 at 10:02:20 UTC, Paolo Invernizzi 
wrote:
> On Thursday, 14 March 2019 at 09:25:47 UTC, Seb wrote:
>> On Wednesday, 13 March 2019 at 19:22:37 UTC, Francesco Mecca 
>> wrote:
>>> On Wednesday, 13 March 2019 at 17:50:57 UTC, Seb wrote:
>>>> [...]
>>>> Though Phobos has been declared "stable" these days, which 
>>>> means that breaking changes can't be done anymore and if 
>>>> you're looking for sth. modern and nice, dub is the place 
>>>> these days.
>>>> I wonder if we ever get to the point where we can replace 
>>>> Phobos with a modern standard library...
>>>
>>> https://github.com/wilzbach/hellas
>>> Do you have any plans for this?
>>
>> Yes, I do (if I ever get time to get it).
>> The rough outline is here:
>>
>> https://github.com/wilzbach/dts/issues
>>
>> The rough vision of dts is to remove the ugly bits of Phobos 
>> that we can't remove or change and make the design/structure 
>> more fitting.
>> However, there are a few limiting language/runtime issues like 
>> D strings being used for exceptions etc.
>>
>> Anyhow, I should probably point out that Jonathan is pushing a 
>> more radical approach with Dragon:
>>
>> https://github.com/dragon-lang
>>
>> The main vision of Dragon is to do the radical D3 changes that 
>> would never be accepted in mainline dmd, see e.g.
>>
>> https://github.com/dragon-lang/dc/issues/43
>
> That's interesting!
>
> It is no secret that I am strongly in favor of the evolution of 
> the library / language even with radical changes. And this 
> implies that I am in favor of D3 + an evolution of Phobos.
>
> Sociomantic has its own library, the same Weka, I would like a 
> commercial effort to support and define D3 + Phobos.
>
> Something similar to a common organized work group, very very 
> pragmatic. If this thing were feasible, my company would be 
> interested in contributing.
>
> - Paolo

To be frank, even though I'd love the idea of D3, I don't think 
it's just a matter of Phobos. Phobos is a victim of the 
underlying ideology of D, which is both it's blessing and a 
curse. That ideology is the idea that all paradigms are equal and 
every usecase should be supported. In languages like Java/C#, if 
someone asks how to do manual memory management, the answer is 
either "you can't" or "interop with C". In D, the answer is "oh, 
you can totally do that, just this won't work, and this is 
needed, and this will probably not compile, oh and no one tested 
that". It adds a lot of cognitive overhead, and unfortunately 
there are many points of division like that. @nogc/RC, GC, add to 
that -betterC too. Which one would a "new" Phobos support? I 
don't think you can support them all. You'd have to go for the 
lowest common denominator, which is @nogc, but if stdlib doesn't 
require a GC, what is the point of a GC at all. Especially since 
GC is an issue when porting D to Webassembly (need to use 
-betterC for that right now). I think if D3 was to be successful, 
it'd have to be a bit more opinionated. I don't mean the language 
has to become a OOP behemoth (I'd love that though haha) or a 
functional monadic transformer combinator, but it'd be nice to 
better define a scope of the language and be able to answer a 
question "Can D do XYZ?" with "No, it's not useful and you 
shouldn't do it this way".

Also, some language features seem dubious or hardly used at all. 
Does anyone really use contracts? I know they're sweet and Eiffel 
and everything, but does anyone ACTUALLY use them and doesn't 
stick to good old asserts? Perhaps rather than implementing (and 
supporting! each feature has to work well with other features 
which adds support overhead) such features, it'd be more useful 
to add features like struct initialization outside of 
assginments, which feels to me like a much nicer improvement to 
the language.


More information about the Digitalmars-d mailing list