Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> control transfer can be hijacked.

But useful. Similar to Go's "defer".



Go's "defer" can't prevent return from actually returning from the function. Most of the time, it can't change the computed return value either, unless you go out of your way and use named return values. Go's "defer" also can't do crimes with "break" and "continue".

So Go's "defer" has more "and also do some things on the way out" semantics than "you suddenly forget why you were going to leave the kitchen, so you don't".




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

Search: