> > > I don't believe this is helpful to the questioner who was simply > explaining their understanding. > > A reference to cargo cults is useful insofar one should study why something happens rather than copying a hearsay. On the other hand, it doesn't give you much tooling: you can't solve the problem just by knowing you might have run into the cargo cult trap---which we all do from time to time.
The problem really has to do with how different programming languages handle variable scopes and how their implementations implement those scoping rules. Ian already answered the gist: Go handles the liveness of the variables well and you don't need to hint it, usually. As for PHP, the story is likely more complex and also relates to the PHP system you are using, what mode you are running PHP in, what configuration you chose and so on. It is one of those languages I've selectively avoided when I could[0], so I'm afraid I can't be of much help in explaining its inner workings. [0] This list also includes C++, Java, C#, and Javascript. YMMV :) -- 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. For more options, visit https://groups.google.com/d/optout.