AW: [erlang-questions] Preventing calling some functions

Thomas Lindgren thomasl_erlang@REDACTED
Fri Dec 11 19:28:45 CET 2009





----- Original Message ----
> - a "no side effect" mode of evaluation for the funs. Any bifs doing 
> sideeffects, spawn,
>   send, get, put would be disallowed. This mode would be nice for untrusted code 
> too...
>   (btw: list_to_atom would be disallowed, list_to_existing_atom could be 
> allowed)

Incidentally, disallowing visible side-effects (though mildly different from the above) could also serve as a cornerstone when implementing deep guards. I think this feature could be implemented under the hood by a bitmask, perhaps just a single bit. Set a bit in the mask when you're running a pure computation. Test the bit(s) before running a side-effect and throw an exception if purity was required. Save and restore the bitmask when entering/exiting such a scope.

Best,
Thomas


      


More information about the erlang-questions mailing list