On Tuesday, November 23, 2004, at 11:19 AM, Stevan Little wrote:
Maybe you need 2 types of pre-conditions? One for guarding ensure and another for guarding the entire step.
Yes, it seems like the discussion has elicited cases both for pre/post-conditions that are checked every time, as well as for those that are only performed if the action is taken.
Rather than changing the step syntax, I'd be inclined to declare separate names for these different kinds of blocks: Perhaps "assert" / "verify" for global conditions, and "presuming" / "providing" for conditions before and after the action?
step MyStuff =>
assert { -e '/net' }
ensure { -d '/net/scratch' }
presuming { -d '/net' }
using { mkdir 'net/scratch' }
providing { ! fgrep /./, 'ls -lA /net/scratch' } # dir is empty
verify { fgrep /\./, 'ls -la /net/scratch' }; # dir is readableYikes! On second thought, maybe that is too many block types... But looking at the pseudo-code outline, it's not clear to me which ones you can dispense with:
die unless ASSERT;
die unless SANITY;
unless (ENSURE) {
die unless PRESUMING;
register ROLLBACK;
USING;
die unless SANITY;
die unless ENSURE;
die unless PROVIDING;
}
die unless VERIFY;I also have a feature suggestion for you, as this is something I recently ran into. How about the ability to have a timeout on the block?
++ (*grin*) -- that'd be nice.
-Simon
_______________________________________________ sw-design mailing list [EMAIL PROTECTED] http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
