https://codereview.appspot.com/12556043/diff/13001/src/pkg/encoding/xml/read.go File src/pkg/encoding/xml/read.go (right): https://codereview.appspot.com/12556043/diff/13001/src/pkg/encoding/xml/read.go#newcode159 src/pkg/encoding/xml/read.go:159: // Unmarshaler is the interface implemented by objects that ...
11 years, 1 month ago
(2013-08-09 16:21:44 UTC)
#3
https://codereview.appspot.com/12556043/diff/18001/src/pkg/encoding/xml/read.go File src/pkg/encoding/xml/read.go (right): https://codereview.appspot.com/12556043/diff/18001/src/pkg/encoding/xml/read.go#newcode214 src/pkg/encoding/xml/read.go:214: // so it's likely to be incorrect, but we ...
11 years, 1 month ago
(2013-08-11 01:31:19 UTC)
#4
LGTM
On 14/08/2013, at 1:54 AM, "rsc@golang.org" <rsc@golang.org> wrote:
> It's possible to use correctly. For example, you might make an
> unmarshaler out of a func or a map, or perhaps a struct containing a
> pointer to the thing to fill in. All those use cases are fine with a
> non-pointer receiver. In general you can't tell the difference. So we do
> what we're told and hope the code says what the programmer meant.
Maybe an example to point to this potential trap?
Hello golang-dev@googlegroups.com, dominik.honnef@gmail.com, dan.kortschak@adelaide.edu.au (cc: golang-dev@googlegroups.com), Please take another look.
On Wed, Aug 14, 2013 at 12:28 PM, <dominik.honnef@gmail.com> wrote:
>
> https://codereview.appspot.**com/12556043/diff/28001/src/**
>
pkg/encoding/xml/xml.go<https://codereview.appspot.com/12556043/diff/28001/src/pkg/encoding/xml/xml.go>
> File src/pkg/encoding/xml/xml.go (right):
>
> https://codereview.appspot.**com/12556043/diff/28001/src/**
>
pkg/encoding/xml/xml.go#**newcode1859<https://codereview.appspot.com/12556043/diff/28001/src/pkg/encoding/xml/xml.go#newcode1859>
> src/pkg/encoding/xml/xml.go:**1859: func (p *printer) EscapeString(s
> string) {
> Why is EscapeString exported? From what I can tell, there's no way to
> get to a *printer from outside the package. Is it part of an interface
> I'm unaware of?
>
It's only for consistency with the other exported-and-yet-unavailable
methods on printer.
Russ
On Tue, Aug 13, 2013 at 5:04 PM, Dan Kortschak <
dan.kortschak@adelaide.edu.au> wrote:
> Maybe an example to point to this potential trap?
>
the potential trap is probably not worth pointing out here. it's true of
any method anywhere that needs to mutate its state. it's something you
learn (use pointer receiver) when learning how to write methods, not
something specific to xml.
i agree that examples would be great. those will have to happen in a
separate CL though.
russ
*** Submitted as https://code.google.com/p/go/source/detail?r=add6c198070e *** encoding/xml: add, support Unmarshaler interface See golang.org/s/go12xml for design. R=golang-dev, ...
Issue 12556043: code review 12556043: encoding/xml: add, support Unmarshaler interface
(Closed)
Created 11 years, 1 month ago by rsc
Modified 11 years ago
Reviewers:
Base URL:
Comments: 6