Re: S5: substitutions

2006-10-10 Thread Markus Laire
On 10/9/06, Jonathan Lang [EMAIL PROTECTED] wrote: Smylers wrote: To be consistent your proposal should also suggest that these become equivalent: * { function() } * qq[ {function() }] * qq{ function() } * eval function() How so? AFAIK, string literal syntax requires you to prepend a

Re: S5: substitutions

2006-10-10 Thread Jonathan Lang
Markus Laire wrote: According to S02 bare curlies do interpolate in double-quoted strings: Yeah; that was subsequently pointed out to me. Oops. -- Jonathan Dataweaver Lang

Re: S5: substitutions

2006-10-08 Thread Jonathan Lang
Larry Wall wrote: On Sat, Oct 07, 2006 at 07:49:48PM -0700, Jonathan Lang wrote: : Another possibility: make it work. Add a delayed parameter trait : that causes evaluation of that trait to be postponed until the first : time that the parameter actually gets used in the routine. If it : never

Re: S5: substitutions

2006-10-08 Thread Smylers
Jonathan Lang writes: Translating this to perl 6, I'm hoping that perl6 is smart enough to let me say: s(pattern) { doit() } Instead of s(pattern) { { doit() } } That special case is nasty if you don't know about it -- you inadvertently execute as code something which you just

S5: substitutions

2006-10-08 Thread Jonathan Lang
Smylers wrote: Jonathan Lang writes: Translating this to perl 6, I'm hoping that perl6 is smart enough to let me say: s(pattern) { doit() } Instead of s(pattern) { { doit() } } That special case is nasty if you don't know about it -- you inadvertently execute as code something

Re: S5: substitutions

2006-10-08 Thread Smylers
Jonathan Lang writes: Smylers wrote: Jonathan Lang writes: Translating this to perl 6, I'm hoping that perl6 is smart enough to let me say: s(pattern) { doit() } Instead of s(pattern) { { doit() } } That special case is nasty if you don't know about it

Re: S5: substitutions

2006-10-08 Thread Dr.Ruud
Smylers schreef: in this particular case the particular behaviour involves _executing as Perl code something which the programmer never intended to be code in the first place_. That's crazily dangerous. I wouldn't mind eval() to be off by default, so to have to put a use eval in every block

S5: substitutions

2006-10-08 Thread Jonathan Lang
Smylers wrote: Jonathan Lang writes: If you expected it to be a string, why did you use curly braces? Because it isn't possible to learn of all Perl (5 or 6) in one go. And in general you learn rules before exceptions to rules. Agreed. In general in Perl the replacement part of a

S5: substitutions

2006-10-07 Thread Jonathan Lang
S5 says: There is no /e evaluation modifier on substitutions; instead use: s/pattern/{ doit() }/ Instead of /ee say: s/pattern/{ eval doit() }/ In my perl5 code, I would occasionally take advantage of the pairs of brackets quoting mechanism to do something along the lines of:

Re: S5: substitutions

2006-10-07 Thread Juerd
Jonathan Lang skribis 2006-10-07 15:07 (-0700): Translating this to perl 6, I'm hoping that perl6 is smart enough to let me say: s(pattern) { doit() } Instead of s(pattern) { { doit() } } I would personally hope that Perl isn't that clever, but treats all bracketing delimiters the

Re: S5: substitutions

2006-10-07 Thread Larry Wall
On Sat, Oct 07, 2006 at 03:07:49PM -0700, Jonathan Lang wrote: : S5 says: : There is no /e evaluation modifier on substitutions; instead use: : : s/pattern/{ doit() }/ : : Instead of /ee say: : : s/pattern/{ eval doit() }/ : : In my perl5 code, I would occasionally take advantage of

Re: S5: substitutions

2006-10-07 Thread Jonathan Lang
Larry Wall wrote: Jonathan Lang wrote: : Translating this to perl 6, I'm hoping that perl6 is smart enough to let me : say: : :s(pattern) { doit() } Well, the () are illegal without intervening whitespace because that makes s() a function call, but we'll leave that alone. Thank you; I

Re: S5: substitutions

2006-10-07 Thread Jonathan Lang
Larry Wall wrote: As a unary lazy prefix, you could even just say s[pattern] doit(); Of course, then people will wonder why .subst(/pattern/, doit()) doesn't work. Another possibility: make it work. Add a delayed parameter trait that causes evaluation of that trait to be postponed

Re: S5: substitutions

2006-10-07 Thread Jonathan Lang
Jonathan Lang wrote: Another possibility: make it work. Add a delayed parameter trait... ...although lazy might be a better name for it. :) -- Jonathan Dataweaver Lang

Re: S5: substitutions

2006-10-07 Thread Larry Wall
On Sat, Oct 07, 2006 at 07:49:48PM -0700, Jonathan Lang wrote: : Another possibility: make it work. Add a delayed parameter trait : that causes evaluation of that trait to be postponed until the first : time that the parameter actually gets used in the routine. If it : never gets used, then it