I was reading an article about Perl 6, I forget which one, and it happened to
mention that code can be interpolated inside double quoted strings.  That's
one thing, my concern is with the selected syntax.

        say "foo { 1+1 }";   # "foo 2"

The {...} construct seems far too common one in normal text to be given
special meaning.  One data point is to do a google code search for "{ in Perl
5.  It comes up with quite a lot.
http://www.google.com/codesearch?hl=en&lr=&q=%5C%22%5C%7B+lang%3Aperl&btnG=Search

Another concern is embedded YAML.

        $yaml = "{ $key: 42 }";   # syntax error in Perl 6

Finally, it chokes on unbalanced braces adding another trap for users.

I'm concerned this will lead to a lot of unsightly backwhacking or having to
be more careful about what type of string you're using.

What about ${} and @{} instead?  ${} would execute in scalar context and @{}
in list.  They're just cleaned up versions of the successful, but ugly, Perl 5
idioms ${\(...)} and @{[...]} idioms.  They make use of an existing
interpolated character so there's no additional load on the programmer.

${} and @{} already have interpolated meanings in Perl 5 but not in Perl 6.


-- 
...they shared one last kiss that left a bitter yet sweet taste in her
mouth--kind of like throwing up after eating a junior mint.
    -- Dishonorable Mention, 2005 Bulwer-Lytton Fiction Contest
           by Tami Farmer

Reply via email to