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

I like having a few different loops to keep code more readable. I think there should be two at a minimum for whether the condition is before or after the looped code.

I agree with the rest, but the rest of the language is great.



> I like having a few different loops to keep code more readable.

When they have similar semantics, and are not arbitrarily designed.

In Oberon:

- while has an elseif statement. Repeat is a do/while, doesn't have an elseif statement

- loop is allowed an exit. No other loops are allowed to terminate early. And that is literally the only reason loop exists

etc.


The last point is very likely by design: Only when you see a LOOP do you have to worry about early exits. For the other, more common constructs, you instantly know there won’t be an exit somewhere in the middle, and you can reason about its termination behavior solely based on the loop conditional.


It's not by design, not really.

Early Pascal/Modula/Oberons were extremely anal about loops (of any kind) never having any early exits, ever.

Then they ran into the real world.

So each consecutive version of Oberon either added early returns or removed early returns. Sometimes like clockwork. And also added/removed other types of loops in pursuit of some unspecified ideal of simplicity.

You can see part of that history in the overview of differences: https://oberon-lang.github.io/2021/07/16/comparing-oberon+-w...

So it's a self-imposed constraint that makes very little sense.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: