Store mutable indirections in immutable data with this one weird trick!
    Dukc 
    ajieskola at gmail.com
       
    Sat Nov 13 10:45:49 UTC 2021
    
    
  
On Saturday, 13 November 2021 at 06:50:48 UTC, Paul Backus wrote:
> What do you think? Is it just crazy enough to work, or just 
> plain crazy? Is there some fatal safety violation I've 
> overlooked? Let me know in your replies!
Unless I miss something else, this is otherwise a good idea, BUT: 
The `ptr()` function _must not be pure_.
Why? If you're casting an integer to a pointer, you're 
essentially opening yourself access to global state. The user 
code can still dereference `TailUnqual` in impure code and fetch 
the address again for a normal pointer to use in `pure` code.
Smaller nitpic, I'd also prefer `opUnary(string op)()(if op == 
"*")` to `alias this`.
    
    
More information about the Digitalmars-d
mailing list