Is it possible to unmarshal JSON/XML to enum type?

3,690 views
Skip to first unread message

Robert D.

unread,
Dec 27, 2012, 7:54:10 AM12/27/12
to golan...@googlegroups.com
Hi,

Using the emoding/json or encoding/xml packages, is it possible to unmarshal JSON/XML into enums?
For example, I have an XML field which should have only two possible values and I can define these in Go as:

type myType string

const (
possibleValueOne myType = "valueOne"
possibleValueTwo myType = "valueTwo"
)

Then in the struct where I'm doing the unmarshalling I have:

type MyStruct struct {
TheType myType
}

Does it make sense to do something like this?

Thanks,
Robert

Kyle Lemons

unread,
Dec 27, 2012, 12:31:50 PM12/27/12
to Robert D., golang-nuts
If you implement http://golang.org/pkg/encoding/json/#Unmarshaler you will be able to decode a string description of the type into a (pointer to a) myType value.


--
 
 

Robert D.

unread,
Dec 28, 2012, 10:13:12 AM12/28/12
to golan...@googlegroups.com, Robert D.
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML? It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?

Robert

Johann Höchtl

unread,
Dec 28, 2012, 11:00:25 AM12/28/12
to golan...@googlegroups.com, Robert D.


Am Freitag, 28. Dezember 2012 16:13:12 UTC+1 schrieb Robert D.:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML? It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?

Kyle Lemons

unread,
Dec 29, 2012, 3:41:57 AM12/29/12
to Robert D., golang-nuts
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".
 
Robert


On Thursday, December 27, 2012 6:31:50 PM UTC+1, Kyle Lemons wrote:
If you implement http://golang.org/pkg/encoding/json/#Unmarshaler you will be able to decode a string description of the type into a (pointer to a) myType value.


On Thu, Dec 27, 2012 at 7:54 AM, Robert D. <robert...@gmail.com> wrote:
Hi,

Using the emoding/json or encoding/xml packages, is it possible to unmarshal JSON/XML into enums?
For example, I have an XML field which should have only two possible values and I can define these in Go as:

type myType string

const (
possibleValueOne myType = "valueOne"
possibleValueTwo myType = "valueTwo"
)

Then in the struct where I'm doing the unmarshalling I have:

type MyStruct struct {
TheType myType
}

Does it make sense to do something like this?

Thanks,
Robert

--
 
 

--
 
 

Robert D.

unread,
Dec 29, 2012, 5:11:25 AM12/29/12
to golan...@googlegroups.com, Robert D.


On Saturday, December 29, 2012 9:41:57 AM UTC+1, Kyle Lemons wrote:
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".

Well, historically "marshal" is spelled with one L, because this is the correct gramatical spelling, and the oposite is then indeed "unmarshal". However, I would argue that your (and however wrote this code) interpretation of the following Go idiom:

By convention, one-method interfaces are named by the method name plus the -er suffix: Reader, Writer, Formatter etc.

is incorrect. I could just stop here and argue that it is obviously incorrect because if you look at the example above you have the example "formatter" interface which is formed by suffixing "format" with "-er", and of course, that doubles the "t".

In English "-er" is not just something that you add at the end of a word to form another word, it is called agentive ending (http://en.wikipedia.org/wiki/Agentive_ending) and it is used in order to create a noun meaning "someone or something that does the action the verb describes".
There are also some spelling rules in regards to building words using agentive endings, one of which says: "for two-syllable verbs that end in a single vowel followed by a single consonant other than w,x, or y, double the final consonant then add the agent suffix.

Following these rules it is therefore clear that the correct spellings are marshaller and unmarshaller.

It is ridiculous that such basic english spelling mistakes like this which tend to turn a language into a ghetto slip in the code and not only are tolerated but people argue about them being the correct form.

Robert

Nigel Tao

unread,
Dec 29, 2012, 8:45:49 PM12/29/12
to Robert D., golang-nuts
On Sat, Dec 29, 2012 at 9:11 PM, Robert D. <robert...@gmail.com> wrote:
> However, I would argue that your (and however wrote this code)
> interpretation of the following Go idiom:

You misspelled "whoever". :-)


> It is ridiculous that such basic english spelling mistakes like this which
> tend to turn a language into a ghetto slip in the code and not only are
> tolerated but people argue about them being the correct form.

The misspelling is unfortunate, but it is not something we can change
without breaking backwards compatibility with Go 1. Even so, I don't
think that this mistake makes a ghetto inevitable. As previously
mentioned, Unix misspelled creat with only one 'e', yet it has been
remarkably successful.

bryanturley

unread,
Dec 29, 2012, 10:51:52 PM12/29/12
to golan...@googlegroups.com, Robert D.


On Saturday, December 29, 2012 6:45:49 PM UTC-7, Nigel Tao wrote:
On Sat, Dec 29, 2012 at 9:11 PM, Robert D. <robert...@gmail.com> wrote:
> However, I would argue that your (and however wrote this code)
> interpretation of the following Go idiom:

You misspelled "whoever". :-)


> It is ridiculous that such basic english spelling mistakes like this which
> tend to turn a language into a ghetto slip in the code and not only are

I just spent 5 minutes trying to figure out how to do a drive by emailing, guess I am not thug enough.
;)
 
> tolerated but people argue about them being the correct form.

The misspelling is unfortunate, but it is not something we can change
without breaking backwards compatibility with Go 1. Even so, I don't
think that this mistake makes a ghetto inevitable. As previously
mentioned, Unix misspelled creat with only one 'e', yet it has been
remarkably successful.

Really that was an accident?  I thought it was a space/time saver.

DisposaBoy

unread,
Dec 30, 2012, 6:18:51 AM12/30/12
to golan...@googlegroups.com, Robert D.


On Saturday, December 29, 2012 10:11:25 AM UTC, Robert D. wrote:


On Saturday, December 29, 2012 9:41:57 AM UTC+1, Kyle Lemons wrote:
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".

Well, historically "marshal" is spelled with one L, because this is the correct gramatical spelling, and the oposite is then indeed "unmarshal". However, I would argue that your (and however wrote this code) interpretation of the following Go idiom:

By convention, one-method interfaces are named by the method name plus the -er suffix: Reader, Writer, Formatter etc.

is incorrect. I could just stop here and argue that it is obviously incorrect because if you look at the example above you have the example "formatter" interface which is formed by suffixing "format" with "-er", and of course, that doubles the "t".

In English "-er" is not just something that you add at the end of a word to form another word, it is called agentive ending (http://en.wikipedia.org/wiki/Agentive_ending) and it is used in order to create a noun meaning "someone or something that does the action the verb describes".
There are also some spelling rules in regards to building words using agentive endings, one of which says: "for two-syllable verbs that end in a single vowel followed by a single consonant other than w,x, or y, double the final consonant then add the agent suffix.

Following these rules it is therefore clear that the correct spellings are marshaller and unmarshaller.

It is ridiculous that such basic english spelling mistakes like this which tend to turn a language into a ghetto slip in the code and not only are tolerated but people argue about them being the correct form.

Robert
 

Sir, please don't try to make the language into a language-nazi-ghetto. It's ridiculous that you should be arguing about such trivial matter especially when Marshaler is a perfectly fine word. I also find it somewhat ironic that someone as holy as yourself doesn't knows how to spell the word "spelt".

Rodrigo Moraes

unread,
Dec 30, 2012, 6:37:39 AM12/30/12
to golang-nuts
On Dec 29, 8:11 am, "Robert D." wrote:
> In English "-er" is not just something that you add at the end of a word to
> form another word, it is called agentive ending
> (http://en.wikipedia.org/wiki/Agentive_ending)

Independently of the misspelling nitpicks, you have a point about the
"bad" convention. It is a little unfortunate that Go didn't set a
convention that would work all the time. It would be useful to
recognize an interface by its name, all the time, but because -er
can't be used everywhere, this is not the case. I believe they didn't
choose a convention like IMarshal to not look like java (:P), but as
ugly as it is it would be more valuable than the -er convention which
clearly has broken legs and force people to use names that are not
easily recognized as an interface.

Not a big deal, but I always wished interface names followed a
stronger convention. Too late, now.

-- rodrigo

Rodrigo Moraes

unread,
Dec 30, 2012, 7:00:58 AM12/30/12
to golang-nuts
On Dec 29, 8:11 am, "Robert D." wrote:
> It is ridiculous that such basic english spelling mistakes like this which
> tend to turn a language into a ghetto slip in the code and not only are
> tolerated but people argue about them being the correct form.

This is unconfirmed, but some believe that Unmarshaler is a tribute to
the HTTP referer header field. Both serve the same purpose: to remind
us that we are humans and that love and compassion are everywhere, and
that the joy of life resides in small things like a breeze in the
face, lemonade or Jun Miyake songs.

-- rodrigo

minux

unread,
Dec 30, 2012, 7:16:49 AM12/30/12
to Robert D., golan...@googlegroups.com

On Saturday, December 29, 2012, Robert D. wrote:
On Saturday, December 29, 2012 9:41:57 AM UTC+1, Kyle Lemons wrote:
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".

Well, historically "marshal" is spelled with one L, because this is the correct gramatical spelling, and the oposite is then indeed "unmarshal". However, I would argue that your (and however wrote this code) interpretation of the following Go idiom:

By convention, one-method interfaces are named by the method name plus the -er suffix: Reader, Writer, Formatter etc.

is incorrect. I could just stop here and argue that it is obviously incorrect because if you look at the example above you have the example "formatter" interface which is formed by suffixing "format" with "-er", and of course, that doubles the "t".
 
In English "-er" is not just something that you add at the end of a word to form another word, it is called agentive ending (http://en.wikipedia.org/wiki/Agentive_ending) and it is used in order to create a noun meaning "someone or something that does the action the verb describes".
There are also some spelling rules in regards to building words using agentive endings, one of which says: "for two-syllable verbs that end in a single vowel followed by a single consonant other than w,x, or y, double the final consonant then add the agent suffix.
Following these rules it is therefore clear that the correct spellings are marshaller and unmarshaller.
You are still arguing about this even you've being given one example
that says marshaler is accepted on the issue tracker.

http://www.merriam-webster.com/dictionary/marshaler

minux

unread,
Dec 30, 2012, 7:21:08 AM12/30/12
to Rodrigo Moraes, golang-nuts

On Sunday, December 30, 2012, Rodrigo Moraes wrote:
On Dec 29, 8:11 am, "Robert D." wrote:
> In English "-er" is not just something that you add at the end of a word to
> form another word, it is called agentive ending
> (http://en.wikipedia.org/wiki/Agentive_ending)

Independently of the misspelling nitpicks, you have a point about the
"bad" convention. It is a little unfortunate that Go didn't set a
convention that would work all the time. It would be useful to
recognize an interface by its name, all the time, but because -er
can't be used everywhere, this is not the case. I believe they didn't
choose a convention like IMarshal to not look like java (:P), but as
ugly as it is it would be more valuable than the -er convention which
clearly has broken legs and force people to use names that are not
easily recognized as an interface.
Go has an emphasis on small interfaces and interface composition,
so i think this incomplete -er naming convention is actually beneficial --
it forces us to make the interface smaller to have a nice idiomatic -er name.

Rodrigo Moraes

unread,
Dec 30, 2012, 7:40:48 AM12/30/12
to golang-nuts
On Dec 30, 10:21 am, minux wrote:
> Go has an emphasis on small interfaces and interface composition,
> so i think this incomplete -er naming convention is actually beneficial --
> it forces us to make the interface smaller to have a nice idiomatic -er
> name.

But the convention is commonly not used, as in (funny names
followed :P):

http://golang.org/pkg/crypto/#PrivateKey -> PrivateKeyer
http://golang.org/pkg/crypto/cipher/#Block -> Blocker
http://golang.org/pkg/crypto/cipher/#BlockMode -> BlockModer
http://golang.org/pkg/crypto/cipher/#Stream -> Streamer
http://golang.org/pkg/fmt/#ScanState -> ScanStater
http://golang.org/pkg/net/http/#CookieJar -> CookieJarer
http://golang.org/pkg/net/http/#File -> Filer
http://golang.org/pkg/text/template/parse/#Node -> Noder
etc.

...or in so many user packages.

It seems to me that it would be beneficial if the convention was
strong to the point that all interfaces could be recognized by their
names. Not a big deal, but not the case.

-- rodrigo

Robert D.

unread,
Dec 30, 2012, 8:25:57 AM12/30/12
to golan...@googlegroups.com, Robert D.


On Sunday, December 30, 2012 2:45:49 AM UTC+1, Nigel Tao wrote:
On Sat, Dec 29, 2012 at 9:11 PM, Robert D. <robert...@gmail.com> wrote:
> However, I would argue that your (and however wrote this code)
> interpretation of the following Go idiom:

You misspelled "whoever". :-)

Only I didn't include it in my programming language, did I?
You and some other posters here are totally missing the point.  There is a big difference between writing a word in an email and writing a "word" in a programming language which will supposedly be used by millions of people who will have to put up with bad grammar.

Robert D.

unread,
Dec 30, 2012, 8:27:12 AM12/30/12
to golan...@googlegroups.com, Robert D.


On Sunday, December 30, 2012 12:18:51 PM UTC+1, DisposaBoy wrote:


On Saturday, December 29, 2012 10:11:25 AM UTC, Robert D. wrote:


On Saturday, December 29, 2012 9:41:57 AM UTC+1, Kyle Lemons wrote:
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".

Well, historically "marshal" is spelled with one L, because this is the correct gramatical spelling, and the oposite is then indeed "unmarshal". However, I would argue that your (and however wrote this code) interpretation of the following Go idiom:

By convention, one-method interfaces are named by the method name plus the -er suffix: Reader, Writer, Formatter etc.

is incorrect. I could just stop here and argue that it is obviously incorrect because if you look at the example above you have the example "formatter" interface which is formed by suffixing "format" with "-er", and of course, that doubles the "t".

In English "-er" is not just something that you add at the end of a word to form another word, it is called agentive ending (http://en.wikipedia.org/wiki/Agentive_ending) and it is used in order to create a noun meaning "someone or something that does the action the verb describes".
There are also some spelling rules in regards to building words using agentive endings, one of which says: "for two-syllable verbs that end in a single vowel followed by a single consonant other than w,x, or y, double the final consonant then add the agent suffix.

Following these rules it is therefore clear that the correct spellings are marshaller and unmarshaller.

It is ridiculous that such basic english spelling mistakes like this which tend to turn a language into a ghetto slip in the code and not only are tolerated but people argue about them being the correct form.

Robert
 

Sir, please don't try to make the language into a language-nazi-ghetto. It's ridiculous that you should be arguing about such trivial matter especially when Marshaler is a perfectly fine word. I also find it somewhat ironic that someone as holy as yourself doesn't knows how to spell the word "spelt".

I find it even more ironic that you are wrong. http://grammarist.com/spelling/spelled-spelt/

Robert D.

unread,
Dec 30, 2012, 8:31:56 AM12/30/12
to golan...@googlegroups.com, Robert D.


On Sunday, December 30, 2012 1:16:49 PM UTC+1, minux wrote:

On Saturday, December 29, 2012, Robert D. wrote:
On Saturday, December 29, 2012 9:41:57 AM UTC+1, Kyle Lemons wrote:
On Fri, Dec 28, 2012 at 7:13 AM, Robert D. <robert...@gmail.com> wrote:
Thanks, this is indeed what I was looking for.
How about the encoding/xml package? Is it possible to achive something similar for XML?
No, unfortunately (at least, not yet).
 
It doesn't seem to have an Unmarshaler interface type.
By the way, isn't the correct spelling "Unmarshaller" or is there a reason for it being spelled that way?
I don't know why, but historically "Marshal" is spelled with one L (in multiple programming languages).  The opposite, then, is "Unmarshal" and the idiom in Go for a one-function interface is funcName + "er", thus "Unmarshaler".

Well, historically "marshal" is spelled with one L, because this is the correct gramatical spelling, and the oposite is then indeed "unmarshal". However, I would argue that your (and however wrote this code) interpretation of the following Go idiom:

By convention, one-method interfaces are named by the method name plus the -er suffix: Reader, Writer, Formatter etc.

is incorrect. I could just stop here and argue that it is obviously incorrect because if you look at the example above you have the example "formatter" interface which is formed by suffixing "format" with "-er", and of course, that doubles the "t".
 
In English "-er" is not just something that you add at the end of a word to form another word, it is called agentive ending (http://en.wikipedia.org/wiki/Agentive_ending) and it is used in order to create a noun meaning "someone or something that does the action the verb describes".
There are also some spelling rules in regards to building words using agentive endings, one of which says: "for two-syllable verbs that end in a single vowel followed by a single consonant other than w,x, or y, double the final consonant then add the agent suffix.
Following these rules it is therefore clear that the correct spellings are marshaller and unmarshaller.
You are still arguing about this even you've being given one example
that says marshaler is accepted on the issue tracker.

 If you would pay attention at the time you would notice that this was posted before your answer in the issues tracker.

All in all, I did a bit of research and it turns out that as you say it is also an accepted form, only it is much less spread than the marshaller form. So I would still argue that choosing the less widespread form is a stupid thing to do. Anyway, it will probably not change so we will have to live with it. Would be great though if coders and their reviewers would use Google to check their impressive grammar skills.

chris dollin

unread,
Dec 30, 2012, 8:43:35 AM12/30/12
to Robert D., golan...@googlegroups.com
On 30 December 2012 13:25, Robert D. <robert...@gmail.com> wrote:

> You and some other posters here are totally missing the point. There is a
> big difference between writing a word in an email and writing a "word" in a
> programming language which will supposedly be used by millions of people who
> will have to put up with bad grammar.

They already do -- programming language grammar is not
natural language grammar, even though bits of it are copied
from that source.

Micro-details about consonant doubling in a preferred
(by someone) variant of English are not even in the noise.

Chris

--
Chris "allusive" Dollin

minux

unread,
Dec 30, 2012, 10:18:46 AM12/30/12
to Rodrigo Moraes, golang-nuts
On Sun, Dec 30, 2012 at 8:40 PM, Rodrigo Moraes <rodrigo...@gmail.com> wrote:
On Dec 30, 10:21 am, minux wrote:
> Go has an emphasis on small interfaces and interface composition,
> so i think this incomplete -er naming convention is actually beneficial --
> it forces us to make the interface smaller to have a nice idiomatic -er
> name.

But the convention is commonly not used, as in (funny names
followed :P):

    http://golang.org/pkg/crypto/#PrivateKey -> PrivateKeyer
this is not the same interface as we are discussing.
    http://golang.org/pkg/crypto/cipher/#Block -> Blocker
it seems you don't understand the idiom about interface naming.
quote Kyle Lemons here:
the idiom in Go for a one-function interface is funcName + "er".
note the funcName here. (e.g. Read() -> Reader, Read()+Close()->ReadCloser)
and we don't use that naming convention when an interface contains
more than 3 methods.

Johann Höchtl

unread,
Dec 30, 2012, 10:26:26 AM12/30/12
to golan...@googlegroups.com, Robert D.
<history>
early Unix had a 6 character limitation (actually 6 characters, dot, suffix 1 character). But 'create' fits within 6 characters.
</history>
 

minux

unread,
Dec 30, 2012, 10:30:07 AM12/30/12
to Robert D., golan...@googlegroups.com
You first argue that it is *incorrect*, and after given evidence that it's indeed correct, 
then you argue that it is stupid to use a less widespread form, what's you point here?

The word marhsaler is used in projects written in languages other than Go too:
You'd better file an issue for each of them to correct the "misspelling" or the
stupid naming.

bryanturley

unread,
Dec 30, 2012, 10:58:44 AM12/30/12
to golan...@googlegroups.com, Robert D.
On Sunday, December 30, 2012 9:30:07 AM UTC-6, minux wrote:

The word marhsaler is used in projects written in languages other than Go too:
You'd better file an issue for each of them to correct the "misspelling" or the
stupid naming.

I would rather see a spec for english that is as simple as the spec for go.
Or mass deprecations of english language stupidity.
I mean look at the feature creep in english alone ....

minux

unread,
Dec 30, 2012, 11:01:05 AM12/30/12
to bryanturley, golan...@googlegroups.com, Robert D.
There will be lots of exceptions (pun intended) that we Go users won't be
happy with the spec of english. 

Rodrigo Moraes

unread,
Dec 30, 2012, 11:32:06 AM12/30/12
to golang-nuts
On Dec 30, 1:18 pm, minux wrote:
> it seems you don't understand the idiom about interface naming.
> quote Kyle Lemons here:
>
> > the idiom in Go for a one-function interface is funcName + "er".

No, I do get it. Still there are several places in the standard
packages where this idiom is not followed, and several multiple-
function interfaces follow the -er idiom inconsistently, because it is
obviously not practical.

My wish -- maybe I didn't express it clearly -- was that there was a
general interface naming convention, practical and strong enough to
identify interfaces by name.

-- rodrigo

minux

unread,
Dec 30, 2012, 11:47:38 AM12/30/12
to Rodrigo Moraes, golang-nuts
This is also not practical. How can you stop people from naming an interface
arbitrarily? If you want to do that, the only way is to enforce the naming
convention at the compiler level and I'm not sure you want to do that.
Note that even a single exception will defeat the whole goal of identifying
interface by name (and no doubt, if we don't enforce the rule at compiler
level [i.e. in language spec], people will break the rule for various reasons).

Rodrigo Moraes

unread,
Dec 30, 2012, 12:01:05 PM12/30/12
to golang-nuts
On Dec 30, 2:47 pm, minux wrote:
> This is also not practical. How can you stop people from naming an interface
> arbitrarily? If you want to do that, the only way is to enforce the naming
> convention at the compiler level and I'm not sure you want to do that.
> Note that even a single exception will defeat the whole goal of identifying
> interface by name (and no doubt, if we don't enforce the rule at compiler
> level [i.e. in language spec], people will break the rule for various
> reasons).

Fair enough. I'm not suggesting that it should be forced by the
compiler, just part of the idiom. Most would follow, and of course
some would break the rule. Not everybody uses go fmt but we can say
that it has widespread usage. If we had a naming convention for
interfaces that was as accepted like go fmt is, it would be good
enough for me. :-)

-- rodrigo

Robert D.

unread,
Dec 30, 2012, 12:15:11 PM12/30/12
to golan...@googlegroups.com, Robert D.
No, in fact, you didn't show any proof of it being correct. You pointed me to some website that I cannot read without an account and I don't take that as evidence. On the other hand I gave you some plain simple grammar rules regarding this issue which do prove what I wanted to point out.
Also, if you bother to check a more realistic source, like the Oxford English Dictionary for example, you will find out to your astonishment that the suggested correct form is Marshaller.
And yes, I admitted that the Marshaler variant may also be __correct__ but you have failed to prove it. I found sparing references of it on the web and it looks like a deprecated form or something which is very seldom used. And that is why I said and will say again, it is ridiculously stupid to choose the less popular form when it is supposed to be used by many other people who might dislike your tastes in grammar?

Oh and by the way, this returns twice as many results http://code.google.com/codesearch#search/&q=Marshaller&type=cs
If you check Google you will have an even better answer.

Also you might want to reduce your level of arrogance as it totally fails to impress me.

minux

unread,
Dec 30, 2012, 12:46:47 PM12/30/12
to Robert D., golan...@googlegroups.com
On Mon, Dec 31, 2012 at 1:15 AM, Robert D. <robert...@gmail.com> wrote:
No, in fact, you didn't show any proof of it being correct. You pointed me to some website that I cannot read without an account and I don't take that as evidence. On the other hand I gave you some plain simple grammar rules regarding this issue which do prove what I wanted to point out.
ok, how about this:

also quote wikipedia: http://en.wikipedia.org/wiki/Marshalling_(computer_science) (emphasis added by me)
In computer science, marshalling (__sometimes spelled marshaling with a single l__) is the process of transforming the memory representation of an object to a data format suitable for storage or transmission, and it is typically used when data must be moved between different parts of a computer program or from one program to another [snip]

One final word: no matter how you think about it (stupid or ridiculous, you choose the word),
it simply can't be changed in the whole life of Go 1 so there is no use arguing.
Not to mention that Issue 4595 is closed as WontFix, so it's unlikely to change even in Go 2.

bryanturley

unread,
Dec 30, 2012, 9:41:56 PM12/30/12
to golan...@googlegroups.com, Robert D.

Everyone is doing it wrong

from Old French mareschal;  related to Old High German marahscalc  groom, from marah  horse + scalc  servant

bryanturley

unread,
Dec 30, 2012, 9:42:51 PM12/30/12
to golan...@googlegroups.com, Robert D.

I demand Go 2 HAS PONIES

Michael Jones

unread,
Jan 1, 2013, 10:21:44 PM1/1/13
to bryanturley, golang-nuts, Robert D.
That was no accident. That was Ken's decision. One that he continued in Go (early versions) and then decided to change.


--
 
 



--
Michael T. Jones | Chief Technology Advocate  | m...@google.com |  +1 650-335-5765

Andy Balholm

unread,
Jan 2, 2013, 12:58:47 PM1/2/13
to golan...@googlegroups.com, Robert D.
On Sunday, December 30, 2012 3:18:51 AM UTC-8, DisposaBoy wrote:
Sir, please don't try to make the language into a language-nazi-ghetto. It's ridiculous that you should be arguing about such trivial matter especially when Marshaler is a perfectly fine word. I also find it somewhat ironic that someone as holy as yourself doesn't knows how to spell the word "spelt".

The mention of "spelt" tipped me off: Robert uses British English, some of the others in this thread use American English. One of the differences between the two is that American English doesn't double final consonants when adding suffixes as often as British English does. For example, we write "traveler" and the Brits write "traveller".

So the Marshaler interface is named in American English. This is consistent with the name of the image/color (not colour) package.
Reply all
Reply to author
Forward
0 new messages