Re: Observations from a C++/Python developer that never used Perl5

2016-09-09 Thread Joseph Garvin
Wait, quotes *are an operator* ? If so how would I define them? If the operator returns string, what is the type of its argument? If so that's even stranger -- most languages they're a hard coded bit of syntax -- the closest thing I can think of is in C++11 you can add your own string literal

Re: Observations from a C++/Python developer that never used Perl5

2016-09-09 Thread Brock Wilcox
Quotes are almost a circumfix operator, but they act a bit more like a macro by controlling the parsing of the contents. But you can do some weird things like define your own quote-likes. perl6 -e ' sub circumfix:<>($v) { "{$v}" } ; say B"foo"B ' # output: foo or more verbosely perl6 -e ' sub

Re: Observations from a C++/Python developer that never used Perl5

2016-09-09 Thread Aaron Sherman
You cannot currently define your own quote-like operators. That will come with true macros (though you could certainly do it via a slang... everything is possible with a slang). But they are operators. Not only are they operators, but they nest other operators. vis: say "These are my args: