FAQ
I now that an interface is composed of two worlds ( one point to the itable
and the scond point to the actual value ) . so why we can't simply have the
value of the second pointer (to pointer that point to the actual data)

--
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

  • Ian Lance Taylor at Aug 30, 2015 at 6:14 pm

    On Sat, Aug 29, 2015 at 9:22 AM, WALID BELRHALMIA wrote:
    I now that an interface is composed of two worlds ( one point to the itable
    and the scond point to the actual value ) . so why we can't simply have the
    value of the second pointer (to pointer that point to the actual data)
    What would that mean in practice?

    Note that while the second word of an interface is now always a
    pointer, it's not always a pointer to the value stored in the
    interface; if the value stored in the interface is itself a pointer
    (including a map or a channel) then the pointer itself is stored in
    the interface.

    Ian

    --
    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.
  • Matt Harden at Aug 30, 2015 at 8:33 pm
    If you want to be able to get a pointer back out of the interface, just
    store a pointer in it to begin with.

    http://play.golang.org/p/4EfYTClHVg

    Being able to retrieve a pointer from an interface would be a breaking
    change from the current language specification, and if you must, you can
    already do this using unsafe, knowing the underlying representation of an
    interface. Also other compliant implementations of Go could implement
    interfaces the way gc did before, or could have their own completely
    different implementations that might not include a pointer to the value.
    On Sun, Aug 30, 2015 at 1:14 PM Ian Lance Taylor wrote:
    On Sat, Aug 29, 2015 at 9:22 AM, WALID BELRHALMIA wrote:
    I now that an interface is composed of two worlds ( one point to the itable
    and the scond point to the actual value ) . so why we can't simply have the
    value of the second pointer (to pointer that point to the actual data)
    What would that mean in practice?

    Note that while the second word of an interface is now always a
    pointer, it's not always a pointer to the value stored in the
    interface; if the value stored in the interface is itself a pointer
    (including a map or a channel) then the pointer itself is stored in
    the interface.

    Ian

    --
    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.
    --
    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 30, '15 at 5:37p
activeAug 30, '15 at 8:33p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase