You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today it is possible to inline functions declared as NIFs but the behaviour may not be intuitive:
-module(foo).
-compile(export_all).
-compile({inline, bar/0}).
-nifs([bar/0]).
bar() ->erlang:nif_error(oops).
baz() ->bar(),
ok.
In the following code, even if a NIF is loaded for bar(), baz() will inline erlang:nif_error(oops). One could argue the behaviour is obvious. Others could argue it is surprising. Should we warn about it?
Describe the bug
Today it is possible to inline functions declared as NIFs but the behaviour may not be intuitive:
In the following code, even if a NIF is loaded for
bar()
,baz()
will inlineerlang:nif_error(oops)
. One could argue the behaviour is obvious. Others could argue it is surprising. Should we warn about it?A similar problem exists with
-compile(inline)
:In this case, although a inlining happens, a warning is also emitted:
Given the
-nifs
attribute exists, this could probably be improved to inline all functions, except the ones listed on NIFs.I am not sure if any of these behaviours are desired, so feel free to close this. Happy holidays! 🎄 🍾
Affected versions
As far as I know all of them, but especially after OTP 25, since that's when
-nifs
was added.The text was updated successfully, but these errors were encountered: