From 2121cbd0865b5f2c8ec6481fcbe5924460a4f68a Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Fri, 22 Nov 2019 17:26:23 +0700 Subject: [PATCH] Replace usage of "e.g." (#9571) --- lib/elixir/lib/application.ex | 2 +- lib/elixir/lib/calendar.ex | 4 ++-- lib/elixir/lib/code/formatter.ex | 10 +++++----- lib/elixir/lib/file.ex | 2 +- lib/elixir/lib/gen_server.ex | 2 +- lib/elixir/lib/kernel.ex | 2 +- lib/elixir/lib/macro.ex | 2 +- lib/elixir/lib/map.ex | 4 ++-- lib/elixir/lib/system.ex | 2 +- lib/elixir/lib/uri.ex | 2 +- lib/elixir/pages/Naming Conventions.md | 2 +- lib/elixir/pages/Typespecs.md | 2 +- lib/elixir/src/elixir_errors.erl | 2 +- lib/elixir/src/elixir_expand.erl | 2 +- lib/elixir/src/elixir_parser.yrl | 10 +++++----- lib/elixir/src/elixir_tokenizer.erl | 2 +- lib/ex_unit/lib/ex_unit/capture_log.ex | 2 +- lib/iex/lib/iex/helpers.ex | 2 +- lib/mix/lib/mix/tasks/compile.erlang.ex | 2 +- lib/mix/lib/mix/tasks/profile.fprof.ex | 2 +- lib/mix/lib/mix/tasks/release.ex | 8 ++++---- 21 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/elixir/lib/application.ex b/lib/elixir/lib/application.ex index f955a493b7..89a3f335fd 100644 --- a/lib/elixir/lib/application.ex +++ b/lib/elixir/lib/application.ex @@ -252,7 +252,7 @@ defmodule Application do application specification key `:start_phases` is not `:undefined`. `start_args` are the arguments passed to the application in the `:mod` - specification key (e.g., `mod: {MyApp, [:my_args]}`). + specification key (for example, `mod: {MyApp, [:my_args]}`). This function should either return `{:ok, pid}` or `{:ok, pid, state}` if startup is successful. `pid` should be the PID of the top supervisor. `state` diff --git a/lib/elixir/lib/calendar.ex b/lib/elixir/lib/calendar.ex index b150b13a12..7143a892bd 100644 --- a/lib/elixir/lib/calendar.ex +++ b/lib/elixir/lib/calendar.ex @@ -62,10 +62,10 @@ defmodule Calendar do @typedoc "A calendar implementation" @type calendar :: module - @typedoc "The time zone ID according to the IANA tz database (e.g. Europe/Zurich)" + @typedoc "The time zone ID according to the IANA tz database (for example, Europe/Zurich)" @type time_zone :: String.t() - @typedoc "The time zone abbreviation (e.g. CET or CEST or BST etc.)" + @typedoc "The time zone abbreviation (for example, CET or CEST or BST etc.)" @type zone_abbr :: String.t() @typedoc "The time zone UTC offset in seconds" diff --git a/lib/elixir/lib/code/formatter.ex b/lib/elixir/lib/code/formatter.ex index 0d37d2b7f5..9a0e03db82 100644 --- a/lib/elixir/lib/code/formatter.ex +++ b/lib/elixir/lib/code/formatter.ex @@ -673,11 +673,11 @@ defmodule Code.Formatter do # There are five kinds of operators. # - # 1. no space binary operators, e.g. 1..2 - # 2. no newline binary operators, e.g. left in right - # 3. strict newlines before a left precedent operator, e.g. foo |> bar |> baz - # 4. strict newlines before a right precedent operator, e.g. foo when bar when baz - # 5. flex newlines after the operator, e.g. foo ++ bar ++ baz + # 1. no space binary operators, for example, 1..2 + # 2. no newline binary operators, for example, left in right + # 3. strict newlines before a left precedent operator, for example, foo |> bar |> baz + # 4. strict newlines before a right precedent operator, for example, foo when bar when baz + # 5. flex newlines after the operator, for example, foo ++ bar ++ baz # # Cases 1, 2 and 5 are handled fairly easily by relying on the # operator precedence and making sure nesting is applied only once. diff --git a/lib/elixir/lib/file.ex b/lib/elixir/lib/file.ex index 175b41f41a..c513a8b1c9 100644 --- a/lib/elixir/lib/file.ex +++ b/lib/elixir/lib/file.ex @@ -1612,7 +1612,7 @@ defmodule File do in raw mode for performance reasons. Therefore, Elixir **will** open streams in `:raw` mode with the `:read_ahead` option unless an encoding is specified. This means any data streamed into the file must be - converted to `t:iodata/0` type. If you pass e.g. `[encoding: :utf8]` + converted to `t:iodata/0` type. If you pass, for example, `[encoding: :utf8]` or `[encoding: {:utf16, :little}]` in the modes parameter, the underlying stream will use `IO.write/2` and the `String.Chars` protocol to convert the data. See `IO.binwrite/2` and `IO.write/2` . diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index 885fac4a8a..914f73a311 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -629,7 +629,7 @@ defmodule GenServer do Therefore it is not guaranteed that `c:terminate/2` is called when a `GenServer` exits. For such reasons, we usually recommend important clean-up rules to happen in separated processes either by use of monitoring or by links - themselves. There is no cleanup needed when the `GenServer` controls a `port` (e.g. + themselves. There is no cleanup needed when the `GenServer` controls a `port` (for example, `:gen_tcp.socket`) or `t:File.io_device/0`, because these will be closed on receiving a `GenServer`'s exit signal and do not need to be closed manually in `c:terminate/2`. diff --git a/lib/elixir/lib/kernel.ex b/lib/elixir/lib/kernel.ex index c0849d7a78..8e10d514aa 100644 --- a/lib/elixir/lib/kernel.ex +++ b/lib/elixir/lib/kernel.ex @@ -1326,7 +1326,7 @@ defmodule Kernel do Concatenates a proper list and a term, returning a list. The complexity of `a ++ b` is proportional to `length(a)`, so avoid repeatedly - appending to lists of arbitrary length, e.g. `list ++ [element]`. + appending to lists of arbitrary length, for example, `list ++ [element]`. Instead, consider prepending via `[element | rest]` and then reversing. If the `right` operand is not a proper list, it returns an improper list. diff --git a/lib/elixir/lib/macro.ex b/lib/elixir/lib/macro.ex index a1904ebcbc..ac89d02943 100644 --- a/lib/elixir/lib/macro.ex +++ b/lib/elixir/lib/macro.ex @@ -264,7 +264,7 @@ defmodule Macro do end # {:fn, _, _} is what we get when we pipe into an anonymous function without - # calling it, e.g., `:foo |> (fn x -> x end)`. + # calling it, for example, `:foo |> (fn x -> x end)`. def pipe(expr, {:fn, _, _}, _integer) do raise ArgumentError, "cannot pipe #{to_string(expr)} into an anonymous function without" <> diff --git a/lib/elixir/lib/map.ex b/lib/elixir/lib/map.ex index 658e1253b8..9ff82c63d8 100644 --- a/lib/elixir/lib/map.ex +++ b/lib/elixir/lib/map.ex @@ -343,8 +343,8 @@ defmodule Map do in `map` unless `key` is already present. This function is useful in case you want to compute the value to put under - `key` only if `key` is not already present (e.g., the value is expensive to - calculate or generally difficult to setup and teardown again). + `key` only if `key` is not already present, as for example, when the value is expensive to + calculate or generally difficult to setup and teardown again. ## Examples diff --git a/lib/elixir/lib/system.ex b/lib/elixir/lib/system.ex index a436e294a8..59ab1b4b6c 100644 --- a/lib/elixir/lib/system.ex +++ b/lib/elixir/lib/system.ex @@ -944,7 +944,7 @@ defmodule System do time and the Erlang VM system time. The result is returned in the given time unit `unit`. The returned - offset, added to an Erlang monotonic time (e.g., obtained with + offset, added to an Erlang monotonic time (for instance, one obtained with `monotonic_time/1`), gives the Erlang system time that corresponds to that monotonic time. """ diff --git a/lib/elixir/lib/uri.ex b/lib/elixir/lib/uri.ex index 6b4fa7ffce..5480ffd8af 100644 --- a/lib/elixir/lib/uri.ex +++ b/lib/elixir/lib/uri.ex @@ -74,7 +74,7 @@ defmodule URI do Encodes an enumerable into a query string. Takes an enumerable that enumerates as a list of two-element - tuples (e.g., a map or a keyword list) and returns a string + tuples (for instance, a map or a keyword list) and returns a string in the form of `key1=value1&key2=value2...` where keys and values are URL encoded as per `encode_www_form/1`. diff --git a/lib/elixir/pages/Naming Conventions.md b/lib/elixir/pages/Naming Conventions.md index e4d947f61e..6eaeb53d6c 100644 --- a/lib/elixir/pages/Naming Conventions.md +++ b/lib/elixir/pages/Naming Conventions.md @@ -65,7 +65,7 @@ The version without `!` is preferred when you want to handle different outcomes {:error, reason} -> # handle the error caused by `reason` end -However, if you expect the outcome to always to be successful (e.g. if you expect the file always to exist), the bang variation can be more convenient and will raise a more helpful error message (than a failed pattern match) on failure. +However, if you expect the outcome to always to be successful (for instance, if you expect the file always to exist), the bang variation can be more convenient and will raise a more helpful error message (than a failed pattern match) on failure. More examples of paired functions: `Base.decode16/2` and `Base.decode16!/2`, `File.cwd/0` and `File.cwd!/0`. diff --git a/lib/elixir/pages/Typespecs.md b/lib/elixir/pages/Typespecs.md index 0ed583eaae..ce60a4e892 100644 --- a/lib/elixir/pages/Typespecs.md +++ b/lib/elixir/pages/Typespecs.md @@ -36,7 +36,7 @@ In the example above, this happens: ## Types and their syntax -The syntax Elixir provides for type specifications is similar to [the one in Erlang](http://www.erlang.org/doc/reference_manual/typespec.html). Most of the built-in types provided in Erlang (for example, `pid()`) are expressed in the same way: `pid()` (or simply `pid`). Parameterized types (such as `list(integer)`) are supported as well and so are remote types (such as `Enum.t`). Integers and atom literals are allowed as types (e.g., `1`, `:atom`, or `false`). All other types are built out of unions of predefined types. Some shorthands are allowed, such as `[...]`, `<<>>`, and `{...}`. +The syntax Elixir provides for type specifications is similar to [the one in Erlang](http://www.erlang.org/doc/reference_manual/typespec.html). Most of the built-in types provided in Erlang (for example, `pid()`) are expressed in the same way: `pid()` (or simply `pid`). Parameterized types (such as `list(integer)`) are supported as well and so are remote types (such as `Enum.t`). Integers and atom literals are allowed as types (for example, `1`, `:atom`, or `false`). All other types are built out of unions of predefined types. Some shorthands are allowed, such as `[...]`, `<<>>`, and `{...}`. The notation to represent the union of types is the pipe `|`. For example, the typespec `type :: atom() | pid() | tuple()` creates a type `type` that can be either an `atom`, a `pid`, or a `tuple`. This is usually called a [sum type](https://en.wikipedia.org/wiki/Tagged_union) in other languages diff --git a/lib/elixir/src/elixir_errors.erl b/lib/elixir/src/elixir_errors.erl index 3fd7e467ae..55f5ad408f 100644 --- a/lib/elixir/src/elixir_errors.erl +++ b/lib/elixir/src/elixir_errors.erl @@ -134,7 +134,7 @@ parse_error(Line, File, {ErrorPrefix, ErrorSuffix}, Token) when is_binary(ErrorP Message = <>, raise(Line, File, 'Elixir.SyntaxError', Message); -%% Misplaced char tokens (e.g., {char, _, 97}) are translated by Erlang into +%% Misplaced char tokens (for example, {char, _, 97}) are translated by Erlang into %% the char literal (i.e., the token in the previous example becomes $a), %% because {char, _, _} is a valid Erlang token for an Erlang char literal. We %% want to represent that token as ?a in the error, according to the Elixir diff --git a/lib/elixir/src/elixir_expand.erl b/lib/elixir/src/elixir_expand.erl index 1f20d2ee32..2321006848 100644 --- a/lib/elixir/src/elixir_expand.erl +++ b/lib/elixir/src/elixir_expand.erl @@ -1257,7 +1257,7 @@ format_error({nested_comparison, CompExpr}) -> "is equivalent to\n\n" " (x < y) < z\n\n" "which ultimately compares z with the boolean result of (x < y). " - "Instead, consider joining together each comparison segment with an \"and\", e.g.\n\n" + "Instead, consider joining together each comparison segment with an \"and\", for example,\n\n" " x < y and y < z\n\n" "You wrote: ~ts", [String]); format_error({undefined_local_capture, Fun, Arity}) -> diff --git a/lib/elixir/src/elixir_parser.yrl b/lib/elixir/src/elixir_parser.yrl index 3b2dae43f1..d0c001bffb 100644 --- a/lib/elixir/src/elixir_parser.yrl +++ b/lib/elixir/src/elixir_parser.yrl @@ -103,17 +103,17 @@ expr -> unmatched_expr : '$1'. %% problematic they are: %% %% (a) no_parens_one: a call with one unproblematic argument -%% (e.g. `f a` or `f g a` and similar) (includes unary operators) +%% (for example, `f a` or `f g a` and similar) (includes unary operators) %% -%% (b) no_parens_many: a call with several arguments (e.g. `f a, b`) +%% (b) no_parens_many: a call with several arguments (for example, `f a, b`) %% %% (c) no_parens_one_ambig: a call with one argument which is -%% itself a no_parens_many or no_parens_one_ambig (e.g. `f g a, b` -%% or `f g h a, b` and similar) +%% itself a no_parens_many or no_parens_one_ambig (for example, `f g a, b`, +%% `f g h a, b` and similar) %% %% Note, in particular, that no_parens_one_ambig expressions are %% ambiguous and are interpreted such that the outer function has -%% arity 1 (e.g. `f g a, b` is interpreted as `f(g(a, b))` rather +%% arity 1 (for istance, `f g a, b` is interpreted as `f(g(a, b))` rather %% than `f(g(a), b)`). Hence the name, no_parens_one_ambig. %% %% The distinction is required because we can't, for example, have diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index 5f7da12ad7..7547ae95a2 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -960,7 +960,7 @@ extract_heredoc_body(Line, Column, Marker, Rest, Buffer) -> end. %% Extract a line from the heredoc prepending its contents to a buffer. -%% Allow lazy escaping (e.g. \""") +%% Allow lazy escaping (for example, \""") extract_heredoc_line(Marker, [$\\, $\\ | T], Buffer) -> extract_heredoc_line(Marker, T, [$\\, $\\ | Buffer]); diff --git a/lib/ex_unit/lib/ex_unit/capture_log.ex b/lib/ex_unit/lib/ex_unit/capture_log.ex index 417510c3f4..aa491af714 100644 --- a/lib/ex_unit/lib/ex_unit/capture_log.ex +++ b/lib/ex_unit/lib/ex_unit/capture_log.ex @@ -48,7 +48,7 @@ defmodule ExUnit.CaptureLog do However, `capture_log` does not guarantee to capture log messages originated from processes spawned using a low level `Kernel` spawn - function (e.g. `Kernel.spawn/1`) and such processes exit with an + function (for example, `Kernel.spawn/1`) and such processes exit with an exception or a throw. Therefore, prefer using a `Task`, or other OTP process, will send explicit logs before its exit or monitor signals and will not cause VM generated log messages. diff --git a/lib/iex/lib/iex/helpers.ex b/lib/iex/lib/iex/helpers.ex index 9ca9c0159b..c8bf60cd61 100644 --- a/lib/iex/lib/iex/helpers.ex +++ b/lib/iex/lib/iex/helpers.ex @@ -507,7 +507,7 @@ defmodule IEx.Helpers do @doc """ Just like `runtime_info/0`, except accepts topic or a list of topics. - E.g. topic `:applications` will list the applications loaded. + For example, topic `:applications` will list the applications loaded. """ def runtime_info(topic) when is_atom(topic) and topic in @runtime_info_topics do topic diff --git a/lib/mix/lib/mix/tasks/compile.erlang.ex b/lib/mix/lib/mix/tasks/compile.erlang.ex index 4111fe8a0e..4faad0610e 100644 --- a/lib/mix/lib/mix/tasks/compile.erlang.ex +++ b/lib/mix/lib/mix/tasks/compile.erlang.ex @@ -92,7 +92,7 @@ defmodule Mix.Tasks.Compile.Erlang do |> Enum.map(&annotate_target(&1, compile_path, opts[:force])) Mix.Compilers.Erlang.compile(manifest(), tuples, opts, fn input, _output -> - # We're purging the module because a previous compiler (e.g. Phoenix) + # We're purging the module because a previous compiler (for example, Phoenix) # might have already loaded the previous version of it. module = input |> Path.basename(".erl") |> String.to_atom() :code.purge(module) diff --git a/lib/mix/lib/mix/tasks/profile.fprof.ex b/lib/mix/lib/mix/tasks/profile.fprof.ex index 93a7b8e14c..94b2c791f4 100644 --- a/lib/mix/lib/mix/tasks/profile.fprof.ex +++ b/lib/mix/lib/mix/tasks/profile.fprof.ex @@ -11,7 +11,7 @@ defmodule Mix.Tasks.Profile.Fprof do Before running the code, it invokes the `app.start` task which compiles and loads your project. Then the target expression is profiled, together - with all processes which are spawned by it. Other processes (e.g. those + with all processes which are spawned by it. Other processes (for example, those residing in the OTP application supervision tree) are not profiled. To profile the code, you can use syntax similar to the `mix run` task: diff --git a/lib/mix/lib/mix/tasks/release.ex b/lib/mix/lib/mix/tasks/release.ex index 0fccb61607..82c1aab18e 100644 --- a/lib/mix/lib/mix/tasks/release.ex +++ b/lib/mix/lib/mix/tasks/release.ex @@ -243,11 +243,11 @@ defmodule Mix.Tasks.Release do To deploy straight from a host to a separate target without cross-compilation, the following must be the same between the host and the target: - * Target architecture (e.g. x86_64 vs ARM) - * Target vendor + operating system (e.g. Windows, Linux, Darwin/macOS) - * Target ABI (e.g. musl, gnu) + * Target architecture (for example, x86_64 or ARM) + * Target vendor + operating system (for example, Windows, Linux, or Darwin/macOS) + * Target ABI (for example, musl or gnu) - This is often represented in the form of target triples, e.g. + This is often represented in the form of target triples, for example, `x86_64-unknown-linux-gnu`, `x86_64-unknown-linux-musl`, `x86_64-apple-darwin`. So to be more precise, to deploy straight from a host to a separate target,