Re: Semantics for regexes - copy/snapshot

2004-09-09 Thread Steve Fink
On Sep-09, [EMAIL PROTECTED] wrote: On Wed, 8 Sep 2004, Chip Salzenberg wrote: According to [EMAIL PROTECTED]: So how many stores do we expect for ($a = xxx) =~ s/a/b/g and which of the possible answers would be more useful? I think it depends on C($a = aaa) =~ s/a/b/g. I

Re: Semantics for regexes - copy/snapshot

2004-09-09 Thread Larry Wall
On Wed, Sep 08, 2004 at 11:00:54PM -0700, Steve Fink wrote: : I vote for leaving all of these sorts of cases undefined. Well, : partially defined -- I'd rather we didn't allow ($a = aaa) =~ s/a/b/g : to turn $a into gawrsh. At the very least, define the exact number of : output and stores for

Re: Semantics for regexes - copy/snapshot

2004-09-09 Thread Chip Salzenberg
According to Larry Wall: I don't claim to follow all this talk about stores Think about tied values. When does STORE get called, precisely, on a tied target of s///? It's good to be explicit about this, down at the C API level, just so we know what to optimize for. The final answer is

Re: Semantics for regexes - copy/snapshot

2004-09-08 Thread Chip Salzenberg
According to [EMAIL PROTECTED]: So how many stores do we expect for ($a = xxx) =~ s/a/b/g and which of the possible answers would be more useful? I think it depends on C($a = aaa) =~ s/a/b/g. * If the s/// operator stores once after all substitutions, then having it alway store whether

Re: Semantics for regexes - copy/snapshot

2004-09-08 Thread martin
On Wed, 8 Sep 2004, Chip Salzenberg wrote: According to [EMAIL PROTECTED]: So how many stores do we expect for ($a = xxx) =~ s/a/b/g and which of the possible answers would be more useful? I think it depends on C($a = aaa) =~ s/a/b/g. I would agree with you in general, but since

Re: Semantics for regexes - copy/snapshot

2004-09-07 Thread Chip Salzenberg
Just across the hall from m// is s/// ... Considering the semantics of m// and especially s/// at the user level, we'll probably[*] want to take snapshots of dynamic strings (think P5's FETCH or overload ''), and apply all the pattern operations to that snapshot. *However*, in the usual case of

Re: Semantics for regexes - copy/snapshot

2004-09-07 Thread Leopold Toetsch
Chip Salzenberg [EMAIL PROTECTED] wrote: For Topaz, Scalar's interface included a function that would basically open the Scalar's hood, giving you a Buffer you could manipulate; then when you were done working with the Buffer, its modifications (if any) were propagated back down into the

Re: Semantics for regexes - copy/snapshot

2004-09-07 Thread Dan Sugalski
At 10:59 PM -0400 9/6/04, Chip Salzenberg wrote: Just across the hall from m// is s/// ... Considering the semantics of m// and especially s/// at the user level, we'll probably[*] want to take snapshots of dynamic strings (think P5's FETCH or overload ''), and apply all the pattern operations to

Re: Semantics for regexes - copy/snapshot

2004-09-07 Thread martin
On Tue, 7 Sep 2004, Leopold Toetsch wrote: [*] Unless it's a _feature_ that given tied $a, ($a = aaa) =~ s/a/b/g would call STORE four times (aaa, baa, bba, bbb). I'd expect two stores here. One for the initial setting of the value and one for the final result of the global