If you could make any changes to D, what would they look like?
Patrick Schluter
Patrick.Schluter at bbox.fr
Thu Oct 28 19:46:32 UTC 2021
On Thursday, 28 October 2021 at 15:18:54 UTC, Dukc wrote:
> On Thursday, 28 October 2021 at 10:53:25 UTC, Dennis wrote:
>> On Wednesday, 27 October 2021 at 19:53:52 UTC, H. S. Teoh
>> wrote:
>>> [...]
>>
>> The function needs to be `nothrow` and compiled with `-O
>> -release`, because dmd needs to account for exceptions /
>> errors, and even then the optimization [shouldn't really be
>> done](https://issues.dlang.org/show_bug.cgi?id=22277). LDC
>> doesn't do anything with `pure` for optimizations, but since
>> it has cross module inlining, it doesn't need it.
>
> I think that, in addition to bugs, there is one hurdle in
> letting the compiler to fully optimise based on `pure`: how do
> we implement a function that manually frees an array? If the
> signature is
> ```d
> pure nothrow @nogc void free(int[])
> ```
Not at all. free cannot, by its semantic, be pure (same for
malloc). Trying to make free pure is a silly challenge.
More information about the Digitalmars-d
mailing list