Skip to content

Commit 403c85c

Browse files
committed
Merge pull request #4129 from alco/alco/iex-info-improvements
Pedantic improvements to the output of the i/1 helper in IEx.
2 parents 65ec108 + f81489a commit 403c85c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

lib/iex/lib/iex/info.ex

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ defimpl IEx.Info, for: List do
8787

8888
defp info_char_list(char_list) do
8989
desc = """
90-
This is a list of integers that is printed as a sequence of codepoints
90+
This is a list of integers that is printed as a sequence of characters
9191
delimited by single quotes because all the integers in it represent valid
92-
ascii characters. Conventionally, such lists of integers are referred to as
93-
"char lists".
92+
ASCII characters. Conventionally, such lists of integers are referred to as
93+
"char lists" (more precisely, a char list is a list of Unicode codepoints,
94+
and ASCII is a subset of Unicode).
9495
"""
9596

9697
["Description": desc,
@@ -129,7 +130,7 @@ defimpl IEx.Info, for: BitString do
129130
defp info_string(bitstring) do
130131
desc = """
131132
This is a string: a UTF-8 encoded binary. It's printed surrounded by
132-
"double quotes" because all UTF-8 codepoints in it are printable.
133+
"double quotes" because all UTF-8 encoded codepoints in it are printable.
133134
"""
134135
["Byte size": byte_size(bitstring),
135136
"Description": desc,
@@ -146,7 +147,7 @@ defimpl IEx.Info, for: BitString do
146147
desc = """
147148
This is a string: a UTF-8 encoded binary. It's printed with the `<<>>`
148149
syntax (as opposed to double quotes) because it contains non-printable
149-
UTF-8 codepoints (the first non-printable codepoint being `#{inspect first_non_printable}`)
150+
UTF-8 encoded codepoints (the first non-printable codepoint being `#{inspect first_non_printable}`)
150151
"""
151152
["Byte size": byte_size(bitstring),
152153
"Description": desc,
@@ -160,9 +161,9 @@ defimpl IEx.Info, for: BitString do
160161
|> Enum.find(fn cp -> not String.valid?(cp) end)
161162

162163
desc = """
163-
This is a binary: a bunch of bytes. It's printed with the `<<>>`
164-
syntax (as opposed to double quotes) because it contains non-valid
165-
UTF-8 codepoints (the first non-valid codepoint being `#{inspect first_non_valid}`)
164+
This is a binary: a collection of bytes. It's printed with the `<<>>`
165+
syntax (as opposed to double quotes) because it is not a
166+
UTF-8 encoded binary (the first invalid byte being `#{inspect first_non_valid}`)
166167
"""
167168

168169
["Byte size": byte_size(bitstring),
@@ -236,7 +237,7 @@ defimpl IEx.Info, for: PID do
236237
end
237238

238239
["Data type": "PID"] ++ extra ++
239-
["Description": "Use Process.info/1 for more info about this process",
240+
["Description": "Use Process.info/1 to get more info about this process",
240241
"Reference modules": "Process, Node"]
241242
end
242243

lib/iex/test/iex/info_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule IEx.InfoTest do
6666

6767
test "bitstring: binary" do
6868
info = Info.info(<<255, 255>>)
69-
assert info[:"Description"] =~ "This is a binary: a bunch of bytes"
69+
assert info[:"Description"] =~ "This is a binary: a collection of bytes"
7070
end
7171

7272
test "bitstring: bitstring" do

0 commit comments

Comments
 (0)