On Friday, March 5, 2021 at 8:20:36 AM UTC-7 Brian Candler wrote:

> There is a flip side to that: if you add the return statements, then 
> ForLoop1() gives an error due to unreachable code!
> https://play.golang.org/p/0bajnJWTz7U
>
> So you can't win either way.  I think this implies that if the behaviour 
> were changed now, it would break the go compatibility promise.
>

The Go developers might want to comment on this, but my interpretation of 
the Go compatibility promise is that working programs won't break, not that 
programs that fail to compile will suddenly compile.  So I think we're safe 
there.

I don't know if it makes any difference, but the "unreachable code" 
complaint is coming from go vet, not the compiler proper.

Still, you make an interesting observation.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a2f2a9b8-cdc6-48d2-9cfe-7204d219255dn%40googlegroups.com.

Reply via email to