Skip to content

Commit 2583b1d

Browse files
eksperimentaljosevalim
authored andcommitted
Extended documentation for sigils (#7861)
[ci skip]
1 parent 7d18f74 commit 2583b1d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,7 +4900,7 @@ defmodule Kernel do
49004900
## Sigils
49014901

49024902
@doc ~S"""
4903-
Handles the sigil `~S`.
4903+
Handles the sigil `~S` for strings.
49044904
49054905
It simply returns a string without escaping characters and without
49064906
interpolations.
@@ -4918,7 +4918,7 @@ defmodule Kernel do
49184918
defmacro sigil_S({:<<>>, _, [binary]}, []) when is_binary(binary), do: binary
49194919

49204920
@doc ~S"""
4921-
Handles the sigil `~s`.
4921+
Handles the sigil `~s` for strings.
49224922
49234923
It returns a string as if it was a double quoted string, unescaping characters
49244924
and replacing interpolations.
@@ -4946,7 +4946,7 @@ defmodule Kernel do
49464946
end
49474947

49484948
@doc ~S"""
4949-
Handles the sigil `~C`.
4949+
Handles the sigil `~C` for charlists.
49504950
49514951
It simply returns a charlist without escaping characters and without
49524952
interpolations.
@@ -4967,7 +4967,7 @@ defmodule Kernel do
49674967
end
49684968

49694969
@doc ~S"""
4970-
Handles the sigil `~c`.
4970+
Handles the sigil `~c` for charlists.
49714971
49724972
It returns a charlist as if it were a single quoted string, unescaping
49734973
characters and replacing interpolations.
@@ -4998,12 +4998,12 @@ defmodule Kernel do
49984998
end
49994999

50005000
@doc """
5001-
Handles the sigil `~r`.
5001+
Handles the sigil `~r` for regular expressions.
50025002
50035003
It returns a regular expression pattern, unescaping characters and replacing
50045004
interpolations.
50055005
5006-
More information on regexes can be found in the `Regex` module.
5006+
More information on regular expressions can be found in the `Regex` module.
50075007
50085008
## Examples
50095009
@@ -5028,7 +5028,7 @@ defmodule Kernel do
50285028
end
50295029

50305030
@doc ~S"""
5031-
Handles the sigil `~R`.
5031+
Handles the sigil `~R` for regular expressions.
50325032
50335033
It returns a regular expression pattern without escaping
50345034
nor interpreting interpolations.
@@ -5054,6 +5054,8 @@ defmodule Kernel do
50545054
The lower case `~d` variant does not exist as interpolation
50555055
and escape characters are not useful for date sigils.
50565056
5057+
More information on dates can be found in the `Date` module.
5058+
50575059
## Examples
50585060
50595061
iex> ~D[2015-01-13]
@@ -5072,6 +5074,8 @@ defmodule Kernel do
50725074
The lower case `~t` variant does not exist as interpolation
50735075
and escape characters are not useful for time sigils.
50745076
5077+
More information on times can be found in the `Time` module.
5078+
50755079
## Examples
50765080
50775081
iex> ~T[13:00:07]
@@ -5092,6 +5096,8 @@ defmodule Kernel do
50925096
The lower case `~n` variant does not exist as interpolation
50935097
and escape characters are not useful for datetime sigils.
50945098
5099+
More information on naive date times can be found in the `NaiveDateTime` module.
5100+
50955101
## Examples
50965102
50975103
iex> ~N[2015-01-13 13:00:07]
@@ -5107,7 +5113,7 @@ defmodule Kernel do
51075113
end
51085114

51095115
@doc ~S"""
5110-
Handles the sigil `~w`.
5116+
Handles the sigil `~w` for list of words.
51115117
51125118
It returns a list of "words" split by whitespace. Character unescaping and
51135119
interpolation happens for each word.
@@ -5145,7 +5151,7 @@ defmodule Kernel do
51455151
end
51465152

51475153
@doc ~S"""
5148-
Handles the sigil `~W`.
5154+
Handles the sigil `~W` for list of words.
51495155
51505156
It returns a list of "words" split by whitespace without escaping nor
51515157
interpreting interpolations.

0 commit comments

Comments
 (0)