summaryrefslogtreecommitdiff
path: root/lib/elixir/pages
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2018-03-03 00:37:10 +0100
committerJosé Valim <jose.valim@plataformatec.com.br>2018-03-03 00:37:12 +0100
commitdb017e7f18b35d69a2b4305efc0f002bb3675669 (patch)
tree87c3aaef83948b95761b7542289327d012e8ba5d /lib/elixir/pages
parentf0a7f19ff4023adf253d26edf1e817e303abb4c9 (diff)
downloadelixir-db017e7f18b35d69a2b4305efc0f002bb3675669.tar.gz
Improve documentation on string types
Diffstat (limited to 'lib/elixir/pages')
-rw-r--r--lib/elixir/pages/Typespecs.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/elixir/pages/Typespecs.md b/lib/elixir/pages/Typespecs.md
index 26813fe87..43c379756 100644
--- a/lib/elixir/pages/Typespecs.md
+++ b/lib/elixir/pages/Typespecs.md
@@ -238,8 +238,8 @@ If a callback module that implements a given behaviour doesn't export all the fu
Elixir's standard library contains a few frequently used behaviours such as `GenServer`, `Supervisor`, and `Application`.
-## Notes
+## The `string()` type
-Elixir discourages the use of type `t:string/0` as it might be confused with binaries which are referred to as "strings" in Elixir (as opposed to character lists). In order to use the type that is called `t:string/0` in Erlang, one has to use the `t:charlist/0` type which is a synonym for `string`. If you use `string`, you'll get a warning from the compiler.
+Elixir discourages the use of the `string()` type. The `string()` type refers to Erlang strings, which are known as "charlists" in Elixir. They do not refer to Elixir strings, which are UTF-8 encoded binaries. To avoid confusion, if you attempt to use the type `string()`, Elixir will emit a warning. You should use `charlist()`, `binary()` or `String.t()` accordingly.
-If you want to refer to the "string" type (the one operated on by functions in the `String` module), use `t:String.t/0` type instead.
+Note `String.t()` and `binary()` are equivalent to analysis tools. Although, for those reading the documentation, `String.t()` implies it is a UTF-8 encoded binary.