Hacker News new | past | comments | ask | show | jobs | submit login

I'm sorry, but I don't see how that answers my question. Oberon-07 has real FOR loops over arrays, so it doesn't need sentinel values. My question was about an idiom like:

  WHILE True DO
    (* Stuff.  *)
    IF someCondition THEN
      EXIT;
    END;
    (* More stuff.  *)
  END;



My guess is that Wirth's approach would be to avoid having too much logic in a loop (if really necessary, break it into separate procedures) and if needed to do something like

    WHILE ~someCondition DO
      (* Stuff *)
      IF ~someCondition THEN
        (* More stuff *)
      END;
    END;
In general from a quick look at the projectoberon.com source code (which is largely written by Wirth) the vast majority of WHILE and REPEAT uses seem to be less than 4 lines long.


I answered for a sub space of all the possible problems that can be solved with LOOP and EXIT which lend themselves to a much better structured approach.

Also, you were jumping to FOR loops over arrays. But instead the sentinel values are much better suited for linked lists.

What a programming language allows shapes how you program in it. The Sapir-Whorf Hypothesis is probably much more true with programming languages than natural languages.

One of Wirth's mantras is "don't show me your code, show me your data structures and I'll immediately know if your code is any good".

There are certainly moments when I would like to have certain programming constructs. But then I have to solve the problem in another way.

But this happens in a lot of languages. Be it C, Ruby, Javascript, or Oberon (whatever version).




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

Search: