You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2002/10/08 09:31:54 UTC

parse command oops

Woops - we need to fix this one:

a.rvt:
<?
puts a<p>
flush stdout
parse b.rvt
?>

b.rvt:
<?
puts b<p>
flush stdout
parse a.rvt
?>

The script eventually fails with this odd error:

Rivet ErrorScript failed!

unknown namespace "::request" in namespace delete command
    while executing
"namespace delete ::request 

Hrm...
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: parse command oops

Posted by "David N. Welton" <da...@dedasys.com>.
Wojciech Kocjan <wo...@kocjan.org> writes:

> David N. Welton wrote:
> > The script eventually fails with this odd error:
> > Rivet ErrorScript failed!
> > unknown namespace "::request" in namespace delete command
> >     while executing
> > "namespace delete ::request Hrm...

> The error seems correct. Tcl has a recursion limit.

Sure, but it should get the 'too many nested calls' error.  I guess
what happens is that trying to call the error_handler command requires
an Eval, and it's already maxed out, so... blam.

puts b<p>
flush stdout
if { [catch {parse a.rvt} err] } {
    puts $err
    puts $errorInfo
}

works better, although errorInfo doesn't contain the 'correct'
information, like it does if you use 'source'.

I'm relieved, at least, that there's nothing wrong with the C stack.
 
> () 49 % namespace eval a {proc a {} {a::a}; a::a}
> too many nested calls to Tcl_EvalObj (infinite loop?)

Sure, you get the same thing when two files source eachother, too.

> Something probable may be that in complex situations like parsing
> a.rvt and b.rvt in a loop can time out the browser, so the error is
> not sent.

> You could put a recursion limit in the parse command... It shouldn't
> be set too high, since recursive template parsing is a very rare
> method. Perhaps 32 will do.

Hrm... I'd really rather get Tcl to handle it cleanly on its own, but
it's not going to handle another Tcl_Eval, I guess.
 
> In Tcl, we have 'source' (and package require - but it's the same >
:-), so scripts can be loaded without using the Rivet parser.

source works just fine, and fails as it should.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: parse command oops

Posted by Wojciech Kocjan <wo...@kocjan.org>.
David N. Welton wrote:
> The script eventually fails with this odd error:
> 
> Rivet ErrorScript failed!
> 
> unknown namespace "::request" in namespace delete command
>     while executing
> "namespace delete ::request 
> 
> Hrm...

The error seems correct. Tcl has a recursion limit.

() 49 % namespace eval a {proc a {} {a::a}; a::a}
too many nested calls to Tcl_EvalObj (infinite loop?)

Something probable may be that in complex situations like parsing a.rvt 
and b.rvt in a loop can time out the browser, so the error is not sent.

You could put a recursion limit in the parse command... It shouldn't be 
set too high, since recursive template parsing is a very rare method. 
Perhaps 32 will do.

In Tcl, we have 'source' (and package require - but it's the same :-), 
so scripts can be loaded without using the Rivet parser.

-- 
WK
(written at Stardate 56769.7)

"Data typing is an illusion. Everything is a sequence of bytes."
                                                              -Todd Coram



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org