[erlang-questions] -protocol declartion idea, worth an EEP?
Richard A. O'Keefe
Tue Jun 6 05:37:43 CEST 2017
> On 6/06/2017, at 1:55 PM, Michael Truog <mjtruog@REDACTED> wrote:
> It would be nice to have finer granularity than just 'pure' or 'impure', though it seems
> very easy to make this purity concept complex enough that people don't use it.
Fair comment. I guess my point is not clear. Here it is explicitly:
if someone calls an Erlang function "pure", I don't know what they mean.
As a specific example, I don't know whether
X = f(A), g(), Y = f(A)
guarantees that X =:= Y.
Why might it not? Because while f/1 might not *change* anything,
it might *read* mutable data which g/0 might change.
> I would assume most analysis of normal source code wouldn't be able to say
> anything too useful about termination (due to normal complexity), but I don't
> know much about this.
The Mercury people added termination analysis to their compiler
and were able to automatically show termination for about 70% of
the procedures they checked. That relied on mode and type analysis,
but Erlang doesn't have modes.
The one difference in Erlang of course is that people deliberately
write functions (the dispatch loops of processes) which aren't
*meant* to terminate (except when told to by a message).
[would be nice to have dialyzer always part of compilation]
[simple purity hierarchy]
[simple type system desirable]
as long as it does the job, agreed. The first requirement of any
type system is that programmers should understand it well enough
to use it effectively.
More information about the erlang-questions