Am Mittwoch, 16. Januar 2019 15:42:38 UTC+1 schrieb Victor Giordano: > > Hello all! > I don't know very well what is the topic about using "er" or "able" or any > other suffix for the single method interfaces (a.k.a. "funcitonal > interfaces"), but i would like to address some thoughts, hope you can bear > with me, here we go: > > If a take a look to the Readable interface in Java and the io.Reader > interface in Golang, i would say the these "two" persons (assuming that > they actually were different persons) were thinking in the same thing (i > mean, an object to which you can send it a message [or invoke method] to > read bytes or chars, let's bear with me here and let's aggree that both > interfaces as abstractions has the same intend) but use different naming, > right >
The approach with "er" in Go (Stringer, etc.) seems to me to be the result of a function-oriented attitude (function = procedure, not functional programming) whereas in Java an object-oriented attitude is applied where classes and interface are nouns (because classes and interfaces define functions they contain, but they are not standalone functions. In Go, unlike Java, you can define free functions, e.g. methods that are not defined inside some container like a class or a module. This is a general attitude in system programming to use member functions as well as free functions. I don't know why since I'm application developer with too little experience in system programming. You can also see this when looking at programming languages that are geared towards system programming like D, Rust, C++. So when you define an interface for something that in the end will be backed by a single free function, rather than a collection of functions, it leads to a naming style with "er" which denotes a verb rather than a nound. -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.