3 ms·
In a sense, raise/except is a goto. Go-lang decided against exceptions in part because they are equivalent to gotos.
by xapata 8y ago
In a sense, raise/except is a goto.
Go-lang decided against exceptions in part because they are equivalent to gotos.
- zephyrfalcon 8y agoBut Go does have a goto statement...?
- Vendan 8y agoAnd like many languages that do, it's an extreme code smell to use it, whereas most(if not all?) languages that have exceptions recommend to use them. Though technically, Go does have exceptions (under the name "panic"), just not a very easy to use "try/catch" block (the "try/catch" stuff is function level, so you have to do anonymous functions to "emulate" other language's try/catch). Also, Go's goto has restrictions.
- SamReidHughes 8y agoIt's not really a code smell. They just don't let newbies use it in CS 101 because they want them to think in a structured manner about loops and such.
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]