File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -949,14 +949,22 @@ defmodule List do
949
949
end
950
950
951
951
@ doc """
952
- Converts a charlist to an existing atom. Raises an `ArgumentError`
953
- if the atom does not exist.
952
+ Converts a charlist to an existing atom.
954
953
955
954
Elixir supports conversions from charlists which contains any Unicode
956
- code point.
955
+ code point. Raises an `ArgumentError` if the atom does not exist.
957
956
958
957
Inlined by the compiler.
959
958
959
+ > #### Atoms and modules {: .info}
960
+ >
961
+ > Since Elixir is a compiled language, the atoms defined in a module
962
+ > will only exist after said module is loaded, which typically happens
963
+ > whenever a function in the module is executed. Therefore, it is
964
+ > generally recommended to call `List.to_existing_atom/1` only to
965
+ > convert atoms defined within the module making the function call
966
+ > to `to_existing_atom/1`.
967
+
960
968
## Examples
961
969
962
970
iex> _ = :my_atom
Original file line number Diff line number Diff line change @@ -2569,9 +2569,19 @@ defmodule String do
2569
2569
Converts a string to an existing atom.
2570
2570
2571
2571
The maximum atom size is of 255 Unicode code points.
2572
+ Raises an `ArgumentError` if the atom does not exist.
2572
2573
2573
2574
Inlined by the compiler.
2574
2575
2576
+ > #### Atoms and modules {: .info}
2577
+ >
2578
+ > Since Elixir is a compiled language, the atoms defined in a module
2579
+ > will only exist after said module is loaded, which typically happens
2580
+ > whenever a function in the module is executed. Therefore, it is
2581
+ > generally recommended to call `String.to_existing_atom/1` only to
2582
+ > convert atoms defined within the module making the function call
2583
+ > to `to_existing_atom/1`.
2584
+
2575
2585
## Examples
2576
2586
2577
2587
iex> _ = :my_atom
You can’t perform that action at this time.
0 commit comments