On Wed, 2002-09-04 at 07:28, Damian Conway wrote:
> Aaron Sherman wrote:
>
> > Hmm... I had not thought of the copy aspect. Certainly, the code version
> > is more flexible. You could define C<$x> above as anything. For example:
> >
> > / (gr\w+) {let $x = Gr_Thing.new($1)} /
> >
> > The binding version is just a simple, fast version of one special case,
> > no?
>
> No. It's the *only* way to set hypotheticals. Of course, you *can* always
> do:
>
> / (gr\w+) { $x = Gr_Thing.new($1)} /
You chopped off some context. The discussion was about
/ $x := (gr\w+) / vs / (gr\w+) { let $x := $1 } /
Not hypotheticals in particular. So, the question was is binding C<$x>
to C<$1> via the former statement the same as binding C<$x> to C<$1> via
the latter. I the replied that the former was in fact doable using the
latter syntax, but was more efficient (no closure to execute) while not
offering the flexibility of something like:
/ (gr\w+) {let $x = Gr_Thing.new($1)} /
I think you were saying the same thing as I was (e.g. that you could
only assign a hypothetical to a complex value this way).