FAQ
Changed subject.
On Friday, September 28, 2012, Rémy Oudompheng wrote:

I'm not particularly interested in the
function-as-a-single-method-interface stuff, but if this was to ever
happen, I'd like it be mandatorily qualified. Like:

type Handler interface { Handle(...) }

h := Handler{Handle: handleFunction}

That ensures that code is broken whenever the interface changes
semantics and method names while keeping the signature.
I think this syntax is overly verbose, and will render it harder to use
than the current approach of defining a method on the func type.

IMHO, it is just unreasonable to change semantic or method names
of an interface without also changing the name of the interface itself.
(think it this way: if I change the semantic of a package function without
changing its name or signature, then I'm surely bringing trouble for the
user of this package)

Search Discussions

  • Daniel Morsing at Sep 27, 2012 at 5:44 pm
    For the http package, this feature is kind of appealing.

    You guys may have won me over. My main objection is that it makes
    extending interfaces more difficult, but I will admit that might not
    be a problem in practice. I still worry that there may be subtle
    social differences between the uses of the otherwise technically
    features. However, if they exist, I'm not seeing them at the moment.

    As for the reflection details, I think the interface will have to
    contain a closure type. A closure doesn't keep any type information,
    so the closure type is the only reasonable type we can infer.
  • Minux at Sep 28, 2012 at 7:49 am

    On Friday, September 28, 2012, Rémy Oudompheng wrote:

    I'm not particularly interested in the
    function-as-a-single-method-interface stuff, but if this was to ever
    happen, I'd like it be mandatorily qualified. Like:

    type Handler interface { Handle(...) }

    h := Handler{Handle: handleFunction}
    If we support this syntax, will we support this?
    io.ReadWriter{ Read: readFunc, Write: writeFunc }

    frankly, i don't know how to properly support this, but
    if we use 'Handler{Handle: handleFunc}' syntax, i assume people will
    ask for this.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 27, '12 at 5:16p
activeSep 28, '12 at 7:49a
posts3
users2
websitegolang.org

2 users in discussion

Minux: 2 posts Daniel Morsing: 1 post

People

Translate

site design / logo © 2022 Grokbase