LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0575-erl_bifs-Add-a-note-to-the-comment-for-is_pure-3.patch of Package erlang (Project home:Ledest:erlang:20)

From 02de9d7de92298e807a0eef4816b36eab825e63a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 20 Feb 2019 14:43:41 +0100
Subject: [PATCH 6/6] erl_bifs: Add a note to the comment for is_pure/3

 lib/compiler/src/erl_bifs.erl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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