@larry[0] wrote:

Log:
P5's s[pat][repl] syntax is dead, now use s[pat] = "repl"

Wow, I really missed this one! That's a pretty big thing to get my head around. Are embedded closures in the string handled correctly so that:

        s:g[\W] = qq{\\{$/}};

Will do what I seem to be expecting it will?

How will that be defined in the Perl6-based parser? Will macros be able to act as an LVALUE and modify their RVALUE in this way, or is this just some unholy magic in the parser?

+     s[pattern] = doit()
+     s[pattern] = eval doit()
[...]
+There is no syntactic sugar here, so in order to get deferred
+evaluation of the replacement you must put it into a closure.  The
+syntactic sugar is provided only by the quotelike forms.
[...]
+This is not a normal assigment, since the right side is evaluated each
+time the substitution matches (much like the pseudo-assignment to declarators
+can happen at strange times).  It is therefore treated as a "thunk", that is,
+as if it has implicit curlies around it.  In fact, it makes no sense at
+all to say
+
+    s[pattern] = { doit }

Please clarify "quotelike forms", since to my untrained eye, the above appeared to be contradictory at first (I read "quotelike forms" as s/// not s{...}).

Very interesting.

Reply via email to