If you could make any changes to D, what would they look like?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sat Oct 30 10:34:48 UTC 2021
On Friday, 29 October 2021 at 21:56:10 UTC, Adam Ruppe wrote:
> On Friday, 29 October 2021 at 21:16:49 UTC, H. S. Teoh wrote:
>> Long story short, pureFree makes no sense
>
> What about:
>
> void foo() pure {
> int* a = malloc(5);
> scope(exit) free(a);
> }
>
>
> How is that any different than
>
> void foo() pure {
> int[5] a;
> }
>
> ?
That depends on how malloc and free are implemented... If malloc
involves locking
or system calls (which is difficult to avoid) then the
difference is that it cannot be used in real time or other low
level code where neither locking or system calls can be used.
The problem here is having a useful definition for pure. What is
the purpose for "pure"? With no clear purpose it becomes rather
difficult to pinpoint what the boundary ought to be.
More information about the Digitalmars-d
mailing list