tendermint / coding

14 stars 10 forks source link

Fn suffix #59

Closed ebuchman closed 6 years ago

cwgoes commented 6 years ago

I think this is nice, although what about making it a prefix instead? Faster to scan down the left side of a file looking for higher-order functions.

MyComplexAccountHandlerFn vs FnMyComplexAccountHandler

ebuchman commented 6 years ago

Prefixes are good when you have a list of things to scan, but I think that's less likely here. I find the Fn on functions more useful for reminding me that its a function when its being used. Also it seems to be more standard in Go libs eg. from our vendor:

vendor/golang.org/x/net/http2/configure_transport.go
34: upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper {
50:         "h2": upgradeFn,
53:     m["h2"] = upgradeFn

vendor/golang.org/x/net/http2/pipe.go
23: readFn   func()        // optional code to run in Read before error