Skip to content

Commit 24da600

Browse files
author
José Valim
committed
Document inlined functions are BIFs
1 parent b659ecf commit 24da600

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ defmodule Kernel do
2020
2121
Some of the functions described in this module are inlined by
2222
the Elixir compiler into their Erlang counterparts in the `:erlang`
23-
module. You can usually see this in effect when capturing the
24-
function:
23+
module. Those functions are called BIFs (builtin internal functions)
24+
in Erlang-land and they exhibit interesting properties, as some of
25+
them are allowed in guards and others are used for compiler
26+
optimizations.
27+
28+
Most of the inlined functions can be seen in effect when capturing
29+
the function:
2530
2631
iex> &Kernel.is_atom/1
2732
&:erlang.is_atom/1

lib/elixir/lib/node.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ defmodule Node do
33
Functions related to VM nodes.
44
55
Some of the functions in this module are inlined by the compiler,
6-
similar to functions in the `Kernel` module. When such happens,
7-
they are explicitly tagged as so.
6+
similar to functions in the `Kernel` module and they are explicitly
7+
marked in their docs as "inlined by the compiler". For more information
8+
about inlined functions, check out the `Kernel` module.
89
"""
910

1011
@type t :: atom

lib/elixir/lib/process.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ defmodule Process do
33
Conveniences for working with processes and the process dictionary.
44
55
Some of the functions in this module are inlined by the compiler,
6-
similar to functions in the `Kernel` module. When such happens,
7-
they are explicitly tagged as so.
6+
similar to functions in the `Kernel` module and they are explicitly
7+
marked in their docs as "inlined by the compiler". For more information
8+
about inlined functions, check out the `Kernel` module.
89
"""
910

1011
@doc """

lib/elixir/src/elixir_dispatch.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ default_functions() ->
2020
default_macros() ->
2121
[ { ?kernel, elixir_imported_macros() } ].
2222
default_requires() ->
23-
[ 'Elixir.Integer', 'Elixir.Kernel', 'Elixir.Kernel.Typespec', 'Elixir.Record' ].
23+
[ 'Elixir.Kernel', 'Elixir.Kernel.Typespec', 'Elixir.Record' ].
2424

2525
find_import(Meta, Name, Arity, E) ->
2626
Tuple = { Name, Arity },

lib/elixir/test/elixir/integer_test.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ Code.require_file "test_helper.exs", __DIR__
22

33
defmodule IntegerTest do
44
use ExUnit.Case, async: true
5+
require Integer
56

67
test :odd? do
8+
assert Integer.odd?(0) == false
79
assert Integer.odd?(1) == true
810
assert Integer.odd?(2) == false
911
assert Integer.odd?(3) == true
@@ -13,6 +15,7 @@ defmodule IntegerTest do
1315
end
1416

1517
test :even? do
18+
assert Integer.even?(0) == true
1619
assert Integer.even?(1) == false
1720
assert Integer.even?(2) == true
1821
assert Integer.even?(3) == false

0 commit comments

Comments
 (0)