FAQ
there is no need to declare that one type have implement one one interface.
but problems comes, If I need to call one function and its argument is a
interface. then how can i quickly find the types that can be passed as
argument for the function.

--
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/groups/opt_out.

Search Discussions

  • David DENG at Jul 5, 2013 at 5:40 am
    Maybe only documents help. Even if you can find a type, without documents,
    you can use it either.

    David
    On Friday, July 5, 2013 1:18:25 PM UTC+8, wan...@126.com wrote:

    there is no need to declare that one type have implement one one
    interface. but problems comes, If I need to call one function and its
    argument is a interface. then how can i quickly find the types that can be
    passed as argument for the function.
    --
    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/groups/opt_out.
  • Wan_jm at Jul 5, 2013 at 5:51 am
    but it seems the golang document doesn't give such information!
    if there is only code without documents, what shall developer do? "try to
    guess one type, and then check whether it has implement the specific
    interface, if not guess again?" it is boring and time consuming!


    在 2013年7月5日星期五UTC+8下午1时40分44秒,David DENG写道:
    Maybe only documents help. Even if you can find a type, without documents,
    you can use it either.

    David
    On Friday, July 5, 2013 1:18:25 PM UTC+8, wan...@126.com wrote:

    there is no need to declare that one type have implement one one
    interface. but problems comes, If I need to call one function and its
    argument is a interface. then how can i quickly find the types that can be
    passed as argument for the function.
    --
    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/groups/opt_out.
  • Andrey mirtchovski at Jul 5, 2013 at 5:56 am
    it is boring and time consuming!
    http://golang.org/doc/effective_go.html#blank_implements

    --
    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/groups/opt_out.
  • Wan_jm at Jul 5, 2013 at 8:46 am
    the effect go page tells how to dynamic check; but what I ask is not this.

    for example I want to call a function " func hello(a oneInterface)";
      currently I know it need one type that implement oneInterface, but I don't
    know what type I need to pass to hello; for there is no need to declare
    explicitly implement;
    is there a convenient <http://dict.cn/convenient> way to list all the type
    that inplement the oneInterface, then I can chose from the list to get the
    right type to pass to hello.

    if every type need to checked by reading code that whether the type have
    implement all the function oneInterface declear which is reallly time
    consuming.

    在 2013年7月5日星期五UTC+8下午1时56分30秒,andrey mirtchovski写道:
    --
    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/groups/opt_out.
  • Chris dollin at Jul 5, 2013 at 11:14 am

    On 5 July 2013 09:46, wrote:

    the effect go page tells how to dynamic check; but what I ask is not this.

    for example I want to call a function " func hello(a oneInterface)";
    currently I know it need one type that implement oneInterface, but I don't
    know what type I need to pass to hello; for there is no need to declare
    explicitly implement;
    If you want to call a function, you presumably know what it does,
    and what it wants to do it to. Whatever that thing is, it should have
    (or be given) the appropriate type. You don't just flail around looking
    for something of the interface type -- you want to pass some specific
    thing, being of the right type isn't sufficient.

    if every type need to checked by reading code that whether the type have
    implement all the function oneInterface declear which is reallly time
    consuming.
    If the code compiles, then you don't have to check if something
    is of the right (static) type -- it is.

    Maybe you could explain how you're doing your design/coding?
    Because trying to find things that have the right type to be used
    as arguments isn't something I have needed to do (much) when
    coding in Go -- usuauly I /have/ the right things and it's just a
    question of, if necessary, making them fit the interface.

    Chris

    --
    Chris "allusive" Dollin

    --
    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/groups/opt_out.
  • Jesse McNelis at Jul 5, 2013 at 5:50 am

    On Fri, Jul 5, 2013 at 3:18 PM, wrote:

    there is no need to declare that one type have implement one one
    interface. but problems comes, If I need to call one function and its
    argument is a interface. then how can i quickly find the types that can be
    passed as argument for the function.

    https://github.com/dominikh/implements

    --
    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/groups/opt_out.
  • Wan_jm at Jul 5, 2013 at 8:48 am
    thanks, it seems what i need.

    在 2013年7月5日星期五UTC+8下午1时50分27秒,Jesse McNelis写道:
    On Fri, Jul 5, 2013 at 3:18 PM, <wan...@126.com <javascript:>> wrote:

    there is no need to declare that one type have implement one one
    interface. but problems comes, If I need to call one function and its
    argument is a interface. then how can i quickly find the types that can be
    passed as argument for the function.

    https://github.com/dominikh/implements
    --
    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/groups/opt_out.
  • Dan Kortschak at Jul 5, 2013 at 8:53 am
    This question sort of misses the point of Go interfaces though. You don't need to be able to search a list of types that satisfy the required interface, you just need something that satisfies the required interface and is something that you want to pass to the function; if you can't find it or it doesn't exist, just define a type that satisfies the interface and wrap your base type in that.

    On 05/07/2013, at 6:19 PM, "wan_jm@126.com " wrote:

    thanks, it seems what i need.

    在 2013年7月5日星期五UTC+8下午1时50分27秒,Jesse McNelis写道:
    On Fri, Jul 5, 2013 at 3:18 PM, wrote:
    there is no need to declare that one type have implement one one interface. but problems comes, If I need to call one function and its argument is a interface. then how can i quickly find the types that can be passed as argument for the function.

    https://github.com/dominikh/implements


    --
    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/groups/opt_out.


    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 5, '13 at 5:18a
activeJul 5, '13 at 11:14a
posts9
users6
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase