Larry Wall wrote: > But I will make one general remark at the start, which is that we > want Perl 6 programmer to look at curlies differently than Perl 5 > programmers do. In Perl 5, curlies were overloaded many different > ways, and rarely did they mean a closure by themselves. In Perl 6, > it's almost always the case that bare curlies indicate a closure of > some sort throughout the rest of the language. So the visual and > psychological import of seeing and typing curlies is intentionally > weighted rather differently. Curlies are Perl 6's lambda. Whenever > the user sees curlies, we want them to stop and think. Even the > curlies used by the "built in" control operators are real lambdas > in the abstract, unlike in P5 where they are just hardwired in the > grammar. Bare curlies in regex are now special too.
All this makes me happy and more willing to accept interpolative curlies. I was rapidly hooked on Ruby's ability to easily pass blocks into methods and want to see more user ability to play with blocks. And after looking a bit more into how Perl 6 does interpolation I see a lot has changed. So I'll drink it all in some more. > : Code execution in a string is a very powerful thing, so it's not the sort of > : thing one wants to accidentally trigger. Because it's using a common, > : innocent construct, this strikes me as being all too easy to trigger > : accidentally and unknowingly. > : > : $ pugs -wle 'sub key() { 42 } sub value() { 23 } say "{ key: value }"' > : 23 > : > : Whoops. > > Seems like you had to work pretty hard to contrive an example > that would parse. P6 is much pickier about random code than P5 is. FWIW that naturally occurred to me and I was surprised when it parsed without error. But I've been doing a lot of YAML lately. > As a last resort, you can even redefine how double quotes work. > "All is fair if you predeclare." But I think some people would > construe that as antisocial. Every time someone responds to a Perl 6 language concern with "just change the grammar" I silently scream inside. ;) -- Life is like a sewer - what you get out of it depends on what you put into it. - Tom Lehrer