News for hackers. Stuff that matters.
Re:Go's power is in emergent behavior by md224 on Sunday April 27, 2014 @05:52AM (#7654526)
Yeah, it looks like their solution is just creating a function object whose interface-required method calls the object itself (or at least that's my OOP-centric interpretation). You could do something like that in Javascript (minus the interface, obviously):

    var f = function(){ console.log('called'); };
    f.callMe = function(){ this(); };
I wonder if this is a useful pattern in JS. Can't recall ever seeing it in practice.
Re:Go's power is in emergent behavior by NateDad on Sunday April 27, 2014 @07:36AM (#7654728)
It's useful in go, because it means you can trivially turn a bare function into a type that fulfills an interface, which makes your function more flexible - it can easily take either a type with a method or just a method.