Hacker News new | past | comments | ask | show | jobs | submit login

> Why not just declare a record in scope and return that? Why rely on a sneaky little piece of syntax tucked away in the return value? Aren't gophers supposed to be all about a regular language with few surprises?

It's not a sneaky piece of syntax, in fact it is required to use that syntax if you want to reference or modify the return value of a function in a deferred function call.

I don't like the syntax and hate that Go forces you to use it in the above case, but it's definitely not sneaky syntax. Any regular Go developer should be expected to know about this construct.




If you have long function and the addition of a single character up top at the right changes the behavior of the return keyword?

I've hated this feature since I learned about it. Its existence is one of the many reasons I dismiss arguments about Go being easy to read.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: