Feb 2009 -- Due to time pressures, the ongoing development of 'rope' has been suspended temporarily.

ROPE Language Reference - "eval"

The "eval" action executes a block, and "catches" and returns it's exit status. The synax is one of..

eval( { block } )
{ block } eval

Possible returned statuses are..

Note that the capitalised words OKAY, FAIL, YES and NO are treated by the compiler as integer constants, and can be used directly in scripts to have the meanings described above. For example..

println( YES " - " NO )

prints: "2 - 3"

Example 1 - Failure

The following script will abort with a "EDivideByZero" error..

put( 20 $b )
put( 0 $z )
println( $b $z div )

However, the following script does not abort, but simply prints the number 0 (meaning FAIL).

eval({
  put( 20 $b )
  put( 0 $z )
  println( $b $z div )
}) println

Example 2 - No

The following script exits, returning a "no" status for non-HTTP transfers

put( $data_start $offset )
expect_str( "GET /" )

By using the "eval" action, we can capture the "no" return rather than aborting, and then carry on executing..

eval({
     put( $data_start $offset )
     expect_str( "GET /" )
}) $s put

ifelse( eq( $s NO ) )  {
     println( "Not an HTTP transfer" )
} {
     println( "HTTP transfer detected" )
})

History

The "eval" action was added to Rope in the 20051212 release.