Skip to content
Tcl Source Code View Ticket
Login

View Ticket

New post-test loops: do ... while/until ...

Closed / Rejected3530185fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2012-05-28 06:58:17
It is easy to construct a post-test loop on the ground of while:
while {TEST} {...}; --> while 1 {...; if {!TEST} {break}};
But it would be nice if we could use explicit post-test loops.
ferrieuxplain2012-05-28 18:46:18
Orthogonality is an important principle behind carefully designed languages like Tcl. Bloating the core language for something which is so easily emulated in script is a bad idea. If you want a language where dozens of ways exist to do the same thing, all supported by specific built-in syntaxes, there are several options on the market...
dkfplain2012-05-28 19:11:45
See [control::do] in the control package of Tcllib, and explain why it needs to be in the Tcl core itself...

http://tcllib.sourceforge.net/doc/control.html
twyliteplain2012-05-28 19:12:43
A construct equivalent to the described post-test loop can be implemented in Tcl using [uplevel].  See for example [control::do] in http://tcllib.sourceforge.net/doc/control.html.
Log in (anonymous is fine) to add a comment.