ponylang / pony-tutorial

:horse: Tutorial for the Pony programming language
http://tutorial.ponylang.io
BSD 2-Clause "Simplified" License
310 stars 111 forks source link

Exceptions lack examples #292

Open rodrigob opened 6 years ago

rodrigob commented 6 years ago

In https://github.com/ponylang/pony-tutorial/blob/9cfbb3ee7e3e8adbc7b8d914ff440f9482ae8bea/expressions/exceptions.md#comparison-to-exceptions-in-other-languages

the pony exceptions are compared to other languages. It is argued that not having error types or instances is better. It would be great to point to some code examples for commonly used idioms regarding usage of the error feature.

In particular, if my try-else block can fail in two different ways, what is the recommended way to handle this inside the else ? (splitting the try-else in two ? nesting ?)

I think "no exceptions" or "no exception values" tends to be as controversial as "no generics" (like Go did). So best to provide concrete "real world" examples.

jemc commented 6 years ago

This is definitely a controversial point, and I agree the docs could/should be expanded so we can make our case.

rhagenson commented 3 years ago

Someone could reasonably review how error is used in the stdlib for this issue. I am willing to work with someone on reducing observations in stdlib down to idioms which can be presented as readily understood examples.