FAQ
Hi,

is it possible to export a function taking a function as argument, using
gomobile bind?
Something like this

type Handler func(string) string

func SetHandler(h Handler) {
     h("hello")
}

Thanks

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

  • Nigel Tao at Feb 25, 2016 at 12:00 am
    I'd ask Hana (CC'ed).

    On Wed, Feb 24, 2016 at 6:42 PM, Anirban Gupta wrote:
    is it possible to export a function taking a function as argument, using
    gomobile bind?
    Something like this

    type Handler func(string) string

    func SetHandler(h Handler) {
    h("hello")
    }
    --
    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.
  • Hyang-Ah Hana Kim at Feb 25, 2016 at 1:34 am
    Function type arguments are not supported yet. Possible workaround is to
    utilize interface types.

    type Handler interface {
        Handle(string) string
    }

    func SetHandler(h Handler) {
        h.Handle("hello")
    }
    On Thu, Feb 25, 2016 at 8:59 AM, Nigel Tao wrote:

    I'd ask Hana (CC'ed).

    On Wed, Feb 24, 2016 at 6:42 PM, Anirban Gupta wrote:
    is it possible to export a function taking a function as argument, using
    gomobile bind?
    Something like this

    type Handler func(string) string

    func SetHandler(h Handler) {
    h("hello")
    }


    --
    __

    --
    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
postedFeb 24, '16 at 7:42a
activeFeb 25, '16 at 1:34a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase