Want reasonable reference counting? Disable automatic sharing of immutable

Elronnd elronnd at elronnd.net
Sun Nov 14 09:19:24 UTC 2021


On Sunday, 14 November 2021 at 08:29:33 UTC, Ola Fosheim Grøstad 
wrote:
> Thus pure functions are allowed to conduct I/O, albeit a 
> primitive one.
>
> Note that a pure function also can prevent destruction merely 
> by computing an integer that is aliasing an address of an 
> object that is up for destruction. Again, primitive I/O. So 
> clearly a side effect.

And a pure function can also conduct I/O by constructing a null 
pointer (or being passed one) and dereferencing it; and then 
doing the work in the SIGSEGV handler.

I don't think this makes pure functions less interesting or 
meaningful from a practical standpoint.


More information about the Digitalmars-d mailing list