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 which you just expected to be a
string.  Not a good trap to have in the language.

If you expected it to be a string, why did you use curly braces?

While I'm completely on board with the idea that _pattern_ delimiters
shouldn't affect the _pattern's_ semantics, the second half of the
search-and-replace syntax isn't a pattern.  Conceptually, it's either
a string or an expression that returns a string.

Larry pretty much summed up what I'm looking for in this regard -
change the s/// syntax so that it has two distinctive forms:

   s/pattern/string/

(where '/' can be replaced by any valid non-bracketing delimiter, and
string is always evaluated as an interpolated string)

or

   s[pattern] expression

(where '[' and ']' can be replaced by any valid pair of bracketing
delimiters, and expression is evaluated as a perl6 expression)

--
Jonathan "Dataweaver" Lang

Reply via email to