So, for what it's worth: 

https://karthikkaranth.me/blog/functions-implementing-interfaces-in-go/

Otherwise, yeah. I'd love to be able to define interfaces with extra 
methods for implementors, but if you arrange your code around "traits", 
microstructs intended to present a possibly unergonomic API, intended to be 
implemented by the embedding struct. An example of this behavior working 
well is actually the io.Reader/io.Writer objects. It's not a terribly 
ergonomic API, but it can be incredibly flexible for implementations.
On Monday, April 4, 2022 at 6:08:36 PM UTC-5 Simon Archer wrote:

> I think that playground is broken.
>
>
>
>
>
> *./prog.go:22:9: undefined: translatableImpl./prog.go:27:11: undefined: 
> translatableImplGo build failed.*
>
> I fixed it like this:
>    https://go.dev/play/p/vZlwZIe9Ras
>
> On Monday, April 4, 2022 at 1:27:46 PM UTC-4 Ron Green wrote:
>
>> in case anyone get's here and is confused...
>>
>> you can wrap the additional functionality in the struct and use the 
>> interfaces from before
>>
>> https://go.dev/play/p/e8aS0PZC6Zh
>>
>> On Monday, February 2, 2015 at 2:55:30 PM UTC+2 oju...@gmail.com wrote:
>>
>>> The code start to get smart when you combine interfaces.
>>>
>>> https://play.golang.org/p/axyl9FPS1e
>>>
>>> Whenever you can, forget the actual types. Code for interfaces instead.
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3f8605ac-a36d-4caa-aa4a-69cc5a81b8e0n%40googlegroups.com.

Reply via email to