--
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?
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
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 stringconst (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--
--
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".
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.
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
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.
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.
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". :-)
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.RobertSir, 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".
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 examplethat says marshaler is accepted on the issue tracker.
On Dec 30, 10:21 am, minux wrote:But the convention is commonly not used, as in (funny names
> 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.
followed :P):
http://golang.org/pkg/crypto/#PrivateKey -> PrivateKeyer
http://golang.org/pkg/crypto/cipher/#Block -> Blocker
the idiom in Go for a one-function interface is funcName + "er".
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 thestupid naming.
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.
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]
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".