diff options
author | Robert Griesemer <gri@golang.org> | 2012-02-08 11:41:32 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2012-02-08 11:41:32 -0800 |
commit | 40850fa8ea40e98d75729b2e898220039e0916b5 (patch) | |
tree | dbcb4de94c4a835d9559cfabed4a260542207530 /doc/go1.html | |
parent | a5dcc43487dd06e2d62a519c5a4f13c37114b0b6 (diff) | |
download | go-40850fa8ea40e98d75729b2e898220039e0916b5.tar.gz |
go/scanner: clean up error interface
Issue 2856 asks for a rename of a few methods to a
more idiomatic Go style. This is a very early API
that evolved organically throughout the years.
Together with the fact that ErrorVectors were embedded
in other data structures (e.g. Parser), just renaming
methods (e.g. GetError -> Error) would lead to undesired
behavior (e.g., Parser would act like an Error). Instead,
cleaned up API a bit more:
- removed ErrorVector in favor of ErrorList (already
present)
- simplified Scanner.Init by making the error handler a
function instead of requiring an ErrorHandler implementation
- adjusted helper functions accordingly
- updated Go 1 doc
Fixes issue 2856.
R=rsc
CC=golang-dev
http://codereview.appspot.com/5624047
Diffstat (limited to 'doc/go1.html')
-rw-r--r-- | doc/go1.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/go1.html b/doc/go1.html index e3d2354e6..7613c3880 100644 --- a/doc/go1.html +++ b/doc/go1.html @@ -1042,6 +1042,16 @@ for that purpose. </p> <p> +The <a href="/pkg/go/scanner/#ErrorHandler"><code>ErrorHandler</code></a> provided +to the scanner's <a href="/pkg/go/scanner/#Scanner.Init"><code>Init</code></a> method is +now simply a function rather than an interface. The <code>ErrorVector</code> type has +been removed in favor of the (existing) <a href="/pkg/go/scanner/#ErrorList"><code>ErrorList</code></a> +type, and the <code>ErrorVector</code> methods have been migrated. Instead of embedding +an <code>ErrorVector</code> in a client of the scanner, now a client should maintain +an <code>ErrorList</code>. +</p> + +<p> The set of parse functions provided by the <a href="/pkg/go/parser/"><code>go/parser</code></a> package has been reduced to the primary parse function <a href="/pkg/go/parser/#ParseFile"><code>ParseFile</code></a>, and a couple of |