Re: Naming a module that deals with the meta-object protocol

2019-04-09 Thread Ralph Mellor
Aiui the most salient feature of your new type is being syntax sugar for conveniently creating and naming a sum type that includes `Failure`, i.e. instead of: my $foo where Int | Failure; $foo = 42; $foo = Failure; $foo = 'nope'; # Type check failed in assignment to $foo; expected

Re: POD: linking to a module

2019-01-16 Thread Ralph Mellor
Hi JJ, Wouldn't it be useful if Vadim commented on an appropriate GH issue? If so, which would that be? https://github.com/perl6/user-experience/issues/35 ? https://github.com/perl6/Pod-To-HTML/issues/55 ? https://github.com/perl6/doc/issues/167 ? Somewhere else? -- raiph On Mon, Jan 14, 2019 at

Re: contains booboo

2018-12-19 Thread Ralph Mellor
On Wed, Dec 19, 2018 at 7:58 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > In the mean time, I will ue if $x.contains("b") && not $x.contains( "q" ) > On 12/18/18 4:13 PM, Ralph Mellor wrote, demonstrating he never misses > anythi

Re: contains booboo

2018-12-18 Thread Ralph Mellor
.contains tests whether its invocant, treated as a string, contains its argument, treated as a string. The argument you've given to .contains is: "b" && not "q". That's not a string. Here's one option: my$x="abcd"; if $x.contains("b") && not $x.contains("q") {say "y"}else{say "n"}; On Tue,

Re: what type $in,$out and $err is

2018-11-05 Thread Ralph Mellor
On Sun, Oct 28, 2018 at 7:26 PM Xiao Yafeng wrote: > Besides, just curious, why choose '_' as default it looks strange > Turns out it's deprecated in 6.d: https://marketing.perl6.org/id/1541379592/pdf_digital

Re: what type $in,$out and $err is

2018-11-01 Thread Ralph Mellor
On Sun, Oct 28, 2018 at 7:26 PM Xiao Yafeng wrote: > I'm curious about what type of $in is on Proc class. `$in` isn't "on `Proc` class". `$in` is a *parameter* of the `.new` *method*. > I mean, if $in is IO::Pipe object As a *parameter* of the `.new` method *declaration* the type of `$in`

Re: need :enc help?I

2018-10-15 Thread Ralph Mellor
https://docs.perl6.org/type/Pair#index-entry-%3A%24 Food for thought: For your previous question about encodings I didn't know the answer. So I went to doc.perl6.org and entered `encoding` in the search box. There were several exact matches. I saw the encoding routine, clicked it. I saw it was

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
is then taken out of the container. Which means the extra `$` is redundant. -- raiph On Sun, Oct 14, 2018 at 12:36 PM Tom Browder wrote: > On Sun, Oct 14, 2018 at 5:13 AM Ralph Mellor > wrote: > > > > Almost certainly your problem is elsewhere. > > What is the mean

Re: What is |c ?

2018-10-14 Thread Ralph Mellor
|foo in a signature captures all remaining arguments using a local variable called foo. sub foo (|foo) { foo } say foo 42; # \(42) -- raiph On Sun, Oct 14, 2018 at 10:21 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Over on > >

Re: enc ?

2018-10-14 Thread Ralph Mellor
https://docs.perl6.org/routine/encoding On Sun, Oct 14, 2018 at 10:23 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Over on > > https://docs.perl6.org/routine/slurp > > # read entire file as Latin1 Str > my $text_contents = slurp "path/to/file",

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
any difference. We can pick things up from there. Catch ya later. -- raiph On Sun, Oct 14, 2018 at 11:30 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/14/18 3:08 AM, Ralph Mellor wrote: > > This code works fine: > > > > spurt 'foo', '

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
is to do with code that you haven't yet shown. -- raiph On Sun, Oct 14, 2018 at 11:08 AM Ralph Mellor wrote: > Are you sure the error message you showed applies to the line you showed? > > This code works fine: > > spurt 'foo', 'bar'; > my Str $ReturnStr = "

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
a perl6-users < perl6-users@perl.org> wrote: > >> On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users > >> mailto:perl6-users@perl.org>> wrote: > >> > >> On 10/14/18 2:29 AM, Ralph Mellor wrote: > >> > In P6 "a

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
4/18 2:29 AM, Ralph Mellor wrote: > > In P6 "assign" means use of `=`. > > > > And "assign to" means to copy into the thing on the left of the `=`. > > > > And to copy into something the thing has to be a mutable container. > > > > The err

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
e changeable. > that's presumably a problem with whatever code you've written that has earlier bound $ReturnStr to an immutable value. Or you need to use a fresh variable. -- raiph On Sun, Oct 14, 2018 at 10:29 AM Ralph Mellor wrote: > In P6 "assign" means use of `=`. > >

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a string) not a container. So that's

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
gives me > >> > >>Malformed UTF-8 > >> > >> How do I clean up $$proc.out.slurp-rest ?? > >> > >> Many thanks, > >> -T > >> > > On 10/13/18 7:19 AM, Ralph Mellor wrote: > > Why are you asking abo

Re: Malformed UTF-8 ???

2018-10-13 Thread Ralph Mellor
Why are you asking about cleaning something up? Is it because you thought `Malformed UTF-8` was an error message? If so, great, because it IS an error message. If not, you need to know that Malformed UTF-8 is an error message and we need to think about how to make that more clear. So that's

Re: need --> help

2018-10-13 Thread Ralph Mellor
That would work. I think it's more idiomatic to write the declaration as: my (Str $x, Int $y) = ... which saves repeating the `my`. -- raiph On Fri, Oct 12, 2018 at 11:47 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/12/18 3:27 PM, Curt Tilmes wrote: > > > > > > On

Re: need --> help

2018-10-12 Thread Ralph Mellor
I imagine P6 may one day be changed to do as you suggest. But for now I think something like this is the closest you'll get: subset Str_Int of List where Str, Int; sub foo (--> Str_Int) { return 'a', 42 } -- raiph On Fri, Oct 12, 2018 at 11:23 PM ToddAndMargo via perl6-users <

Re: flatten?

2018-10-05 Thread Ralph Mellor
Well I guess my first way of explaining it was a complete bust. :) It's not going to be worth me discussing your reply to my first attempt. List context means that something appears in the context of a list. For example, given the list of characters A, A appears in the context of a list

Re: <> thank you

2018-10-05 Thread Ralph Mellor
That was me. Sending off list was a mistake. And you're welcome. :) -- raiph On Fri, Oct 5, 2018 at 7:30 AM Todd Chester wrote: > Hi All, > > I went to reply to someone, I think it was Brandon for sending me > an eMail to my private address and the stinker disappeared! > > Anyway whoever sent

Feedback requested on playlist of 200 Perl 6 videos

2018-10-03 Thread Ralph Mellor
On Wed, Oct 3, 2018 at 6:16 AM David Green wrote: > There are quite a few recorded P6 presentations around, but I > don't know if there's a collected list anywhere, or one that links > to recent talks (anything not too out-of-date). > I've been building a collection of P6 videos for about 5

Re: What are the official names?

2018-10-03 Thread Ralph Mellor
longer. One is a longname which appends a signature: `postcircumfix:<[ ]>($, | is raw)` is a longname. (See also https://docs.perl6.org/syntax/Long%20names) The other way is to prepend a package qualifier: `::postcircumfix:<[ ]>` is a package qualified name. -- raiph On Wed, Oct 3, 2

Re: What are the official names?

2018-10-03 Thread Ralph Mellor
> Any idea what the official name of the crypto line is? You haven't mentioned "crypto line" until this point. So I'm guessing you mean the line that starts "multi". That's called a routine declaration. More specifically a method declaration. More specifically a multi method declaration.

Re: Could this be any more obscure?

2018-10-02 Thread Ralph Mellor
>> On 10/1/18 3:37 PM, Donald Hunter wrote: >> > Methods don't accept [], values that are positional do that. >> Is your distinction that [] is actually a routine in itself >> and not part of the method? And I am lumping them together? On 10/2/18 12:18 AM,

Re: Grammar doesn't seem to match any token

2018-09-24 Thread Ralph Mellor
Do you use Grammar::Tracer and especially Grammar::Debugger? I'd say a TOP rule is... don't leave TOP without them. -- raiph

Re: method vs multi method

2018-09-14 Thread Ralph Mellor
> multi method kv ... Use of `multi` means there *may* be more than one *declaration* using the same declared routine name (`kv` in this case). There usually *will* be more than one. (Otherwise, why was it declared `multi`?) The normal way to *use* a routine is to call it. If you declare

Re: case insensitive "contains"?

2018-09-10 Thread Ralph Mellor
Hi Todd, > What are the rules for what goes inside and what goes outside? > Also, do y have a link to what the various ":x" commands are that I can use? > See https://docs.perl6.org/language/regexes#Adverbs The first section explains the two types of "adverb". "regex adverbs" like `:i` can go

perl6-users in groups.google.com

2018-09-06 Thread Ralph Mellor
Does anyone know the mysteries of groups.google.com? Will the messages I'm posting here eventually turn up at https://groups.google.com/forum/#!forum/perl.perl6.users? I sent a bunch of messages via the groups.google.com interface and they disappeared into the void. I searched for the generic

How to shield users from side effects of applying an attribute trait for a Moo like trigger

2018-09-05 Thread Ralph Mellor
In Vadim's recent post about his AttrX::Moo module he describes his P6 solution for bringing functionality he was used to having in P5 via Moo. (In another post I've asked about the option and relevance of using Moo:from in P6. If you reply to this post please consider also replying to that one.

Introducing P6 into a P5 user environment

2018-09-05 Thread Ralph Mellor
My last post in response to Vadim's recent post. Vadim is one of those exploring introduction of P6 in a company that makes significant use of P5. > I have a work project on my hands which I wanna implement in Perl6. Yet, I have an internal framework for such projects written in Perl 5. I

use Moo:from;

2018-09-05 Thread Ralph Mellor
This is another follow up to Vadim's post. Vadim, you didn't touch upon the `use Moo:from;` approach. As you noted, you wanted to avoid P5. And you've already created AttrX::Moo. So perhaps you see anything related to Inline::Perl5 as doubly moot. Regardless, I really would love to hear your

DefiniteHOW and SubsetHOW don't support named parameters

2018-09-05 Thread Ralph Mellor
Vadim wrote: > BTW, while researching the core sources I discovered a potential problem with DefiniteHOW and SubsetHOW. They both define their own find_method() which is re-delegating to their base type HOW.find_method. But they don't support named parameters. Combined with classes with FALLBACK

WATs (Array[Str] vs Array and list vs scalar assignment)

2018-09-05 Thread Ralph Mellor
Hi Vadim, This is for you and anyone else interested in a little bit about tricky aspects of sub-types, of P6, of my perspective on learning in response to WTF? moments, and P6 strengths and weaknesses in relation to the foregoing. Vadim wrote: > my Array[Str] $a = ["a", "b", "c"]; > my Str @a

Is Proxy a first class part of P6 or not?

2018-09-05 Thread Ralph Mellor
This is the first in a series of a half dozen responses to Vadim's AttrX::Moo post that replace a couple earlier failed attempts to post here. I apologize if there end up being repeats or my following up with several responses is inappropriate. Hi Vadim. I'm making this my first post because it