(I didn't think to respond to this until I saw a later response from dlux.)
Ken Fox wrote:
>
> try transaction {
> ...
> }
>
> That's a really interesting extension to exceptions -- code that has
> no side-effects unless it finishes.
Well, maybe transaction-enabling variables could help one achieve
this, but it would not be an automatic result.
I mean, in
my $x = 0;
sub side {
$x = 1;
}
trans {
side();
die;
};
print "x=$x\n"; # should print 1, yes?
# side-effect achieved, despite having occurred inside
# a trans block.
I don't believe $x should have been transaction-enabled here.
That would just be a major problem.
No, the semantics of trans should be much more constrained.
Tacking it onto the mechanics of C<local> seems much more
straightforward, I think.
$x = 0;
sub side {
$x = 1;
}
trans {
local $x;
side();
print "x=$x\n"; # should print 1
die;
}
print "x=$x\n"; # should print 0
Personally, I'd rather see transaction-enabling requested on
a per-variable basis.
--
John Porter
We're building the house of the future together.
- Re: RFC 130 (v4) Transaction-enabled variables for Perl6 John Porter
- Re: RFC 130 (v4) Transaction-enabled variables for ... dLux
- Re: RFC 130 (v4) Transaction-enabled variables ... Steve Fink
- Re: RFC 130 (v4) Transaction-enabled variab... Jarkko Hietaniemi
- Re: RFC 130 (v4) Transaction-enabled va... Dan Sugalski
- Re: RFC 130 (v4) Transaction-enabled variab... John Porter
- Re: RFC 130 (v4) Transaction-enabled variab... Chaim Frenkel
- Re: RFC 130 (v4) Transaction-enabled va... Ken Fox
- Re: RFC 130 (v4) Transaction-enabl... John Porter
- Re: RFC 130 (v4) Transaction-enabl... dLux
- Re: RFC 130 (v4) Transaction-enabl... John Porter
- Re: RFC 130 (v4) Transaction-enabl... dLux
- Re: RFC 130 (v4) Transaction-enabl... Chaim Frenkel
- Re: RFC 130 (v4) Transaction-enabl... Ken Fox
- Re: RFC 130 (v4) Transaction-enabl... Chaim Frenkel
- Re: RFC 130 (v4) Transaction-enabl... dLux
- Re: RFC 130 (v4) Transaction-enabl... Dan Sugalski
- Re: RFC 130 (v4) Transaction-enabl... dLux
- Re: RFC 130 (v4) Transaction-enabl... Bart Lateur
- Re: RFC 130 (v4) Transaction-enabl... Jarkko Hietaniemi
- Re: RFC 130 (v4) Transaction-enabl... Chaim Frenkel
