3 ms·
> Error handling: language specification has no mention of word "error" Errors can still be handled even without explicit provisions in the language; some lang
by Rochus 5y ago
> Error handling: language specification has no mention of word "error"
Errors can still be handled even without explicit provisions in the language; some languages offer exceptions; in my 30 years of C++ I actually use them very rarely; Wirth decided against such in Oberon and I followed him in this respect. It's always a delicate consideration which elements should be part of the language or part of the library; from my point of view topics like threads or exceptions can be covered well via library. Oberon is supposed to be "as simple as possible". Here is some rationale: https://oberon-lang.github.io/2021/07/16/motivation-for-a-new-oberon-version.html https://oberon-lang.github.io/2021/07/16/motivation-for-a-ne....
> Oberon+ has garbage collection! Nice!
The predecessor language Oberon has a garbage collector since 1987 (see https://doi.org/10.3929/ethz-a-005363226 https://doi.org/10.3929/ethz-a-005363226). Oberon+ is just an extension of it (with selected new features to keep it as simple as possible while being nevertheless useful - at leat from my point of view).
- theamk 5y ago> Errors can still be handled even without explicit provisions in the language Sure! but as I said in the last sentence of my post, "error handling is as much user convention as is compiler support" In particular, almost all C code I have seen is designed to handle errors gracefully -- every stdlib function may fail and user is expected to handle it. On the other hand, much of the oberon code I have seen before is pretty bad with error handling -- the program will just halt on any error. Now, I cannot really tell which way Oberon+ will go because there is so little code written in it, and it seems there isn't even a way to open a file as of now. But I browsed around and found JSON parser in Oberon+ and it handles errors by calling halt()... so it does not look like this version has good error handling (yet?)
- Rochus 5y agoThere are similar possibilities for error handling as in C. The definition and implementation of the Oberon+ standard library is work in progress. Also the Blackbox framework, of which I already migrated a lot of modules, has some interesting approaches which I study. The Json parser you mention is part of the Are-we-fast-yet benchmark suite which apparently doesn't need much error handling. EDIT: Btw. there are quite some notable C libraries which for certain error conditions just call a panic function or print a message to stderr and then call exit().