Why is D unpopular, redux.

Timon Gehr timon.gehr at gmx.ch
Wed May 25 00:03:55 UTC 2022


On 25.05.22 01:47, Walter Bright wrote:
> On 5/24/2022 3:55 PM, Timon Gehr wrote:
>> On 24.05.22 19:10, Walter Bright wrote:
>>> On 5/24/2022 12:45 AM, Timon Gehr wrote:
>>>> No. The correct behavior when a delegate literal outlives captured 
>>>> variables is to allocate a closure. This case is not an exception...
>>>
>>> But it isn't a safety problem, as it won't compile.
>>
>> Well, it's still a memory safety problem in @system code, it's just 
>> that it's not a soundness issue for @safe.
> ...

Sorry for the confusion, I had accepted your claim without examining 
your code example in detail as I was in a hurry this morning. You were 
just mistaken.

> The whole point of @system is to remove the safety checks.
> ...

@system still checks types, it just allows you to do some explicitly 
unsafe things such as type casts.

> I'm more interested in soundness

There is no soundness. Not in @system code. Not in @safe code.

> than in replicating closure semantics of other languages.
> Especially since the workarounds are simple:
> 
> Replace `int x` with `int* px = new int()`
> ...

Well, I don't think it's exactly this simple as that pointer will be 
captured by reference.

> I.e. one can always make a closure manually. It's not the end of the 
> world if the compiler doesn't provide a spoonful of sugar for it.
> 
> Don't get me wrong, I'm still interested in adopting good semantics from 
> other languages, it's just that soundness is much more of a priority.
> ...

Ok!

> I do enjoy and appreciate your contributions, too, even if it seems like 
> I'm always arguing with you :-/

Well, it's not my preference either, but I am fine with arguing if it's 
productive.

I have burned out a couple of times from engaging on the newsgroup 
though, because nothing got through to you. In this instance the problem 
seems to be that you are biased towards accepting immediately that stuff 
is actually not broken without examining closely enough what is going on.

Unfortunately, in such cases, arguing is taking away time and energy 
from both of us that could be spent trying to tackle those issues in a 
constructive way.


More information about the Digitalmars-d mailing list