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

Björn Gustavsson bjorn@REDACTED
Thu Oct 8 13:34:33 CEST 2015


On Wed, Oct 7, 2015 at 10:09 AM, Kostis Sagonas <kostis@REDACTED> wrote:
> 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?

That seems reasonable.

I will change erlang:builtin(erlang, apply, 3) to return 'true'. I will
do the change in the master branch.

/Bjorn

>
> 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.
>



-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list