File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 98
98
{:ok , body} = File .read (file)
99
99
```
100
100
101
- 当遇到文件不存在的情况时,函数返回` {:error, reason} ` ,然后导致在跟左侧元祖做模式匹配时失败 。
101
+ 当遇到文件不存在的情况时,函数返回` {:error, reason} ` ,然后导致在跟左侧元组做模式匹配时失败 。
102
102
失败依然会抛出一个异常,但是该异常的错误信息是描述一次模式匹配失败,而不是文件的什么错误。
103
103
从而在一定程度上掩盖了真正的失败原因。
104
104
@@ -140,7 +140,7 @@ iex> Path.expand("~/hello")
140
140
141
141
## 进程(Processes)和组长(group leaders)
142
142
143
- 你可能已经注意到` File.open/2 ` 函数返回类似` {:ok, pid} ` 的元祖 :
143
+ 你可能已经注意到` File.open/2 ` 函数返回类似` {:ok, pid} ` 的元组 :
144
144
145
145
``` elixir
146
146
iex> {:ok , file} = File .open " hello" , [:write ]
@@ -163,7 +163,7 @@ iex> IO.write(pid, "hello")
163
163
** (ErlangError ) erlang error: :terminated
164
164
```
165
165
166
- 调用` IO.write/2 ` 之后,可以看到` IO ` 模块发出的请求(四个元素的元祖 )被打印了出来。
166
+ 调用` IO.write/2 ` 之后,可以看到` IO ` 模块发出的请求(四个元素的元组 )被打印了出来。
167
167
不久后,因为我们并未提供` IO ` 模块期待的某种结果,这个请求失败了。
168
168
169
169
[ ` StringIO ` 模块] ( http://elixir-lang.org/docs/stable/elixir/StringIO.html )
You can’t perform that action at this time.
0 commit comments