The pair constructor seems to be in a different category than the other
quoting operators since the expression that it quotes must look like an
identifier:
https://github.com/rakudo/rakudo/blob/nom/src/Perl6/Grammar.nqp#L1776
token fatarrow {
\h* '=>' <.ws>
}
Brian
On Satu
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: {@*ARGS
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 ci
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 types
>
> it is combining too many new things at once:
Well, it is meant to be the up-front example of everything at once before
the step-by-step...
> * BUILD
> * new
These are the heart of construction. I don't think there's any avoiding
that in a class tutorial.
* submethod
> * bless
These are
On Thu, Sep 8, 2016 at 12:25 AM, Kaare Rasmussen wrote:
> I wonder what you miss from https://docs.perl6.org/language/classtut. To
> me, it explains the hows and whys very thoroughly. Now, I now people have
> been hard at work improving the documentation, so if you can point to
> what's missing o
> As I recall it, macros where left out of the initial implementation. So you
> have to wait for another Christmas Present :-)
The version of macros that was available in Rakudo when the 6.c spec
was cut was released with the compiler; It's marked experimental and
is therefore subject to change,
On Thu, Sep 8, 2016 at 6:41 AM, Kamil Kułaga wrote:
> In perl6 default way is to not write new, BUILD or BUILDALL and also
> not to write accessors. When you create object you can provide
> attributes to initialize, default accessors are generated if field is
> declared with $. sigil.
>
Right, t
On Thu, Sep 8, 2016 at 4:00 AM, Joseph Garvin wrote:
> * I can find no concise easy-to-understand explanation for how to define
> what other languages would call constructors. Instead there is a mess of
> bless, magic inside Mu, new, BUILD, BUILDALL... It's not clear when you
> should prefer to ov
Hi Joseph
Welcome, and I hope you'll stick around.
Now, I haven't had the time to dig into Perl 6 myself, only to poke at
it from time to time. But, while waiting for people who know something
to respond, I'll ask you to be a little concise in certain areas.
* I can find no concise easy-to-und
For the last couple weeks I've been experimenting with Perl6 because I
finally became sufficiently annoyed with Python's lack of real (No GIL)
threading and a quick inspection of the Perl6 feature list looked
promising. I'm trying to keep an open mind because Perl is pretty
culturally different tha
11 matches
Mail list logo