5
以下可能嗎?在OCaml中處理多種異常類型
try
(* danger zone *)
with Not_found e ->
(* code to handle not found *)
with t ->
(* code to handle all other issues *)
如果我在頂級類型中輸入該值,則會在第二個with
上出現語法錯誤。也許有一些我不知道的語法?
爲了匹配每個with
,是否優先選擇另一個try
?
是什麼使你認爲你寫的語法應該工作?你在別人的代碼中看到過嗎?或者手冊或教程中有這樣的例子嗎?猜測不是一個很好的學習方式。 – ygrek 2012-04-25 07:50:57