Hacker News new | ask | show | jobs
by ghayes 4565 days ago
I'm new to this syntax too, but I believe it's just a reference to the function `SayHello` as defined on the `Context*` type. That is, if you have:

    func FuncA() { } // normal function
    func (int) FuncB() { } // function on an int object
You could later reference those functions via:

   var func1 := FuncA // assign FuncA into func1 var
   var func2 := (int).FuncB // assign FuncB into func2 var
But again, I'm just piecing that together from context and haven't looked at the spec.
2 comments

So you're (ab?)using this to peg middleware functions on the context object? Why do it like that?
I was missing that piece, but how is func2 called? I'm still looking through the code, but if both func2 and a int_variable are interface{}, how does the compiler check these types (or is the "framework" using some reflection?)