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