Sean Hoffman
Jun 29, 2022

--

I can get on board with everything except the shorthand lambda complaints. I personally prefer this:

inlineCode := func( x,y int ) int {

}

.

.

.

result := inlineCode(1,2)

than this:

(x, y) => (x+y).

The latter brings up multiple questions in my mind about scope and clarity:

1. Where is the return result being defined?

2.Is (x+y) being executed or simply defined? What if I want to use it later on in the function?

3. How are other local variables being captured (or not being captured)

4. Can (x+y) be more than one line?

--

--

Sean Hoffman
Sean Hoffman

Written by Sean Hoffman

Software Developer (C++, C#, Go, others), Husband, Father. I eat fried potatoes annually on July 14th.

Responses (2)