FAQ
Hello,
According to Russ Cox's post (http://research.swtch.com/interfaces), there
are two camps for managing Interface Values:
1 - C++ and Java: tables for all method calls statically
2 - Smalltalk and its many imitators: a method lookup at each call


According to this post, Golang take halfway between these two camps, that
is method tables computes at run time.
The advantage of this uncommon method compared to 2nd (i.e. method lookup
at each call like Smalltalk and its many imitators) is pretty clear to me
(on performance on each call because there is no method lookup).

But, I don't see advantage of this uncommon method compared to 1st (i.e.
method tables for all method calls statically like C++ and Java).
Could you list some advantages if exist?


Thank in advance
Best
Jérôme

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jan Mercl at Aug 28, 2015 at 5:46 pm
    On Fri, Aug 28, 2015, 19:21 Jérôme LAFORGE wrote:


    Could you list some advantages if exist?



    Precomputing optimal, ie. minimal required vtables, in Go, equals solving
    the halting problem.

    Computing the suboptimal, worst case, ie. maximal possible vtables, in Go,
    requires whole program information, ie. it's not, in the general case,
    feasible at compile time.

    The reason for both of the above is that, in Go, interfaces are satisfied
    implicitly, so there's no direct mapping between a method set of a type and
    the intended interface(s) it, because will be eventually used as such,
    implements.


    --

    -j

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 28, '15 at 5:21p
activeAug 28, '15 at 5:46p
posts2
users2
websitegolang.org

2 users in discussion

Jan Mercl: 1 post Jérôme LAFORGE: 1 post

People

Translate

site design / logo © 2021 Grokbase