lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 2-Nov-06, at 11:32 AM, Sam Roberts wrote:

Breaking out of multiple nested loops is useful!

  Knuth - Structured Programming with Goto Statments:

  http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf


Nothing like a quick visit to the time machine to get your perspective :)

Interesting rereading that article, though, after all these years. It struck me forcibly that some ideas tend to re-emerge subliminally, although they are often once again repressed.

The loop ... while condition; ... repeat; syntax suggested by Knuth on pages 279-280 of that article is pretty similar to (a subset of) the syntax suggested by Shivers in the paper I referenced in my post last year on the subject, and is almost precisely the implementation I provided in the patch which Karel refers to. Here I'm referring to the loop primitives, not the labelled break/continue statements, which I never particularly liked.

Knuth's comment:

"at first these may seem strange, but probably less strange than the while and repeat statements did when we first learned them" (p. 280)

seems to underestimate the reaction to the construct by people who have already learned while and repeate statements; certainly, aside from sporadic attempts to revive the idea, I know of no mainstream language which actually implements the construct, despite Knuth's judgement at the bottom of the left hand column on page 280. I presume that most programmers don't get beyond the first impression. :)