Hi Jason.

Yes, you are right. In context of go it will be the absence of subclassing. 
Thank you for clarification.

Regards.

пятница, 14 ноября 2025 г. в 20:58:56 UTC+3, Jason E. Aten: 

> Dear Alex (alex-coder), 
>
> Here is an easy rule to remember. There is one, and only one, 
> way to get dynamic dispatch in Go. That is: calling through an interface.
>
> Your example is using embedding, not calling through an interface, so it 
> is not relevant to
> how dynamic dispatch works. 
>
> You have guessed that Go works like other languages,
> and unfortunately your guess was wrong, and this has led you to the wrong 
> conclusion.
>
> Embedding will automatically generate methods from the embedded type on the
> outer type, but it will not give dynamic dispatch. 
>
> As above, the rule to remember is that _only_ calling-through-an-interface 
> variable gives 
> dynamic dispatch in Go.
>
> A simple demonstration:
>
> https://go.dev/play/p/WzhwvLB9VEY
>
> Now that is understood, my recommendation is that you should 
> usually still avoid interfaces for as long as possible, until you
> absolutely must deploy them, because interfaces 
> make it harder to debug your program, and can be slower.
>
> best wishes,
> Jason
>
> p.s. See also https://github.com/glycerine/thinkgo for other hints.
>
> On Friday, November 14, 2025 at 5:33:11 PM UTC alex-coder wrote:
>
> пятница, 14 ноября 2025 г. в 20:27:55 UTC+3, alex-coder: 
>
> Hi, Brain.
>
> the sample is there:  Go Playground - The Go Programming Language 
> <https://go.dev/play/p/PxUhKHgnfc0>
>
> Regards.
>
> пятница, 14 ноября 2025 г. в 16:37:54 UTC+3, Brian Candler: 
>
> On Friday, 14 November 2025 at 12:13:09 UTC alex-coder wrote:
>
> Due to absence in GO dynamic dispatching
>
>
> Not sure what you mean? Method calls on interface values are dynamic 
> dispatching.
>
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/f2155d50-9c27-4952-bfb2-23e366548d85n%40googlegroups.com.

Reply via email to