[erlang-questions] Overriding built-in functions in a module

Richard O'Keefe <>
Fri Jun 11 01:16:41 CEST 2010


On Jun 9, 2010, at 5:42 PM, Igor Ribeiro Sucupira wrote:
>
> What I see here is that the function bar/1 will never be executed and
> will never be called (consider code execution), but its value is used
> in code that can be executed and that's something that I call "usage".

I was a little surprised to find that the compiler does not
optimise is_function(fun...) to 'true'.  I would have expected all
type tests to be partially evaluated by the compiler; it's an easy
optimisation, and while it's not expected to matter for human-written
code, that kind of optimisation can be important for machine-generated
code.

> So maybe this is one of the main sources of disagreement in this
> thread: the strength one thinks there is in the relation between
> "reachable code" and the concept of "usage".


It's not a question of "strength", it's a question of two logically
independent concepts, and of the error message using words that
strongly suggest the wrong one of the pair.



More information about the erlang-questions mailing list