FAQ
+mpvl
On Wed, Dec 16, 2015 at 8:42 AM, Garrett D'Amore wrote:
I want to take a second here to gripe about a change made to the
text/encoding package, which changed the return types of the Encoding
NewDecoder and NewEncoder methods — this change was done recently. These
methods used to simply return a Transformer, but now instead they return a
pointer to a structure that wraps the Transformer.

The new API is definitely “cleaner”, so I can understand where the desire
for a change came from.

But this API change was somewhat gratuitous, and it broke code in the field.
My encoding package, and all of its consumers (which included tcell,
govisor, proxima5, etc.) broke. I’m not sure I know all of my downstream
consumers — that’s the beauty of github. :-)

At this point I’ve fixed my encoding package to operate with the new API, so
that’s fine. (Don’t change it back — that would only make matters worse at
this point.)

But there is a lesson here that I’d like those working in the “official”
golang repos (and I consider golang.org/x/* to mostly be official) - please
be *careful* about changes to the API — adding methods to interfaces and
changing method signatures can have far reaching implications.

Stable APIs matter.
Yeah, the next time we break API for something under golang.org/x that
has been around for as long as the encoding package, we should
probably discuss it on golang-dev first, if not file a formal
proposal.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 15, '15 at 9:42p
activeDec 18, '15 at 11:39p
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase