> > > Backtracking: > > > > > > Ok, I don't get it at all. Damian, clarification? > > > > Nothing to clarify. Larry punted (to a later Apocalypse). > > > > Okay. That's a cop-out. He's basically saying that you can write > > C<andthen> and C<orthen> yourself as: > <snip> > > I understand that much. What I don't quite get is the utility. > There's some hand-waving in the RFC about making parsers easier.
Parsing will not be the major application, I think. To see the utility, you need to look at a language whether this feature is already central to the language. Icon <http://www.cs.arizona.edu/icon/> is a good example. To see how backtracking might work in Perl, here's an program (adapted to RFC 104 syntax) that prints out Pythagorean triangle triplets with side-lengths less than 100: $x=100; { $y=100; --$x } andthen { $z=100; --$y } andthen { { --$z } andthen { $x**2 == $y**2 + $z**2 } } andthen { print "$x, $y, $z\n"; 0 }; Incidentally, that's why Larry was musing over the idea of the left operand's scope extending to the right operand. If that were the case, we could make $x, $y, and $z safely lexical: my $x=100; { my $y=100; --$x } andthen { my $z=100; --$y } andthen { { --$z } andthen { $x**2 == $y**2 + $z**2 } } andthen { print "$x, $y, $z\n"; 0 }; and the later blocks would still see them. Personally, I think: foreach my $x (1..99) { foreach my $y (1..99) { foreach my $z (1..99) { print "$x, $y, $z\n" if $x**2 == $y**2 + $z**2; }}} is much cleaner. But it certainly does demonstrate TMTOWTDI. ;-) Damian