fix errata

This commit is contained in:
chai2010
2016-01-07 15:02:42 +08:00
parent 5f3f901bf9
commit ca365a301a
9 changed files with 9 additions and 9 deletions

View File

@@ -153,7 +153,7 @@ func Unmarshal(data []byte, out interface{}) (err error) {
生産實現不應該對任何輸入問題都用panic形式報告而且應該報告一些錯誤相關的信息例如出現錯誤輸入的行號和位置等。盡管如此我們希望通過這個例子來展示類似encoding/json等包底層代碼的實現思路以及如何使用反射機製來填充數據結構。
**練習 12.8** sexpr.Unmarshal函數和json.Marshal一樣譯註這可能是筆誤我覺得應該是指`json.Unmarshal`函數)都要求在解碼前輸入完整的字節slice。定義一個和json.Decoder類似的sexpr.Decoder類型支持從一個io.Reader流解碼。脩改sexpr.Unmarshal函數使用這個新的類型實現。
**練習 12.8** sexpr.Unmarshal函數和json.Unmarshal一樣都要求在解碼前輸入完整的字節slice。定義一個和json.Decoder類似的sexpr.Decoder類型支持從一個io.Reader流解碼。脩改sexpr.Unmarshal函數使用這個新的類型實現。
**練習 12.9** 編寫一個基於標記的API用於解碼S表達式參考xml.Decoder7.14的風格。你將需要五種類型的標記Symbol、String、Int、StartList和EndList。