Re: Could this be any more obscure?

2018-10-01 Thread ToddAndMargo

On 10/1/18 3:37 PM, Donald Hunter wrote:

toddandma...@zoho.com (ToddAndMargo) writes:


Hi Curt,

Perfect! Thank you!

So all methods that respond with --> Positional will accept []

Awesome!

-T


Not quite.

All methods that respond with --> Positional, provide a Positional that
will accept []

Methods don't accept [], values that are positional do that.

Cheers,
Donald.



Hi Donald,

I am confused.  I though we both said the same thing?
Is your distinction that [] is actually a routine in itself
and not part of the method?  And I am lumping them together?

-T


Re: Could this be any more obscure?

2018-10-01 Thread Donald Hunter
toddandma...@zoho.com (ToddAndMargo) writes:
>
> Hi Curt,
>
> Perfect! Thank you!
>
> So all methods that respond with --> Positional will accept []
>
> Awesome!
>
> -T

Not quite.

All methods that respond with --> Positional, provide a Positional that
will accept []

Methods don't accept [], values that are positional do that.

Cheers,
Donald.


Re: join questions

2018-10-01 Thread Larry Wall
On Sun, Sep 30, 2018 at 04:02:15AM -0700, ToddAndMargo wrote:
: Hi All,
: 
: https://docs.perl6.org/routine/join#(List)_routine_join
: 
: method join(List:D: $separator --> Str:D)
: 
: $ p6 'say (1, ).join("|");'
: 1|a b c
: 
: 
: It states in the manual that this will happen.
: 
: Questions:
: 
:1) why?

Because an invocant is only one thing.  In this case, it's a List of
exactly two things: a 1 and a sublist of .  And you since passed
.join only two things to stringify and join, it stringified the 1 and
then it stringified the , and then it joined those two things,
just as you asked it to.

A deeper "why" is that Perl 6 doesn't autoflatten sublists unless you
explicitly ask it to, so you'd need to put | to "slip" the sublist
into the outer list, or use flat().

:2) where in the method definition does it state
:   this will happen?

It's not in the method definition, and it doesn't belong in the method
definition.  It's in the definition of how Perl 6 works at a fundamental
level.  We're not going to document every list argument in Perl 6 to
say that it *doesn't* work like in Perl 5.

:3) why does this work?
:  $ p6 'join( "|", <1 2 3>).say;'
:  1|2|3

Because functions can take multiple arguments, and so the signature of
the join function is allowed (and required) to use a comma to separate
those arguments.  This is not the same comma that creates the general
list above.  Functions often cheat with their commas, especially functions
that were borrowed from Perl 5, which cheats on most of its commas and
doesn't really understand nested lists at all without explicit references.

The deeper and/or shallower reason is that a Perl 5 programmer will
expect the join function to work that way, and even expect the slurpy
argument to autoflatten, which it does for old time's sake, and because
it seems to be a useful DWIM for this particular string-based function.
The functions that flatten their slurpy (like join) are explicitly marked
with * on that argument in the signature.  So it's still true that we
flatten only explicitly in Perl 6, but that explicit mark is in the
that pesky signature you gotta get your brain around someday.

In short, the method form is optimized for people who understand nested
lists and want them to to stay nested by default, while the function
form is optimized for, er, the typical Perl 5 programmer who expects
random list flattening in various places.

Larry


Re: No. It is lucid! Re: Could this be any more obscure?

2018-10-01 Thread Brandon Allbery
That just sounds like the backing store got restored from backup, losing
anything added after the backup was taken. Which is not the best way to do
things (incrementals are nice), but if things had gone wrong enough might
have been the best they could do.

On Mon, Oct 1, 2018 at 7:13 PM ToddAndMargo  wrote:

> On 9/30/18 9:11 PM, Richard Hainsworth wrote:
> > your 'perl' box was corrupted.
>
>
> Somewhere the imap daemons got appeased and suddenly a day later,
> I watched it all come blazing back.
>
> Hopefully tomorrow I will get a chance to read over what yo wrote.
>
> By the way, the eMail I send about the thread disappearing
> got removed when the rest came back.   Hmm
>


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


Re: Could this be any more obscure?

2018-10-01 Thread ToddAndMargo

On 9/30/18 3:58 AM, JJ Merelo wrote:

There is one line per signature, or definition.


You misunderstand.  I was proposing a different
way of stating it such that you did not have to
keep repeating lines with slight differences


Re: No. It is lucid! Re: Could this be any more obscure?

2018-10-01 Thread ToddAndMargo

On 9/30/18 9:11 PM, Richard Hainsworth wrote:

your 'perl' box was corrupted.



Somewhere the imap daemons got appeased and suddenly a day later,
I watched it all come blazing back.

Hopefully tomorrow I will get a chance to read over what yo wrote.

By the way, the eMail I send about the thread disappearing
got removed when the rest came back.   Hmm


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: Could this be any more obscure?

2018-10-01 Thread Siavash


You can read the thread here:
https://www.nntp.perl.org/group/perl.perl6.users/2018/09/msg5757.html

On 2018-10-01 04:21:43 +0330, ToddAndMargo wrote:
> Hi All,
>
> My "Perl" box got corrupted and in the process of rebuilding
> it I lost this thread except for one one message from JJ.
> Anyway, I am not deliberately ignoring anyone, I just
> lost the thread.
>
> :'(
>
> -T