[erlang-questions] Illegal Guard?

Richard A. O'Keefe ok@REDACTED
Thu Feb 11 08:01:55 CET 2016

On 11/02/16 7:39 pm, Unix One wrote:
> On 02/08/2016 05:18 PM, Richard A. O'Keefe wrote:
>> Note also, as the paper linked above certainly does,
>> that hot-loading means that you can never be certain
>> that a function from another module will be pure when
>> you call it.
> Please excuse my ignorance, but wouldn't this specific point potentially
> not be an issue if:
> - guards required functions to be explicitly declared pure
> - compiler verified the assertion of purity
> - hot code loader refused to load if a guard function wasn't declared pure
> Maybe the declaration of purity is not necessarily required, but it does
> make it more explicit.
I believe I mentioned that purity is not sufficient.
f(X) -> f(X).
is pure.  But it is not bounded, and boundedness is of practical importance.

We *could* have declarations like that.  Currently we don't.
There are some technical problems which could probably be resolved.
One of them is "what does it mean to call a function pure if it is being

Actually, the simplest thing would be to adopt abstract patterns, which
are *necessarily* pure and bounded, so there is nothing extra to 

There have been programming languages with 'effects' as part of their
type system.  To a degree, Mercury and Clean do that now.  Erlang has a
type system now, which it didn't before.  Maybe in another decade it will
have a type+effects system.

More information about the erlang-questions mailing list