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

2018-12-18 Thread JJ Merelo
Sorry to arrive so late here. I had the impression that there was some
issue with the documentation here somewhere. Is that still the case? Can we
improve docs in any way?

El jue., 11 oct. 2018 a las 15:36, Richard Hogaboom (<
richard.hogab...@gmail.com>) escribió:

> #
> # 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
>


-- 
JJ


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

2018-10-11 Thread Brandon Allbery
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 
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.hogab...@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
allber...@gmail.com


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

2018-10-11 Thread Siavash
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 
 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
>
>-- 
>Richard A Hogaboom
>16 Alprilla Farm Road
>Hopkinton, MA 01748-1922
>richard.hogab...@gmail.com
>www.linkedin.com/in/richardhogaboom/
>https://github.com/rahogaboom
>M508-330-3775


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

2018-10-11 Thread JJ Merelo
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.hogab...@gmail.com>) escribió:

> 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.hogab...@gmail.com
> www.linkedin.com/in/richardhogaboom/
> https://github.com/rahogaboom
> M508-330-3775
>


-- 
JJ


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

2018-10-11 Thread Richard Hogaboom
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.hogab...@gmail.com
www.linkedin.com/in/richardhogaboom/
https://github.com/rahogaboom
M508-330-3775


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

2018-10-11 Thread Siavash


It means it's returning a Block.

dd Foo::Bar::<&zape> # Block &zape = -> ;; $_? is raw { 
#`(Block|94777643161752) ... }
say Foo::Bar::<&zape>() # zipi


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

2018-10-11 Thread Richard Hogaboom

#
# 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