Strange output on 'say Foo::Bar::<&zape>;'

#
# example from https://docs.perl6.org/language/packages
#
# from documentation under Package-qualified names:
#
# "Sometimes it's clearer to keep the sigil with the variable name, so 
an alternate way to write this is:
# Foo::Bar::<$quux>
# (This does not work with the &zape variable) The name is resolved at 
compile time because the variable name is a constant."
#
# So, I tried &zape, which gives the expected error output. However, it 
suggests possible corrections, which I tried.
# say Foo::Bar::<&zape>; should also fail, but compiles, executes, does 
nothing, gives strange msg
#

use v6;

class Foo {
     class Bar {
         our &zape = { "zipi" };
     }
}

say Foo::Bar::zape;  # works - prints 'zipi'

# this should not compile - see error msg below
#say Foo::Bar::&zape;  # Nope - it does not compile - correct

# ===SORRY!=== Error while compiling 
/home/hogaboom/hogaboom/Perl6/p6ex/./p6Packages.p6
# Malformed lookup of ::&zape; please use ::('&zape'), ::{'&zape'}, or 
::<&zape>
# at /home/hogaboom/hogaboom/Perl6/p6ex/./p6Packages.p6:12
# ------> say Foo::Bar⏏::&zape;  # Nope - not compile - correct

# this also should not compile
say Foo::Bar::<&zape>;  # compiles - executes - does nothing useful - 
gives following strange output
say Foo::Bar::{'&zape'};  # compiles - executes - does nothing useful - 
same strange output
#say Foo::Bar::('&zape');  # does not compile

# -> ;; $_? is raw { #`(Block|62717656) ... }
# what does this output mean?

say "end";  # prints 'end'

-- 
rahogaboom
0
richard
10/11/2018 1:35:51 PM
perl.perl6.users 1085 articles. 0 followers. Follow

5 Replies
11 Views

Similar Articles

[PageSpeed] 56

It means it's returning a Block.

dd Foo::Bar::<&zape> # Block &zape = -> ;; $_? is raw { #`(Block|94777643161752) ... }
say Foo::Bar::<&zape>() # zipi
0
siavash
10/11/2018 1:45:31 PM
OK .. I mistakenly assumed that it should not compile from the doc 
'(This does not work with the &zape variable)'.

my $tmp = Foo::Bar::<&zape>;
say $tmp();  # zipi - works

if ';; $_? is raw' is the signature, what does the ';;' mean and what 
does '#`(Block|62717656) ...' mean?


On 10/11/18 9:45 AM, Siavash wrote:
> It means it's returning a Block.
>
> dd Foo::Bar::<&zape> # Block &zape = -> ;; $_? is raw { #`(Block|94777643161752) ... }
> say Foo::Bar::<&zape>() # zipi

-- 
Richard A Hogaboom
16 Alprilla Farm Road
Hopkinton, MA 01748-1922
richard.hogaboom@gmail.com
www.linkedin.com/in/richardhogaboom/
https://github.com/rahogaboom
M508-330-3775
0
richard
10/11/2018 3:43:41 PM
--000000000000008e610577f627dc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I'll try to check that. It was recently changed, maybe it was not done
completely...

El jue., 11 oct. 2018 a las 17:44, Richard Hogaboom (<
richard.hogaboom@gmail.com>) escribi=C3=B3:

> OK .. I mistakenly assumed that it should not compile from the doc
> '(This does not work with the &zape variable)'.
>
> my $tmp =3D Foo::Bar::<&zape>;
> say $tmp();  # zipi - works
>
> if ';; $_? is raw' is the signature, what does the ';;' mean and what
> does '#`(Block|62717656) ...' mean?
>
>
> On 10/11/18 9:45 AM, Siavash wrote:
> > It means it's returning a Block.
> >
> > dd Foo::Bar::<&zape> # Block &zape =3D -> ;; $_? is raw {
> #`(Block|94777643161752) ... }
> > say Foo::Bar::<&zape>() # zipi
>
> --
> Richard A Hogaboom
> 16 Alprilla Farm Road
> Hopkinton, MA 01748-1922
> richard.hogaboom@gmail.com
> www.linkedin.com/in/richardhogaboom/
> https://github.com/rahogaboom
> M508-330-3775
>


--=20
JJ

--000000000000008e610577f627dc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;ll try to check that. It was recently changed, maybe=
 it was not done completely...<br></div><br><div class=3D"gmail_quote"><div=
 dir=3D"ltr">El jue., 11 oct. 2018 a las 17:44, Richard Hogaboom (&lt;<a hr=
ef=3D"mailto:richard.hogaboom@gmail.com">richard.hogaboom@gmail.com</a>&gt;=
) escribi=C3=B3:<br></div><blockquote class=3D"gmail_quote" style=3D"margin=
:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK .. I mistakenly=
 assumed that it should not compile from the doc <br>
&#39;(This does not work with the &amp;zape variable)&#39;.<br>
<br>
my $tmp =3D Foo::Bar::&lt;&amp;zape&gt;;<br>
say $tmp();=C2=A0 # zipi - works<br>
<br>
if &#39;;; $_? is raw&#39; is the signature, what does the &#39;;;&#39; mea=
n and what <br>
does &#39;#`(Block|62717656) ...&#39; mean?<br>
<br>
<br>
On 10/11/18 9:45 AM, Siavash wrote:<br>
&gt; It means it&#39;s returning a Block.<br>
&gt;<br>
&gt; dd Foo::Bar::&lt;&amp;zape&gt; # Block &amp;zape =3D -&gt; ;; $_? is r=
aw { #`(Block|94777643161752) ... }<br>
&gt; say Foo::Bar::&lt;&amp;zape&gt;() # zipi<br>
<br>
-- <br>
Richard A Hogaboom<br>
16 Alprilla Farm Road<br>
Hopkinton, MA 01748-1922<br>
<a href=3D"mailto:richard.hogaboom@gmail.com" target=3D"_blank">richard.hog=
aboom@gmail.com</a><br>
<a href=3D"http://www.linkedin.com/in/richardhogaboom/" rel=3D"noreferrer" =
target=3D"_blank">www.linkedin.com/in/richardhogaboom/</a><br>
<a href=3D"https://github.com/rahogaboom" rel=3D"noreferrer" target=3D"_bla=
nk">https://github.com/rahogaboom</a><br>
M508-330-3775<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature" data-smartmail=3D"gmail_signature">JJ</div>

--000000000000008e610577f627dc--
0
jjmerelo
10/11/2018 4:06:10 PM
------CQC3N6UY40WBCMPFGKZQZF4WOBH5NA
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Maybe someone with better knowledge can answer=2E But I guess ;; is https:/=
/docs=2Eperl6=2Eorg/type/Signature#Long_names

The #`() part is a comment(inline)=2E

And the number is what WHICH returns=2E
https://docs=2Eperl6=2Eorg/routine/WHICH

On October 11, 2018 7:13:41 PM GMT+03:30, Richard Hogaboom <richard=2Ehoga=
boom@gmail=2Ecom> wrote:
>OK =2E=2E I mistakenly assumed that it should not compile from the doc=20
>'(This does not work with the &zape variable)'=2E
>
>my $tmp =3D Foo::Bar::<&zape>;
>say $tmp();=C2=A0 # zipi - works
>
>if ';; $_? is raw' is the signature, what does the ';;' mean and what=20
>does '#`(Block|62717656) =2E=2E=2E' mean?
>
>
>On 10/11/18 9:45 AM, Siavash wrote:
>> It means it's returning a Block=2E
>>
>> dd Foo::Bar::<&zape> # Block &zape =3D -> ;; $_? is raw {
>#`(Block|94777643161752) =2E=2E=2E }
>> say Foo::Bar::<&zape>() # zipi
>
>--=20
>Richard A Hogaboom
>16 Alprilla Farm Road
>Hopkinton, MA 01748-1922
>richard=2Ehogaboom@gmail=2Ecom
>www=2Elinkedin=2Ecom/in/richardhogaboom/
>https://github=2Ecom/rahogaboom
>M508-330-3775

------CQC3N6UY40WBCMPFGKZQZF4WOBH5NA
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body>Maybe someone with better knowledge can answer=2E =
But I guess ;; is <a href=3D"https://docs=2Eperl6=2Eorg/type/Signature#Long=
_names">https://docs=2Eperl6=2Eorg/type/Signature#Long_names</a><br><br>The=
 #`() part is a comment(inline)=2E<br><br>And the number is what WHICH retu=
rns=2E<br><a href=3D"https://docs=2Eperl6=2Eorg/routine/WHICH">https://docs=
=2Eperl6=2Eorg/routine/WHICH</a><br><br><div class=3D"gmail_quote">On Octob=
er 11, 2018 7:13:41 PM GMT+03:30, Richard Hogaboom &lt;richard=2Ehogaboom@g=
mail=2Ecom&gt; wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0pt=
 0pt 0pt 0=2E8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: =
1ex;">
<pre class=3D"k9mail">OK =2E=2E I mistakenly assumed that it should not co=
mpile from the doc <br>'(This does not work with the &amp;zape variable)'=
=2E<br><br>my $tmp =3D Foo::Bar::&lt;&amp;zape&gt;;<br>say $tmp();&nbsp; # =
zipi - works<br><br>if ';; $_? is raw' is the signature, what does the ';;'=
 mean and what <br>does '#`(Block|62717656) =2E=2E=2E' mean?<br><br><br>On =
10/11/18 9:45 AM, Siavash wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin: 0pt 0pt 1ex 0=2E8ex; border-left: 1px solid #729fcf; padding-le=
ft: 1ex;"> It means it's returning a Block=2E<br><br> dd Foo::Bar::&lt;&amp=
;zape&gt; # Block &amp;zape =3D -&gt; ;; $_? is raw { #`(Block|947776431617=
52) =2E=2E=2E }<br> say Foo::Bar::&lt;&amp;zape&gt;() # zipi<br></blockquot=
e></pre></blockquote></div></body></html>
------CQC3N6UY40WBCMPFGKZQZF4WOBH5NA--
0
siavash
10/11/2018 4:42:58 PM
--0000000000000787710577f7d099
Content-Type: text/plain; charset="UTF-8"

More to the point of this, currently there is no way to reconstruct the
definition of a block, so you get its signature and an inline comment in
place of the body.

There is an easier way to see the same behavior: &Foo::Bar::zape
This is getting the block/sub as a value instead of invoking it.

Similarly, you can get something like that for subs in the setting, but
most of those will show you the dispatch proto instead because they don't
know which implementation to use:

    pyanfar Z$ 6 'say &say'
    proto sub say (|) {*}


On Thu, Oct 11, 2018 at 12:43 PM Siavash <siavash.askari.nasr@gmail.com>
wrote:

> Maybe someone with better knowledge can answer. But I guess ;; is
> https://docs.perl6.org/type/Signature#Long_names
>
> The #`() part is a comment(inline).
>
> And the number is what WHICH returns.
> https://docs.perl6.org/routine/WHICH
>
> On October 11, 2018 7:13:41 PM GMT+03:30, Richard Hogaboom <
> richard.hogaboom@gmail.com> wrote:
>>
>> OK .. I mistakenly assumed that it should not compile from the doc
>> '(This does not work with the &zape variable)'.
>>
>> my $tmp = Foo::Bar::<&zape>;
>> say $tmp();  # zipi - works
>>
>> if ';; $_? is raw' is the signature, what does the ';;' mean and what
>> does '#`(Block|62717656) ...' mean?
>>
>>
>> On 10/11/18 9:45 AM, Siavash wrote:
>>
>>>  It means it's returning a Block.
>>>
>>>  dd Foo::Bar::<&zape> # Block &zape = -> ;; $_? is raw { #`(Block|94777643161752) ... }
>>>  say Foo::Bar::<&zape>() # zipi
>>>
>>

-- 
brandon s allbery kf8nh
allbery.b@gmail.com

--0000000000000787710577f7d099
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">More to the point of this, currently ther=
e is no way to reconstruct the definition of a block, so you get its signat=
ure and an inline comment in place of the body.<div><br></div><div>There is=
 an easier way to see the same behavior: &amp;Foo::Bar::zape</div><div>This=
 is getting the block/sub as a value instead of invoking it.</div><div><br>=
</div><div>Similarly, you can get something like that for subs in the setti=
ng, but most of those will show you the dispatch proto instead because they=
 don&#39;t know which implementation to use:</div><div><br></div><div><div>=
=C2=A0 =C2=A0 pyanfar Z$ 6 &#39;say &amp;say&#39;</div><div>=C2=A0 =C2=A0 p=
roto sub say (|) {*}</div></div><div><br></div></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr">On Thu, Oct 11, 2018 at 12:43 PM Siavash =
&lt;<a href=3D"mailto:siavash.askari.nasr@gmail.com">siavash.askari.nasr@gm=
ail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Maybe s=
omeone with better knowledge can answer. But I guess ;; is <a href=3D"https=
://docs.perl6.org/type/Signature#Long_names" target=3D"_blank">https://docs=
..perl6.org/type/Signature#Long_names</a><br><br>The #`() part is a comment(=
inline).<br><br>And the number is what WHICH returns.<br><a href=3D"https:/=
/docs.perl6.org/routine/WHICH" target=3D"_blank">https://docs.perl6.org/rou=
tine/WHICH</a><br><br><div class=3D"gmail_quote">On October 11, 2018 7:13:4=
1 PM GMT+03:30, Richard Hogaboom &lt;<a href=3D"mailto:richard.hogaboom@gma=
il.com" target=3D"_blank">richard.hogaboom@gmail.com</a>&gt; wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0pt 0pt 0pt 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex">
<pre class=3D"m_-3619216940764123873k9mail">OK .. I mistakenly assumed that=
 it should not compile from the doc <br>&#39;(This does not work with the &=
amp;zape variable)&#39;.<br><br>my $tmp =3D Foo::Bar::&lt;&amp;zape&gt;;<br=
>say $tmp();=C2=A0 # zipi - works<br><br>if &#39;;; $_? is raw&#39; is the =
signature, what does the &#39;;;&#39; mean and what <br>does &#39;#`(Block|=
62717656) ...&#39; mean?<br><br><br>On 10/11/18 9:45 AM, Siavash wrote:<br>=
<blockquote class=3D"gmail_quote" style=3D"margin:0pt 0pt 1ex 0.8ex;border-=
left:1px solid #729fcf;padding-left:1ex"> It means it&#39;s returning a Blo=
ck.<br><br> dd Foo::Bar::&lt;&amp;zape&gt; # Block &amp;zape =3D -&gt; ;; $=
_? is raw { #`(Block|94777643161752) ... }<br> say Foo::Bar::&lt;&amp;zape&=
gt;() # zipi<br></blockquote></pre></blockquote></div></div></blockquote></=
div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr" class=3D"gmail=
_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div d=
ir=3D"ltr"><div>brandon s allbery kf8nh</div><div><a href=3D"mailto:allbery=
..b@gmail.com" target=3D"_blank">allbery.b@gmail.com</a></div></div></div></=
div></div>

--0000000000000787710577f7d099--
0
allbery
10/11/2018 6:05:03 PM
Reply: