Re: What if you lost 'if ' !!
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: What if you lost 'if ' !!

From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date: Thu Dec 01 2005 - 09:52:00 CET

Ulrich Schöbel <ulrich@outvert.com> wrote:
> Hi Andreas,
> I just tried in a tclsh (8.4.6):
> % proc x {} {
> return -code break
> }

"x" is now *exactly* equivalent to "break"

> % proc y {} {
> for {set i 0} {i<9} {incr i} {
> puts $i
> x
> }
> }

on my tclsh8.4 it complained:
'syntax error in expression "i<9": variable references require preceding $'
after fixing that typo (making it {$i<9}), it behaved as expected, by
writing just "0" and nothing more.

> % y
> 0
> 1
> 2
> 3
> 4
> %
> What's wrong with it???

Either a severe bug in that particular version,
or a typo either here or where you tried it (apart from "i<9")
or: proc x {} {upvar i i; if {$i==4} {return -code break} }
or a boldly forged result.

PS: I don't see any connection to the thread, except that
  it uses "return -code break" (in a different context)
Received on Sat Dec 3 03:28:28 2005