Re: Package Compile Question

2018-10-01 Thread Brad Gilbert
`Foo::Bar::<$quux>` is basically short for `::Foo::Bar::('$quux')` (except
the former is looked up at compile time)

So the way to do this is:

my $bar = 'Bar';
::Foo::( $bar ~ '::$quux' )

or

::Foo::($bar)::('$quux')

Note that the leading `::` are necessary for dynamic lookups. (Where the
name is in a variable)

On Sun, Sep 30, 2018 at 7:27 AM Richard Hogaboom 
wrote:

> This does not compile; I think it should:
>
> use v6;
>
> class Foo {
>  class Bar {
>  our $quux = 42;
>  }
> }
>
> say $Foo::Bar::quux;  # works - 42
> say Foo::Bar::<$quux>;  # works - 42
> my $bar = 'Bar';
> say $Foo::($bar)::quux;  # works - 42
>
> # shouldn't this work too?
> say Foo::($bar)::<$quux>;  # nope - won't compile
>
> # ===SORRY!=== Error while compiling
> /home/hogaboom/hogaboom/Perl6/p6ex/./p6test.p6
> # Combination of indirect name lookup and call not supported
> # at /home/hogaboom/hogaboom/Perl6/p6ex/./p6test.p6:16
> # --> say Foo::($bar)::⏏<$quux>;  # nope
> # expecting any of:
> # argument list
>
> # See https://docs.perl6.org/language/packages
> # and look at the first two sections: 'Names' and 'Package-qualified names'
>
> --
>
> rahogaboom
>


Re: Package Compile Question

2018-10-01 Thread JJ Merelo
El lun., 1 oct. 2018 a las 13:47, Richard Hogaboom (<
richard.hogab...@gmail.com>) escribió:

> Hmm...  the ($bar) in Foo::($bar)::<$quux>; is an interpolation, but the
> <$quux> is just another way of writing $Foo::($bar)::quux;, not an
> interpolation, no?
>
> Right. It kinda is, but it should rather be called quoting, so, well...
Anyway, that's the part that makes the call, and the parser can't work with
both at the same time.

JJ


Re: Package Compile Question

2018-10-01 Thread Richard Hogaboom
Hmm...  the ($bar) in Foo::($bar)::<$quux>; is an interpolation, but the 
<$quux> is just another way of writing $Foo::($bar)::quux;, not an 
interpolation, no?


On 10/1/18 7:41 AM, JJ Merelo wrote:

Thanks. I'll fix that.

WRT the original post, it looks like it should work, but apparently 
can't. The error should be selfexplanatory. Either you interpolate 
using :: or <>, but not both...


JJ

El lun., 1 oct. 2018 a las 13:38, Richard Hogaboom 
(mailto:richard.hogab...@gmail.com>>) 
escribió:


Not exactly, but close.  The following line is exactly from the
doc.  It works.  It it works, then the offending(next line) line
should work as well.

my$bar='Bar';

say$Foo::($bar)::quux;
# compound identifiers with interpolations; OUTPUT: «42␤»


sayFoo::($bar)::<$quux>; # won't compile - but the doc says it
should - they are supposed to be equivalent

Gives:

===SORRY!=== Error while compiling
/home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6 Combination of
indirect name lookup and call not supported at
/home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6:345 --> say
Foo::($bar)::⏏<$quux>; expecting any of: argument list

Also, another following line from the doc:

say
$Foo::Bar::zape;# compound identifiers separated by ::; OUTPUT: «zipi␤»

outputs (Any), not zipi. The leading $ should be deleted.


say
Foo::Bar::zape;# compound identifiers separated by ::; OUTPUT: «zipi␤»

outputs zipi correctly. This is only a doc issue, not a compiler
issue.


On 9/30/18 1:47 PM, JJ Merelo wrote:

Is that taken verbatim from the docs? I'll create an issue if
that's the case.

JJ


-- 
Richard A Hogaboom

16 Alprilla Farm Road
Hopkinton, MA 01748-1922
richard.hogab...@gmail.com  
www.linkedin.com/in/richardhogaboom/  

https://plus.google.com/+RichardHogaboom
https://github.com/rahogaboom
M508-330-3775



--
JJ


--
Richard A Hogaboom
16 Alprilla Farm Road
Hopkinton, MA 01748-1922
richard.hogab...@gmail.com
www.linkedin.com/in/richardhogaboom/
https://plus.google.com/+RichardHogaboom
https://github.com/rahogaboom
M508-330-3775



Re: Package Compile Question

2018-10-01 Thread JJ Merelo
Thanks. I'll fix that.

WRT the original post, it looks like it should work, but apparently can't.
The error should be selfexplanatory. Either you interpolate using :: or <>,
but not both...

JJ

El lun., 1 oct. 2018 a las 13:38, Richard Hogaboom (<
richard.hogab...@gmail.com>) escribió:

> Not exactly, but close.  The following line is exactly from the doc.  It
> works.  It it works, then the offending(next line) line should work as well.
>
> my $bar = 'Bar';
>
> say $Foo::($bar)::quux; #
>  compound identifiers with interpolations; OUTPUT: «42␤»
>
>
> say Foo::($bar)::<$quux>; # won't compile - but the doc says it should -
> they are supposed to be equivalent
>
> Gives:
>
> ===SORRY!=== Error while compiling
> /home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6 Combination of indirect name
> lookup and call not supported at
> /home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6:345 --> say
> Foo::($bar)::⏏<$quux>; expecting any of: argument list
>
> Also, another following line from the doc:
>
> say $Foo::Bar::zape;#
>  compound identifiers separated by ::; OUTPUT: «zipi␤»
>
> outputs (Any), not zipi. The leading $ should be deleted.
>
>
> say Foo::Bar::zape;#
>  compound identifiers separated by ::; OUTPUT: «zipi␤»
>
> outputs zipi correctly. This is only a doc issue, not a compiler issue.
>
>
> On 9/30/18 1:47 PM, JJ Merelo wrote:
>
> Is that taken verbatim from the docs? I'll create an issue if that's the
> case.
>
> JJ
>
> --
> Richard A Hogaboom
> 16 Alprilla Farm Road
> Hopkinton, MA 
> 01748-1922richard.hogab...@gmail.comwww.linkedin.com/in/richardhogaboom/https://plus.google.com/+RichardHogaboomhttps://github.com/rahogaboom
> M508-330-3775
>
>

-- 
JJ


Re: Package Compile Question

2018-10-01 Thread Richard Hogaboom
Not exactly, but close.  The following line is exactly from the doc.  It 
works.  It it works, then the offending(next line) line should work as well.


my$bar='Bar';

say$Foo::($bar)::quux; 
# compound identifiers with interpolations; OUTPUT: «42␤»



sayFoo::($bar)::<$quux>; # won't compile - but the doc says it should - 
they are supposed to be equivalent


Gives:

===SORRY!=== Error while compiling 
/home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6 Combination of indirect 
name lookup and call not supported at 
/home/hogaboom/hogaboom/Perl6/p6ex/./p6ex.p6:345 --> say 
Foo::($bar)::⏏<$quux>; expecting any of: argument list


Also, another following line from the doc:

say $Foo::Bar::zape;# compound identifiers separated by ::; OUTPUT: «zipi␤»

outputs (Any), not zipi. The leading $ should be deleted.


say Foo::Bar::zape;# compound identifiers separated by ::; OUTPUT: «zipi␤»

outputs zipi correctly. This is only a doc issue, not a compiler issue.


On 9/30/18 1:47 PM, JJ Merelo wrote:
Is that taken verbatim from the docs? I'll create an issue if that's 
the case.


JJ


--
Richard A Hogaboom
16 Alprilla Farm Road
Hopkinton, MA 01748-1922
richard.hogab...@gmail.com
www.linkedin.com/in/richardhogaboom/
https://plus.google.com/+RichardHogaboom
https://github.com/rahogaboom
M508-330-3775



Re: Package Compile Question

2018-09-30 Thread JJ Merelo
Is that taken verbatim from the docs? I'll create an issue if that's the
case.

JJ