[erlang-questions] Help: What's the correct way to add new BIFs?

G Bulmer gbulmer@REDACTED
Mon Mar 10 15:04:10 CET 2008


Bjorn

Thank you for the help.
I will put guard BIFs on hold :-)

GB

> G Bulmerwrites:
>>> You should use bif; ubifs are only for guard BIFs.
>> Thank you. That clears that up.
>>
>> I would like to make the two predicates (is_dtrace_on/0 and
>> is_dtrace_off/0 ) available in guard expressions.
>> I have them in bif.tab as:
>>   ubif erlang:is_dtrace_on/0
>>   ubif erlang:is_dtrace_off/0
>>
>
> Creating a new guard BIF is a lot harder than creating an ordinary  
> BIF,
> so I suggest you'll wait with doing that.
>
> The reason for the difficulties is that guard BIFs are specially  
> optimized and
> each BIF that can be used in guard must have corresponding BEAM  
> instructions;
> the new instructions must be supported in both the compiler and the  
> emulator.
That sounds non-trivial !-)
I'll skip that for now.

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




More information about the erlang-questions mailing list