Stroustrup objects to adding Contracts to C++
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Wed Nov 11 13:23:23 UTC 2026
On 12/11/2026 2:09 AM, Paolo Invernizzi wrote:
> On Wednesday, 11 November 2026 at 12:37:58 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> On 11/11/2026 10:29 PM, Paolo Invernizzi wrote:
>>> On Wednesday, 11 November 2026 at 01:12:03 UTC, Richard (Rikki)
>>> Andrew Cattermole wrote:
>>>> On 11/11/2026 12:04 PM, Walter Bright wrote:
>>>>> On 11/10/2026 2:06 PM, monkyyy wrote:
>>>>>> There are huge gaps in my knowledge of the parts of d I will never
>>>>>> touch and I feel like Im the near the only person who understands
>>>>>> the behavior of some edge case of template magic
>>>>>>
>>>>>> throwing stones in glass houses?
>>>>>
>>>>> I hear you. There are many features in D that have turned out to be
>>>>> not very useful. They need to be discarded, which is why we are
>>>>> doing editions.
>>>>>
>>>>> A language with a small number of powerful features is better than
>>>>> having a large number of weak features.
>>>>
>>>> I.e. @nogc pure
>>>
>>> @nogc is actually used in our codebase, it's not a weak feature.
>>>
>>> /P
>>
>> I can always tell when people don't read and understand my posts ;)
>>
>> Effects analysis in dmd is DOA in the type system.
>>
>> It cannot do it correctly.
>>
>> Walter screwed up designing the architecture for dmd's semantic
>> analysis when he designed it to be fast and not for analysis
>> capabilities.
>>
>> See: attribute soup. Without inference working correctly, this problem
>> cannot be fixed, and we can't fix it.
>
> Fair enough, I was answering about the feature, not about how dmd
> implements it.
Unfortunately when evaluating a feature, we have to consider if it can
work correctly.
> What we rely on is the guarantee, a compile-time check that a hot path
> does not allocate. We live with the attribute soup for that, also
> because Claude takes care of that.
>
> What gives us the same guarantee in an edition without @nogc?
>
> /P
There are two ways to solve this that I know of, and that is with
function local only check, @localnogc. Which isn't implemented.
That'll cover your accidental closure context creation and all the other
kinds of GC uses.
Personally I'd be ok with a lint that produces a warning, turned on with
a core.attribute attribute, but I know others may not like this design.
https://forum.dlang.org/thread/tcfqveygmebplsgmexgr@forum.dlang.org
More information about the Digitalmars-d
mailing list