diff options
author | Björn Gustavsson <[email protected]> | 2019-02-20 14:43:41 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-02-20 15:13:32 +0100 |
commit | 02de9d7de92298e807a0eef4816b36eab825e63a (patch) | |
tree | ef8fae7d1b271e874313ed35c055a8282fa251bc /lib/compiler | |
parent | 4d93f72435ae28c488499b99d37c3db9d4181056 (diff) | |
download | otp-02de9d7de92298e807a0eef4816b36eab825e63a.tar.gz otp-02de9d7de92298e807a0eef4816b36eab825e63a.tar.bz2 otp-02de9d7de92298e807a0eef4816b36eab825e63a.zip |
erl_bifs: Add a note to the comment for is_pure/3
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/erl_bifs.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/compiler/src/erl_bifs.erl b/lib/compiler/src/erl_bifs.erl index d925decce6..94a5dfe012 100644 --- a/lib/compiler/src/erl_bifs.erl +++ b/lib/compiler/src/erl_bifs.erl @@ -32,6 +32,22 @@ %% Returns `true' if the function `Module:Name/Arity' does not %% affect the state, nor depend on the state, although its %% evaluation is not guaranteed to complete normally for all input. +%% +%% NOTE: There is no need to include every new pure BIF +%% here. Including it here means that the value of the function +%% will be evaluated at compile-time if the arguments are +%% constant. If that optimization is not useful/desired, there is +%% no need to include the new BIF here. +%% +%% Functions whose return value could conceivably change in a +%% future version of the runtime system must NOT be included here. +%% +%% Here are some example of functions that should not be +%% included: `term_to_binary/1', hashing functions, non-trivial +%% encode/decode functions. +%% +%% When unsure whether a new BIF should be included here, the +%% conservative safe choice is NOT to include it. -spec is_pure(atom(), atom(), arity()) -> boolean(). |