[erlang-bugs] erlang:is_builtin(erlang,apply,3) = false

Kostis Sagonas kostis@REDACTED
Wed Oct 7 10:09:06 CEST 2015


On 10/07/2015 08:20 AM, Björn Gustavsson wrote:
> On Wed, Apr 9, 2014 at 7:06 PM, Stavros Aronis<aronisstav@REDACTED>  wrote:
>> >Hello!
>> >
>> >Title says everything. Is this intentional?
>> >
>> >1> erlang:is_builtin(erlang,apply,3).
>> >false
>> >
> May not be intentional, but erlang:apply/3 is a strange
> creature which is not implemented in the same way
> as all other BIFs. Part of apply/3 is in implemented
> in erlang.erl:
>
> apply(Mod, Name, Args) ->
>      erlang:apply(Mod, Name, Args).
>
> (This Erlang code will be called if you apply apply/3.)
>
> What do you think? Should erlang:is_builtin(erlang, apply, 3)
> return true? If so, why?

Unless I fail to see the point, to me this code is sufficient proof 
alone that erlang:apply/3 is a BIF, i.e., a built-in of the language 
that is not/cannot not be defined using some other construct of the 
language.  What does the call in the body of the clause call if not the 
erlang:apply/3 BIF?  (*)

Kostis

(*) Surely not the head of the clause, because then this code would have 
no semantics as Erlang code and a compiler/code transformation program 
would be allowed to change a call to erlang:apply/3 with a call to e.g. 
the loop() -> loop(). function.




More information about the erlang-bugs mailing list