On Wed, Aug 16, 2000 at 07:42:33PM +1000, Jeremy Howard wrote:
> raptor wrote:
> > ]- I tried minimalistic approach as small as possible additions to the
> Perl
> > language, we get only the "backtrack" mechanism i.e. something that is
> > harder or slower to be done outside of the perl core.
> > The rest should be done outside ..... (I too want all in the core)
>
> I don't know if you noticed the earlier thread, but there's a few people
> (including myself) who are still having trouble understanding how your
> proposal works.
>
> Could you please provide a brief idiomatic example of some code where this
> proposal would provide a real practical benefit--enough that slow learners
> like myself can really understand what it makes easier, and how? It would be
> great if you could provide the equivalent Perl 5 code too.
Here's some perl psuedo code that'll implement the "andthen" semantics:
BLOCK1 andthen BLOCK2 andthen BLOCK3 andthen BLOCK4
B1: if (BLOCK1) {
B2: if (BLOCK2) {
B3: if (BLOCK3) {
B4: if (BLOCK4) {
return "true"
} else { goto B3 }
} else { goto B2 }
} else { goto B1 }
}
return "false"
The semantics for "orthen" are similar:
BLOCK1 orthen BLOCK2 orthen BLOCK3 orthen BLOCK4
B1: unless (BLOCK1) {
B2: unless (BLOCK2) {
B3: unless (BLOCK3) {
B4: unless (BLOCK4) {
return "false"
} else { goto B3 }
} else { goto B2 }
} else { goto B1 }
}
return "true"
As for examples where this would be of benefit ... I really can't think
of any.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]