»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
tailgate timotimo: I appreciate the effort. Hell of a language, too 00:58
tailgate m: gist.github.com/ahalbert/1b495ad9f...9fedc3ebe0 01:17
camelia rakudo-moar 1b898c: OUTPUT«([a a])␤([a b] [a b])␤([a c] [a c] [a c])␤»
tailgate this is more interesting. Maybe because @state is passed around, and needs to be made a new copy... 01:18
SmokeMachine____ Hi! is there any way to create a trait on a parameter on a sub/method? some thing like: sub bla($par is my-custom-trait){...} 01:23
m: multi trait_mod:<is> ($a, :$my-custom-trait!) {say $a.^name}; sub bla($par is my-custom-trait){...} 01:27
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Can't use unknown trait 'is my-custom-trait' in a parameter declaration.␤at <tmp>:1␤ expecting any of:␤ rw␤ readonly␤ copy␤ required␤ raw␤ leading…»
SmokeMachine____ I got it! thanks! 01:35
dataangel In python 3 PathLib gives you path objects similar to IO::Path but they include an extra method called with_suffix that lets you conveniently change the extension. Is there something like that for IO::Path, and if not what is the most Perlish way to add it?
SmokeMachine____ m: multi trait_mod:<is> (Parameter $a, :$blablabla!) {say $a.^name}; sub bla($a is blablabla) {}
camelia rakudo-moar 1b898c: OUTPUT«Parameter␤»
dataangel Found the documentation for augment, but not sure if that's the way that I should do things 01:44
SmokeMachine____ Any way to get the function by the parameter? 01:45
grondilu augment is not something you should do on regular use indeed 01:51
dataangel I can just define a free function... But that doesn't seem Perlish either 01:52
grondilu just try inheritance? 01:54
like class MyPath is IO::Path { method with_suffix {...} } or something. 01:56
dataangel I assume Perl 6 doesn't have any form of uniform function call syntax? Like that would let you define free functions taking a type but then call them with the method calling syntax on the object?
grondilu like the .&function syntax? 01:57
m: sub foo { say "Foo!!" }; say pi.&foo
camelia rakudo-moar 1b898c: OUTPUT«Too many positionals passed; expected 0 arguments but got 1␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
dataangel Maybe that's what I want
grondilu m: sub foo($_) { say "Foo!!" }; say pi.&foo
camelia rakudo-moar 1b898c: OUTPUT«Foo!!␤True␤»
grondilu you will have to explicitely put the ampersand though 01:58
I suspect it's better to use inheritance.
or roles
m: role Suffixable { method with-suffix {...} } 01:59
camelia ( no output )
grondilu roles are very useful in Perl 6. I use them more than classes :) 02:00
dataangel Inside the S/// operator how do I refer to a variable?
grondilu I'm not sure but {} always work 02:01
dataangel grondilu: but then how do I attach that role to IO::Path?
grondilu not to the class itself, but to instances.
m: say "/tmp".IO.WHAT
camelia rakudo-moar 1b898c: OUTPUT«(Path)␤»
grondilu m: say my $path = "/tmp".IO but role { method talk { say "hi" } }; $path.talk 02:02
camelia rakudo-moar 1b898c: OUTPUT«"/tmp".IO␤hi␤»
dataangel Haven't seen but before @_@ 02:08
dataangel 'but' is interesting but in order to use it you have to remember to do it on every single called to every single function that might produce a new IO::Path, so I suspect .& is still preferable 02:16
dataangel m: sub with-suffix (IO::Path:D $p, Str:D $ext --> IO::Path:D) { (S/(\.<-[.]>)?$/{$ext}/ given $p).IO; } say "hello.c".IO.&with-suffix(".o"); 02:18
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Strange text after block (missing semicolon or comma?)␤at <tmp>:1␤------> 3 (S/(\.<-[.]>)?$/{$ext}/ given $p).IO; }7⏏5 say "hello.c".IO.&with-suffix(".o");␤ expecting any of:␤ infix…»
dataangel m: sub with-suffix (IO::Path:D $p, Str:D $ext --> IO::Path:D) { (S/(\.<-[.]>)?$/{$ext}/ given $p).IO; }; say "hello.c".IO.&with-suffix(".o");
camelia rakudo-moar 1b898c: OUTPUT«Type check failed in binding to $p; expected IO::Path but got "hello.c".IO(:SPEC(IO...␤ in sub with-suffix at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
dataangel Weird... Works for me locally 02:19
dataangel May be bot is on a different version? 02:20
grondilu maybe you want a parametric role? 02:22
or a trait. 02:23
grondilu wait 02:23
just a role with one attribute
m: role Suffixed { has Str $.suffix; }; my $path = "hello.c".IO but Suffixed(".o"); 02:24
camelia ( no output )
grondilu m: role Suffixed { has Str $.suffix; }; my $path = "hello.c".IO but Suffixed(".o"); say $path.suffix
camelia rakudo-moar 1b898c: OUTPUT«.o␤»
grondilu nah I got your semantics wrong I guess 02:25
sorry 02:26
dataangel p6: sub with-suffix (IO::Path:D $p, Str:D $ext --> IO::Path:D) { (S/(\.<-[.]>)?$/{$ext}/ given $p).IO; }; say "hello.c".IO.&with-suffix(".o");
camelia rakudo-moar 1b898c: OUTPUT«Type check failed in binding to $p; expected IO::Path but got "hello.c".IO(:SPEC(IO...␤ in sub with-suffix at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
dataangel Thought I might get a different bot :p
dataangel Still confused by that 02:27
grondilu I'm not sure you can use the .& notation like that. Let me check.
dataangel Like I said works on my computer
grondilu m: sub f($a, $b) { "$a $b" }; say pi.&f(2); 02:28
camelia rakudo-moar 1b898c: OUTPUT«3.14159265358979 2␤»
grondilu oh you can
dataangel camelia for some reason doesn't like it
grondilu what this uppercase S///?
dataangel Returns a copy instead of editing in place
grondilu consider using .subst
m: sub with-suffix($p, $D) { $r.subst(/foo/, "bar").IO }; say "foo.c".IO.&with-suffix(*) 02:29
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$r' is not declared␤at <tmp>:1␤------> 3sub with-suffix($p, $D) { 7⏏5$r.subst(/foo/, "bar").IO }; say "foo.c"␤»
grondilu m: sub with-suffix($p, $D) { $p.subst(/foo/, "bar").IO }; say "foo.c".IO.&with-suffix(*) 02:30
camelia rakudo-moar 1b898c: OUTPUT«"bar.c".IO␤»
grondilu m: sub with-suffix($p, $suffix) { $p.subst(/\.\w$$/, $suffix).IO }; say "hello.c".IO.&with-suffix(*)
camelia rakudo-moar 1b898c: OUTPUT«"hello*".IO␤»
grondilu m: sub with-suffix($p, $suffix) { $p.subst(/\.\w$$/, $suffix).IO }; say "hello.c".IO.&with-suffix(".o") 02:31
camelia rakudo-moar 1b898c: OUTPUT«"hello.o".IO␤»
dataangel with-suffix changes the extension (or adds one if there isn't one) not the part before
grondilu yeah I was just simplifying to test the subst
you ought to name your sub "change-suffix" instead of "with-suffix" though. 02:32
or not. Not obvious. 02:33
ShimmerFairy grondilu: it works if you read is as "I want a file with this name, but with suffix .o". But I agree it's a touch ambiguous, since you could also say "I want this filename with suffix .o added" 02:44
SmokeMachine____ m: role param_injected[Str $name?] { has $.injected = True; has $.default = {"injected $name"}; }; multi trait_mod:<is> (Parameter $a, :$injected!) { $a does param_injected; }; sub bla(Str $a is injected) { say $a; }; bla(); 02:56
camelia rakudo-moar 1b898c: OUTPUT«Unhandled exception: Cannot unbox a type object␤ at <unknown>:1 (/home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm:print_exception)␤ from gen/moar/m-CORE.setting:24486 (/home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.sett…»
SmokeMachine____ if I have a variable with a Signature, how can I define a sub with that signature? 03:52
dj_goku SmokeMachine____: huh? 03:55
SmokeMachine____ m: \cap = :(Int $a); sub bla(|cap) {say "worked?"}; bla(42); bla() 03:56
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix = instead␤at <tmp>:1␤------> 3\cap =7⏏5 :(Int $a); sub bla(|cap) {say "worked?"␤»
geekosaur I think they want a meta method
geekosaur or, no. it's a sub. so, hm, I think that "can be done" but only in NQP-land 03:56
SmokeMachine____ geekosaur: what I really want is wrap a method taking off some parameters... 03:57
geekosaur oh. you want .assuming
(maybe) 03:58
SmokeMachine____ oh! method/sub
geekosaur m: my sub foo($a, $b) { $a + $b }; my sub bar(&f) { f(15) }; say bar(&foo.assuming(3)) 03:59
camelia rakudo-moar 1b898c: OUTPUT«18␤»
SmokeMachine____ What I want to do is something like: sub my-func($par1, $par2 is injected) is injected {} # and it should wrap the my-func with a fund only wit the signature ($par1) 04:01
SmokeMachine____ m: my sub foo($a, $b) { $a + $b }; my sub bar(&f) { f(15) }; say bar(&foo.assuming(nil, 3)) 04:02
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ nil used at line 1␤␤»
dj_goku SmokeMachine____: Not that i'll be able to answer your question. But why are you wanting/needing this? 04:03
SmokeMachine____ I am writing a dependency injector... 04:04
dj_goku oh. sounds complicated. :D
what does a dependency injector do? 04:05
geekosaur there;s already a wrap thing
BenGoldberg m: my $diff = * - *; say $diff.assuming(3).(1); 04:06
camelia rakudo-moar 1b898c: OUTPUT«Method 'assuming' not found for invocant of class 'WhateverCode'␤ in block <unit> at <tmp> line 1␤␤»
SmokeMachine____ this is my old code (that Im rewriting) github.com/FCO/Injector
BenGoldberg m: my $diff = &[-]; say $diff.assuming(3).(1);
camelia rakudo-moar 1b898c: OUTPUT«2␤»
BenGoldberg m: my $diff = &[-]; say $diff.assuming(*, 3).(1);
camelia rakudo-moar 1b898c: OUTPUT«-2␤»
BenGoldberg m: my sub foo($a, $b) { $a + $b }; my sub bar(&f) { f(15) }; say bar(&foo.assuming(*, 3)) 04:07
camelia rakudo-moar 1b898c: OUTPUT«18␤»
SmokeMachine____ hum!!! the whatever star!
geekosaur docs.perl6.org/routine/wrap but I don't think you can do much with the parameters
there's nextwith...
dj_goku s: &infix:<eqv> 04:07
SourceBaby dj_goku, Sauce is at github.com/rakudo/rakudo/blob/1b89...Mu.pm#L828
BenGoldberg You might need to EVAL some text to create a sub with different parameters. 04:08
dj_goku with sourcery are you able to find out what code is executed for an expression? 04:10
s: Any.WHAT
SourceBaby dj_goku, Something's wrong: ␤ERR: Cannot resolve caller sourcery(Any); none of these signatures match:␤ ($thing, Str:D $method, Capture $c)␤ ($thing, Str:D $method)␤ (&code)␤ (&code, Capture $c)␤ in block <unit> at -e line 6␤␤
dj_goku s: Any, 'WHAT' 04:11
SourceBaby dj_goku, Something's wrong: ␤ERR: Type check failed in binding to &code; expected Callable but got Nil (Nil)␤ in sub do-sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 42␤ in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 33␤ in block <unit> at -e line 6␤␤
BenGoldberg WHAT is a metamethod. It looks like a method, but is actually a macro. 04:13
dj_goku ahh ok 04:14
geekosaur m: sub foo($a, +@b) { $a <<+<< @b }; sub bar(|x) { nextwith(1, |x) }; &foo.wrap(&bar); say foo(4,5,6) 04:17
camelia rakudo-moar 1b898c: OUTPUT«[5 6 7]␤»
BenGoldberg It's documented here <docs.perl6.org/language/mop> and here <design.perl6.org/S12.html> 04:17
geekosaur 's first attempt at that used a pointy block instead of a separate sub; nextsame didn't like that 04:19
shantanu how would I use a object from a classname that is stored in a variable 05:39
m: my $a = "Example"; class Example {}; my $b = $a.new; $b.^name; 05:40
camelia ( no output )
shantanu m: my $a = "Example"; class Example {}; my $b = $a.new; say $b.^name;
camelia rakudo-moar 1b898c: OUTPUT«Str␤»
shantanu m: my $a = "Example"; class Example {}; my $b = $a.new; say $b.^methods; 05:41
camelia rakudo-moar 1b898c: OUTPUT«(BUILD Int Num chomp pred succ simplematch match ords samecase samemark samespace word-by-word trim-leading trim-trailing trim encode NFC NFD NFKC NFKD wordcase trans indent codes chars uc lc tc fc tclc flip ord WHY WHICH Bool Str Stringy DUMP ACCEPTS chop…»
brrt shantanu: perl6 type objects are prototypes 05:44
m: 3.new.WHAT.say;
camelia rakudo-moar 1b898c: OUTPUT«(Int)␤»
brrt m: 3.new.defined.say;
camelia rakudo-moar 1b898c: OUTPUT«True␤»
brrt m: 42.new.say;
camelia rakudo-moar 1b898c: OUTPUT«0␤»
brrt so that doesn't do what you want 05:45
my guess is you have to lookup the type object explicitly, and i know that is possible but i've forgotten how
shantanu ohh so is there any way to get initialize a object of a class whose name you have in a variable?
brrt yeah
shantanu I am trying to implement a pluggable role.
brrt you have to get the type object from the namespace
but as i said, i'm not100% sure how :-)
m: my $a = 3; say $::<$a>; 05:46
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$' is not declared␤at <tmp>:1␤------> 3my $a = 3; say 7⏏5$::<$a>;␤»
shantanu ohh
brrt m: my $a = 3; say ::<$sa>;
camelia rakudo-moar 1b898c: OUTPUT«Nil␤»
brrt not yet
shantanu my $a = ; my $b = 'a'; say ::<$b>;
m: my $a = ; my $b = 'a'; say ::<$b>; 05:47
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed initializer␤at <tmp>:1␤------> 3my $a =7⏏5 ; my $b = 'a'; say ::<$b>;␤ expecting any of:␤ prefix␤ term␤»
brrt hmmm 05:48
m: my $a = 10; say $::<$a>; 05:50
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$' is not declared␤at <tmp>:1␤------> 3my $a = 10; say 7⏏5$::<$a>;␤»
brrt m: my $a = 10; say ::<$a>; 05:51
camelia rakudo-moar 1b898c: OUTPUT«10␤»
brrt m: my $a = 10; my $b = '$a'; say ::{$b};
camelia rakudo-moar 1b898c: OUTPUT«10␤»
brrt shantanu: docs.perl6.org/language/packages#Direct_lookup is what you want
i think
m: sub foo { $_*2; }; say foo 3 05:54
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Calling foo(Int) will never work with declared signature ()␤at <tmp>:1␤------> 3sub foo { $_*2; }; say 7⏏5foo 3␤»
brrt m: sub foo(|) { $_ * 2; }; say foo 3; 05:55
camelia rakudo-moar 1b898c: OUTPUT«Use of uninitialized value of type Any in numeric context in sub foo at <tmp> line 1␤0␤»
brrt m: sub foo { $^a * 3; }; say foo 3;
camelia rakudo-moar 1b898c: OUTPUT«9␤»
brrt hmm, that's actually quite cool
m: sub foo { $^a * 3; }; say &foo.^signature;
camelia rakudo-moar 1b898c: OUTPUT«Method 'signature' not found for invocant of class 'Perl6::Metamodel::ClassHOW'␤ in block <unit> at <tmp> line 1␤␤»
brrt m: sub foo { $^a * 3]; say &foo.signature; 06:01
camelia rakudo-moar 1b898c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3sub foo { $^a * 37⏏5]; say &foo.signature;␤ expecting any of:␤ statement end␤ statement modifier␤ statement modifier loop␤»
brrt m: sub foo { $^a * 3; }; say &foo.signature;
camelia rakudo-moar 1b898c: OUTPUT«($a)␤»
brrt m: sub foo ($a, $b where $b > 2*$a) { $a * $b * $b }; foo(1,2); foo(2,1); 06:02
camelia rakudo-moar 1b898c: OUTPUT«Constraint type check failed for parameter '$b'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
Xliff \o 06:07
brrt hi Xliff 06:08
isn't there a bot here that can help me with the link to RT #127425 06:11
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127425
brrt good synopsebot6 :-)
.hug synopsebot6
.botsnack
synopsebot6 om nom nom
yoleaux :D
Xliff brrt: Isn't it nice when you can get answers out of the blue like that? 06:25
No effort solutions!
Is there a way to get the SQL of an executed statement from DBIish? 06:26
shantanu m: my $a = 10; my $b = '$a'; say ::{$b}; 06:29
camelia rakudo-moar 1b898c: OUTPUT«10␤»
shantanu brrt: Thanks!
m: my $a = "Example"; class Example {}; my $b = ::{$a}.new; say $b.^methods; 06:30
camelia rakudo-moar 1b898c: OUTPUT«()␤»
shantanu m: my $a = "Example"; class Example {}; my $b = ::{$a}.new; say $b.^name;
camelia rakudo-moar 1b898c: OUTPUT«Example␤»
shantanu m: my $a = "Example"; class Example {}; my $b = ::{"Example"}.new; say $b.^name; 06:36
camelia rakudo-moar a2b4a2: OUTPUT«Example␤»
TheLemonMan 'morning #perl6 07:04
lizmat TheLemonMan o/ 07:05
nine My brain really sucks at generating dreams that try to deal with the abstract challenges encountered during a heavy coding day... 07:08
ufobat what happens during the night, nine? 07:08
sometimes i am dreaming of a solution for my coding problem, but usually it makes no sense in the morning :( 07:09
nine I...can't really say. It's so confusing. I just remember being half awake sometimes and just wishing it to stop. 07:10
ufobat that doesn't sound good. 07:13
TheLemonMan nine, are you sure you weren't just dreaming in APL ? 07:16
pmurias TheLemonMan: in the pull request maybe it would make sense to have a 'if $valreg_kind {$valreg := $*REGALLOC.fresh_register($valreg_kind)}' to avoid repetition
TheLemonMan pmurias, absolutely, but the condition should be $valreg_kind ne $param_kind 07:19
pmurias yes 07:20
nine TheLemonMan: well I don't know APL, so yes, I'm sure :)
pmurias or even better the whole ugly if chain could be replaced with an array lookups in @trunc_op[$param_kind] and @trunc_kind[$param_kind] arrays 07:24
ufobat
.oO( how many ppl just googled APL now? )
07:27
pmurias turning into array lookup might be overkill, anyway just nitpicking ;) 07:31
TheLemonMan pmurias, done! 07:41
arnsholt People who have VPSes for things: What providers are good these days?
pmurias TheLemonMan: test file for your changes: gist.github.com/pmurias/4594138e3e...17fda164d2 07:44
TheLemonMan: did you push? 07:45
pmurias has to get afk&
TheLemonMan pmurias, force-pushed 07:46
TheLemonMan interesting, NativeCall subs don't support default arguments, but RT#125523 shows it should 08:58
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=125523
TheLemonMan CALL-ME simply throws if the arguments don't match the arity
Xliff (scrollbacked) - I used to know APL, but I think my brain's self-defense mechanisms have deleted those memories. 09:45
DrForr I know enough APL to be dangerous, but that particular project is far down the queue of stuff... 09:46
TheLemonMan m: say class :: {has uint16 $.x;}.new(x=>0xffff).x; 09:47
camelia rakudo-moar 5f2818: OUTPUT«-1␤»
TheLemonMan ENOTCOOL
Xliff "class ::" o_O 09:48
AlexDaniel bye bye bisectable 10:00
AlexDaniel hello bisectable6 :) 10:09
Zoffix If nsvedberg 0racle Xliff dmaestro are here please add self to github.com/rakudo/rakudo/blob/nom/CREDITS if you want to be credited under a different name. Here's the full current list if you wanted to check yourself: gist.github.com/zoffixznet/c439bed...251fc4ba10 10:32
(yeah, there are a couple of duplicated names ATM, which I'm working on)
.tell sena_kun please add yourself to github.com/rakudo/rakudo/blob/nom/CREDITS if you don't want to show up as `Altai-man` in credits. 10:36
yoleaux Zoffix: I'll pass your message to sena_kun.
Xliff Zoffix: Done. \o/ 10:37
Zoffix Merged. Thanks.
Xliff is now playing: Eschaton - Euphonic (Original Mix) 10:38
Xliff groves.
DrForr "Uh, that's 'groove', sir, you're in the groove now." 10:40
Xliff DrForr: Not amongst the trees? Got it wrong again... 10:52
♪┏(°.°)┛┗(°.°)┓┗(°.°)┛┏(°.°)┓ ♪ 10:53
DrForr Sorry, 'twas a rather obscure ref to "Rappin' Ronnie" :) 10:54
masak p'haps of interest: zero-cost futures (promises) in Rust: aturon.github.io/blog/2016/08/11/futures/ 11:19
(hi, #perl6)
pmurias hi masak 11:29
masak pmurias: going to start writing the 007/JS backend now. 11:30
unmatched} .tell El_Che would you add yourself to github.com/rakudo/rakudo/blob/nom/CREDITS so the entiry shows up as you like in release announcement, please? 12:50
yoleaux unmatched}: I'll pass your message to El_Che.
unmatched} .tell titsuki would you add yourself to github.com/rakudo/rakudo/blob/nom/CREDITS so the entiry shows up as you like in release announcement, please? 12:51
yoleaux unmatched}: I'll pass your message to titsuki.
masak pmurias: locally: 12:58
$ bin/007 --backend=javascript -e='say("OH HAI, JavaScript backend")' | nodejs
OH HAI, JavaScript backend
:)
unmatched} \o/
masak (but hold your horses. it really only does `say` yet)
and it passes four tests
ItayAlmog I redid all of my code so it will work with my parser, So now you can declare variables (which is uses a hacky way for now because in perl 6 every thing is a class but i don't have classes yet...) 13:01
dalek c: 8ad489c | (Zoffix Znet)++ | CONTRIBUTING.md:
Add note about CREDITS file

Asking users to add selves, if they wish to use a name other than what the commit log gives.
ItayAlmog and you can also assign variables, now I am working on subroutines
El_Che off to a lego-like exposition (clics) with the kids 13:02
yoleaux 12:50Z <unmatched}> El_Che: would you add yourself to github.com/rakudo/rakudo/blob/nom/CREDITS so the entiry shows up as you like in release announcement, please?
El_Che laters
masak ItayAlmog: what parser are we talking about?
ItayAlmog about my parser for compiling Perl 6 to assembly 13:03
masak sounds... challenging :)
ItayAlmog This is the point :D 13:04
andreoss is there a way to define a class where all attributes is r/o? without specifing `is ro` for each attribute 13:10
unmatched} andreoss: that's the default behaviour. You don't need is ro 13:10
unmatched} :/ 13:11
unmatched} heh 13:11
andreoss it's not
m: class Foo { has $.x } ; my Foo $x .= new; $x.x = 1 ; $x.x = 2; say $x.x 13:12
camelia rakudo-moar f5ed6b: OUTPUT«Cannot modify an immutable Any␤ in block <unit> at <tmp> line 1␤␤»
unmatched} m: my $x = class { has $.foo }.new: :42foo; say $x.foo; $x.foo = 42; say $x 13:12
camelia rakudo-moar f5ed6b: OUTPUT«42␤Cannot modify an immutable Int␤ in block <unit> at <tmp> line 1␤␤»
andreoss m: class Foo { my $.x } ; my Foo $x .= new; $x.x = 1 ; $x.x = 2; say $x.x 13:13
camelia rakudo-moar f5ed6b: OUTPUT«2␤»
andreoss i see
unmatched} Ah, right, class attributes are rw 13:13
Then no, I'm unaware of a way to set class attributes to ro without is ro on each 13:14
perlpilot pretty sure it's class Foo is ro { ... } # or, it's intended to be. dunno if it's actually implemented 13:18
unmatched} m: class Foo is ro { my $.x } ; my Foo $x .= new; $x.x = 1 ; $x.x = 2; say $x.x 13:19
camelia rakudo-moar f5ed6b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤'Foo' cannot inherit from 'ro' because it is unknown.␤at <tmp>:1␤»
perlpilot now I'm pretty sure I've conflated a couple of memories ;)
unmatched} Why can't Perl 6 be parsed without executing some code? 13:21
Like, if I define sub infix:<+> { ... } does that get "run" or is it still ummm.. parsing time or whatever.
unmatched} is trying to answer "Why is that functionality acceptable (or perhaps desirable) to you? From where I am sitting, a language that cannot be parsed without evaluating it would be a deal breaker."
[Coke] unmatched}: if you define that sub, it impacts the compilation of the unit it's in. 13:23
unmatched} Right, but does anything get "evaluated"? 13:24
perlpilot unmatched}: It's acceptable to me because that's one of the ways we warp the language to closer match the problem domain 13:25
unmatched} perlpilot: so warping the language requires evaluation of some code, right?
perlpilot most times. 13:26
perlpilot unmatched}: What are you feelings about macros? 13:27
unmatched} "I've no idea what they are" 13:28
perlpilot strangelyconsistent.org/blog/macros...q-are-they 13:29
masak++
perlpilot although, I thought he also had some pointers to earlier non-perl6 stuff, but I don't see it in my quick search 13:30
anyway, reading all the stuff masak has written about P6 macros may prove instructive :) 13:31
Just search strangelyconsistent.org/blog/list-of-posts for all the posts with "macro" in the title 13:32
jnthn Just declaring a new operator isn't really something that causes code evaluation. Much better examples (that are already implemented) are EXPORT subs and doing various bits of meta-programming.
jnthn For example, a MOP module that hooks add_method to wrap a method up would need to run as methods are added, and methods are added at compile time because otherwise we can't do stuff like compile time role composition. 13:33
moritz .botsnack
synopsebot6 om nom nom
yoleaux :D
unmatched} jnthn++ thanks. That sounds very smarty-smart :D 13:35
unmatched} just copy-pastes jnthn's answer to www.reddit.com/r/programming/comme..._6/d6nkc54 13:37
jnthn Reddit'll find a way to make it a negative anyway :P 13:38
unmatched} :D 13:39
mst unmatched}: please check that my comment makes sense? 13:43
unmatched} Seems to yeah 13:44
mst++
mst it's easy for people to confuse themselves because it's the same language performing both roles, because the compiler's self hosting 13:45
mst fortunately I've spent enough time in stuff like lisp that instead of going "wtf" it makes me "omg squeeee", but it's totally understandable 13:46
TheLemonMan are nativecalls subs supposed to accept default arguments like regular subs ? 13:57
skids TheLemonMan: I don't know. That might just not be implemented yet, along with putting wrapper code around the {*} like in a proto. 14:38
m: proto sub foo ($s) { "OHAI".say; {*} }; multi foo ($s) { $s.say }; foo("THERE")
camelia rakudo-moar 1a16f6: OUTPUT«OHAI␤THERE␤»
unmatched} skids: did you want to appear as just "skids" in the credits? I forget if I asked you in past releases. 14:39
If not, please add self to github.com/rakudo/rakudo/blob/nom/CREDITS
skids unmatched}: do you want to do the whole PR dance or just add me? 14:48
unmatched} skids: I can add you, just let me know what to add 14:50
skids wonders how long the nick list is for unmatched} :-) 14:54
unmatched} :} 14:55
smls Hn, why does `zef install Inline::Python` say "Aborting due to build failure" 14:57
without giving more info
unmatched} Try with zef --debug
unmatched} "VERBOSITY LEVEL (from least to most verbose) -error, --warn, --info (default), --verbose, --debug" 14:58
smls ah, thanks 14:58
it was the 'ol python2 vs 3 issue again 15:00
needed to `sudo ln -sf python2 /usr/bin/python`
nine Have they still not given up on Python 3? 15:01
smls ;)
harmil_wk m: my \ℕ = ^Inf; say ℕ[^3]; for zip(ℕ, ^3) -> ($i, $n) { $i.say }; for ℕ -> $i { .say; last if (state $n = 0)++ >= 2 } 15:17
camelia rakudo-moar dd5c28: OUTPUT«(0 1 2)␤0␤1␤2␤(Any)␤(Any)␤(Any)␤»
harmil_wk Those first two behave as I would expect. Why do I get Any from the last one?
unmatched} harmil_wk: looks like you put the data in $i, yet are doing .say (which is on $_) 15:18
harmil_wk Doh!
Thanks
El_Che smls: are you sure you used spaced and no tabs in the command "zef install Inline::Python" 15:20
smls ? 15:21
El_Che bad joke :)
smls ah, I get it now :) 15:21
El_Che :) 15:22
dj_goku El_Che: haha zef install Inline::Python 15:23
El_Che :)
tadzik hahah 15:25
El_Che I have 2 computer jokes. The other one is 'have you tried to turn it on and off again', but it was less applicable :)
skids "You're not turning it off and on again fast enough, keep doing it faster till you see the sparks" 15:26
El_Che hehe
lucs And when quantum computers are a thing: "Have you tried turning it off and on at the same time?" 15:27
skids Why not we already have quantum USB ports -- you can't tell which way on the plug is up until you actually observe it to collapse the state. 15:28
El_Che haha 15:38
crucialrhyme does perl 6 support unicode identifiers? i'm very concerned with i18n and so would like to exclusively use emoji for variable names, to make sure code is understandable to non english speakers 15:42
nine crucialrhyme: it does. Though it does restrict identifiers to what Unicode thinks are characters that should be used for identifiers. 15:43
unmatched} m: sub term:<😹> { 42 }; say 😹
camelia rakudo-moar dd5c28: OUTPUT«42␤»
nine /msg cameli: my $😹 = 1 ; say $😹; 15:44
Woah
unmatched} m: sub term:<😹> is rw {$}; 😹 = 42; say 😹² 15:44
camelia rakudo-moar dd5c28: OUTPUT«1764␤»
nine my irssi's input is considerably screwed by using emoji
vcv mine too. same with vim 15:45
crucialrhyme this is legit though. tooling aside it's definitely only the cool languages that can do this
nine Or rather my terminal 15:46
TheLemonMan nine, definitely your terminal
unmatched} TheLemonMan: you're a core irssi dev? 15:47
TheLemonMan unmatched}, dev and evangelist heh 15:48
unmatched} :)
unmatched} hides his copy of weechat
El_Che Long live irssi!
timotimo weechat <3 15:53
haven't looked back :P
but irssi is still good
TheLemonMan wonders if the nameless blocks are a feature (or just a bug ? :)
vcv ffff~.~~~ 15:55
timotimo the nameless blocks of what?
vcv sorry, terminal was frozen for a minute
timotimo know that feel ;( 15:56
maybe you forgot to hit return before your .~?
TheLemonMan timotimo, 'sub x () { my $x = 1; given $x { when Int { die 3; } } }; x()' the ones shown in the backtrace
timotimo maybe we want to skip blocks that can't be called from anywhere else but the very place they're written down at? 15:57
TheLemonMan wrong example, meh, it's what #125477 15:57
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=125477
El_Che is weechat a fork or irssi? It look similar
kyclark How do I indicate that an sub should return an Array of Str?
timotimo no, it's a different codebase
TheLemonMan *what RT says
timotimo oh 15:58
that's fine, i think
unmatched} m: react { whenever IO::Socket::Async.connect('irc.freenode.net', 6667) -> $c { $c.print: "NICK NotZoffix\nUSER Z Z Z Z\nJOIN #perl6\nPRIVMSG #perl6 :Zoffix, stop messing around!!"; } } 16:06
camelia ( no output )
kyclark gist.github.com/kyclark/767cb16372...b20c813502 16:06
unmatched} m: react { whenever IO::Socket::Async.connect('irc.freenode.net', 6667) -> $c { $c.print: "NICK NotZoffix\nUSER Z Z Z Z\nJOIN #perl6\nPRIVMSG #perl6 :Zoffix, stop messing around!!"; whenever $c.Supply -> $buf {say $buf }; }
camelia rakudo-moar dd5c28: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3henever $c.Supply -> $buf {say $buf }; }7⏏5<EOL>␤»
unmatched} bah
timotimo i didn't realize the irc server would let you send your stuff before you've received the appropriate amount of other stuff 16:07
smls rosettacode.org/mw/index.php?title=...;limit=250 -- o.O does the author of the Sidef programming language ever rest? 16:08
unmatched} timotimo: some servers don't would ignore join until they send you 001, but freenode's not one of them
kyclark: ? The error message is correct
smls Interestingly, it seems Sidef has become more Perl 6-ish with this update, bowwowing the gather/take construct, @( ) contextualizer, etc. 16:09
*rr
timotimo kyclark: you can only pass that type check if you define an Array of Str and return that
kyclark: we won't go through an array and check if all its elements match Str 16:10
unmatched} m: react { whenever IO::Socket::Async.connect('irc.freenode.net', 6667) -> $c { $c.print: "NICK NotZoffix\nUSER Z Z Z Z\nJOIN #perl6\nPRIVMSG #perl6 :Zoffix, stop messing around!!"; whenever $c.Supply { .say } } } 16:10
unmatched} ah, damn, forgot the newline :) 16:10
camelia rakudo-moar dd5c28: OUTPUT«(timeout):barjavel.freenode.net NOTICE * :*** Looking up your hostname... 16:10
unmatched} m: react { whenever IO::Socket::Async.connect('irc.freenode.net', 6667) -> $c { $c.print: "NICK NotZoffix\nUSER Z Z Z Z\nJOIN #perl6\nPRIVMSG #perl6 :Zoffix, stop messing around!!\n"; whenever $c.Supply { .say } } } 16:11
NotZoffix Zoffix, stop messing around!! 16:11
unmatched} :D
camelia rakudo-moar dd5c28: OUTPUT«(timeout):barjavel.freenode.net NOTICE * :*** Looking up your hostname... 16:11
unmatched} is writing an article... on the topic 16:11
timotimo i find it amusing to see the output from the IRC server appear on camelia's output 16:12
kyclark: does my explanation help?
smls unmatched}: If you know about this stuff, could you also review my rosettacode entry here? rosettacode.org/wiki/Chat_server#Perl_6 16:13
I'm still slightly unsure if it's all thread-safe and correct. 16:14
kyclark Yes. If I lose the return type, I'm not getting the output I expect. gist.github.com/kyclark/767cb16372...b20c813502
I would expect each kmer (string) to be on a separate line
timotimo you're joining the kmers with \t instead of \n 16:15
kyclark D'oh!
timotimo :) 16:15
unmatched} smls: no, hash assignment like that is not thread safe 16:16
smls even in react/whenever?
timotimo correct, because the hash can grow when you assign
kyclark This is ugly and I wouldn't do it for reals but I was curious if this would work (it doesn't)
put map { $seq.seq.substr($_, $k) }, 0..^{ $seq.seq.chars - $k + 1};
unmatched} smls: right. It doesn't automatically lock it for you. 16:16
timotimo kyclark: maybe you want to use a rotor over the .comb of your input sequence 16:17
kyclark Hmm, I'll have to read some docs
unmatched} kyclark: this may be of help: perl6.party/post/Perl6-Comb-It perl6.party/post/Perl-6-.rotor-The-...nipulation
smls unmatched}: Doesn't the react make sure to only run one instance of the whenever at a time?
timotimo smls: one thought that comes to mind: use supply instead of react, "emit" every pair you want to assign to the hash, then .tap the resulting supply and mutate the hash from there
smls or something
timotimo smls: i've had this explained to me on multiple occasions, but i still always forget ... 16:18
unmatched} smls: would that make it not concurrent? 16:18
s/would/wouldn't/;
lizmat waves from Prague 16:19
unmatched} \o
timotimo hey lizmat!
smls unmatched}: I think it would make it like Supply.act instead of Supply.tap
timotimo that must have been a long bike ride! :)
AlexDaniel m: mkdir ‘test’
camelia rakudo-moar dd5c28: OUTPUT«mkdir is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub mkdir at src/RESTRICTED.setting line 8␤ in block <unit> at <tmp> line 1␤␤»
lizmat timotimo: yup, and sideways at that, at max 180km/hour :-)
AlexDaniel what should I do to make mkdir throw an excetion? 16:20
timotimo holy hell
smls AlexDaniel: use the .IO.mkdir form 16:21
AlexDaniel smls: right 16:21
unmatched} smls: then react { whenever { ... } } would be no different than loop { for { ... } }
smls hm... 16:22
unmatched} smls: I'm gonna test it out and see 16:22
lizmat afk until later&
AlexDaniel alright, whatever… Do we have any module for file locks? 16:24
kyclark Now with rotor. Comments? 16:28
gist.github.com/kyclark/767cb16372...b20c813502
unmatched} m: my $c = Channel.new; my %h; react { whenever Supply.interval(.001) { %h{$_} = $_; $c.send: $_; done if 20 < (now - INIT now) } }; $c.close; dd [ +(keys %h), +($c.list) ] 16:29
camelia rakudo-moar dd5c28: OUTPUT«Unhandled exception in code scheduled on thread 4␤Access denied to keep/break this Promise; already vowed␤ in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1␤ in block at <tmp> line 1␤ in block at /home/cam…»
unmatched} What are those exceptions/access denied are about?
nine AlexDaniel: IO::Handle has lock and unlock 16:30
unmatched} m: Channel.new.list; 16:32
camelia ( no output )
AlexDaniel nine: how does it work? 16:34
AlexDaniel uhhhhhhhh github.com/MoarVM/MoarVM/blob/99bf.../io.c#L352 16:37
timotimo that's not what file locks mean :) 16:40
i don't think?
depends on what the repr behind the IO::Handle things locking means
geekosaur how can you tell what it's doing? impl is the same as e.g. flush, all the real logic is in libuv 16:42
timotimo fails at searchign for it
dalek -six-help: 7ec6c7f | coke++ | summary.p6:
track [MATH]
17:31
dalek c: c082929 | titsuki++ | doc/Type/Signature.pod6:
Add an index for ;;
17:39
c: 1966354 | titsuki++ | doc/Type/Signature.pod6:
Merge pull request #842 from titsuki/fix-double-semicolon

Add an index for ;;
unmatched} smls: no idea. I can't think of a test that has a good chance to get a race condition whithout hitting a bug I've just discovered. Maybe someone smarter can tell whether react { whenever Supply } is like an .act or like a .tap ¯\_(ツ)_/¯ 17:41
unmatched} (the docs do say "tap the supply", so if it's an .act, they should be amended) 17:41
sena_kun 17:42
yoleaux 10:36Z <Zoffix> sena_kun: please add yourself to github.com/rakudo/rakudo/blob/nom/CREDITS if you don't want to show up as `Altai-man` in credits.
sena_kun Zoffix, I do want, so don't bother. (: 17:45
unmatched} noted 17:46
dalek -six-help: 1019430 | coke++ | summary.p6:
track [REGEX]
17:47
unmatched} buggable: rt 17:50
buggable unmatched}, TOTAL: 1381, UNTAGGED: 471, BUG: 449, LTA: 108, JVM: 64, NYI: 42, CONC: 40, RFC: 36, SEGV: 34, UNI: 29, PERF: 25, REGEX: 21, @LARRY: 17, POD: 14, NATIVECALL: 14, PRECOMP: 12, TODO: 10, BUILD: 8, STAR: 5, GLR: 4, WEIRD: 3, BOOTSTRAP: 3, MOARVM: 2, MATH: 2, OSX: 2, WEB: 1, IO: 1, REGX: 1, LHF: 1, SPESH: 1, DOCS: 1, REPL: 1 Details: bug.perl6.party/1471629057.html
dalek c/revert-842-fix-double-semicolon: c882ef6 | titsuki++ | doc/Type/Signature.pod6:
Revert "Add an index for ;;"
17:52
dalek c: c882ef6 | titsuki++ | doc/Type/Signature.pod6:
Revert "Add an index for ;;"
17:57
c: 93cdcb6 | titsuki++ | doc/Type/Signature.pod6:
Merge pull request #843 from perl6/revert-842-fix-double-semicolon

Revert "Add an index for ;;"
unmatched} modifies perl6advent.wordpress.com/ to close rt.perl.org/Ticket/Display.html?id=127127 18:06
dalek c: 94b889e | titsuki++ | doc/Type/Signature.pod6:
Fix a ;; index again (use C<<;;>>)
18:07
c: 6d26699 | titsuki++ | doc/Type/Signature.pod6:
Merge pull request #844 from titsuki/fix-double-semicolon-again

Fix a ;; index again (use C<<;;>>)
nine AlexDaniel: it's really just flock(2) 18:18
AlexDaniel nine: ah, so .lock on IO::Handle is flock, did I get that right?
AlexDaniel committable6: releases my @a[;]; 18:19
AlexDaniel whoah 18:19
bisectable6: good=2016.07 my @a[;]; 18:20
AlexDaniel well 18:20
AlexDaniel bisectable6: good=2016.07 my @a[;]; 18:21
AlexDaniel “Heap corruption detected: pointer 0x7f6130b132f0 to past fromspace” 18:21
unmatched} past fromspace! :D
future tospace!
AlexDaniel well, it does not look like my fault, right? 18:22
AlexDaniel committable6: 2016.07 my @a[;]; 18:22
AlexDaniel committable6: 2016.07 say ‘hello’ 18:23
committable6 AlexDaniel, ¦«2016.07»: hello
unmatched} That doesn't error out on bleed 18:23
m: my @a[;]; 18:24
camelia ( no output )
unmatched} Nothing sinister in REPL either, so seems like that ticket can be closed with tests
AlexDaniel committable6: 2016.07 ;
committable6 AlexDaniel, ¦«2016.07»:
[Coke] didn't I just comment on that ticket? 18:25
what's the ticket #, ad?
AlexDaniel #126979
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=126979
[Coke] it was still broken in 2016.07.01
checking.
AlexDaniel still, it makes bisectable and committable die… why? Whyyy? 18:26
committable6: HEAD my @a[;];
committable6 AlexDaniel, ¦«HEAD»:
unmatched} Probably fixed by this one: github.com/rakudo/rakudo/commit/59...09aee6dbbf
AlexDaniel committable6: HEAD~50 my @a[;];
committable6 AlexDaniel, ¦«HEAD~50»:
[Coke] yup, was fixed since 2016.07.1
AlexDaniel committable6: HEAD~100 my @a[;];
committable6 AlexDaniel, ¦«HEAD~10»:
[Coke] 'will update comment.
AlexDaniel committable6: HEAD~300 my @a[;];
unmatched} 'cause IIRC that fixed the barf with @[;] or whatever that short code was 18:26
AlexDaniel unmatched}: yeah, I thought about it too 18:27
[Coke] Done.
AlexDaniel unmatched}: have a commit hash that fixed it?
unmatched} points up :)
AlexDaniel omg, I'm blind
dalek c/revert-844-fix-double-semicolon-again: ec8929a | titsuki++ | doc/Type/Signature.pod6:
Revert "Fix a ;; index again (use C<<;;>>)"
AlexDaniel committable6: 59b7e51b34 my @a[;]; 18:27
committable6 AlexDaniel, ¦«59b7e51»: 18:28
AlexDaniel committable6: 59b7e51b34~1 my @a[;];
committable6 AlexDaniel, ¦«59b7e51»: ===SORRY!===␤Unknown QAST node type BOOTInt «exit code = 1»
AlexDaniel committable6: 59b7e51b34~2 my @a[;];
dalek c: 000a24d | smls++ | doc/Language/operators.pod6:
Improve explanation of reduction operators

  * Fixed some incorrect/outdated info.
  * Made some sentences less confusing.
  * Linked to </routine/reduce>, made sure not to duplicate its info
   on reduction semantics, and instead focus on the syntactical
   details of the operator form.
c: 234e846 | smls++ | doc/Language/operators.pod6:
Remove the "user defined" example in the Reduction Operators section

As far as I can see, this example does not belong here. Contrary to what it claims, it doesn't define a reduce operator - it merely defines a completely custom operator that happens to use square brackets in its symbol. Nor is is the functionality it implements related to reduce - rather, it seems to re-implement (part of) the functionality of the built-in `map` routine.
AlexDaniel so there you have it ;)
unmatched} \o/
Xliff Have a weird SEGV in rakudo 18:30
Not golfed. I don't know how I would start to golf this.
dalek c: ec8929a | titsuki++ | doc/Type/Signature.pod6:
Revert "Fix a ;; index again (use C<<;;>>)"
c: 871ab84 | titsuki++ | doc/Type/Signature.pod6:
Merge pull request #845 from perl6/revert-844-fix-double-semicolon-again

Revert "Fix a ;; index again (use C<<;;>>)"
Xliff I'll start writing up a gist.
unmatched} Xliff: on HEAD? and does it involve Proc::Async ?
AlexDaniel “Internal error: zeroed target thread ID in work pass”…
AlexDaniel bisectable: my @a[;]; 18:31
right, it will time out 18:32
at least it does not crash /o\ 18:33
ok stop
Xliff unmatched}, not sure. Looks like it involves Inline::Perl5 18:37
travis-ci Doc build failed. Itsuki Toyota 'Merge pull request #845 from perl6/revert-844-fix-double-semicolon-again 18:41
travis-ci.org/perl6/doc/builds/153639375 github.com/perl6/doc/compare/234e8...1ab84ea124
Xliff gist.github.com/Xliff/a835c15ae283...d7b2b4ebc2 18:44
^^ describes SEGV 18:49
[Coke] your backtrace starts in a perl 5 function, so yes, Inline::Perl5 18:55
what version of I::p5 are you using?
unmatched} And Rakudo. Recently my SEGV with Perl 5's Mojolicious went away... 18:56
So ensure you're using latest and greatest of everything
[Coke] unmatched}: This is Rakudo version 2016.07.1-225-g5f2818b built on MoarVM version 2016.07-17-g40948f6 18:58
implementing Perl 6.c.
unmatched} m: 18:59
m: ''
camelia rakudo-moar 079da9: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant string "" in sink context (line 1)␤»
[Coke] also, maybe, what version of perl 5?
harmil_wk Seeing Perl_yyparse in a backtrace... ah memories... and PTSD 19:10
AlexDaniel “fatal: write failure on 'stdout': Connection reset by peer” 19:11
/o\
[Coke] m: enum Suit <♠ ♥ ♣ ♦> is export;
camelia rakudo-moar 079da9: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3enum Suit <♠ ♥ ♣ ♦>7⏏5 is export;␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
[Coke] that's a change.
harmil_wk AlexDaniel: y u reset? :)
AlexDaniel committable6: releases enum Suit <♠ ♥ ♣ ♦> is export;
committable6 AlexDaniel, gist.github.com/7992880d5516a894a5...6b08008284
Xliff OK. Updating Inline::Perl5 19:13
harmil_wk Is &?ROUTINE read-only?
smls m: enum Suit is export <♠ ♥ ♣ ♦>; # [Coke]
camelia ( no output )
AlexDaniel arguably it is LTA because it could've suggested that 19:14
[Coke] smls: huh. wonder when that changed. (digging up an old p6 project) 19:15
thanks
masak harmil_wk: I should hope so! :P
harmil_wk: what are you trying to achieve, exactly?
[Coke] oh, and I also had this:
m: enum Suit <a b c>; class Suit is { ... }; 19:16
camelia rakudo-moar 079da9: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Invalid name␤at <tmp>:1␤------> 3enum Suit <a b c>; class Suit is7⏏5 { ... };␤»
[Coke] m: enum Suit <a b c>; class Suit { ... };
camelia rakudo-moar 079da9: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Redeclaration of symbol Suit␤at <tmp>:1␤------> 3enum Suit <a b c>; class Suit7⏏5 { ... };␤ expecting any of:␤ generic role␤»
masak [Coke]: those look right to me.
harmil_wk masak: Was trying to figure out if you could attach docs to a routine that way. If you were auto-translating Python, for example, the first sink-context string before code is the doc.
Nominally, such a string shouldn't do any work, but it can in Python... kind of sketchy that way. 19:17
masak oh yes, those """ strings 19:18
well, "do any work" might be a bit of a stretch. it does have an effect, but it's definitely on the declarative side
harmil_wk Oh, I'm wrong. If you do any work, python will ignore it
masak harmil_wk: I guess you're already aware that one can attach Pod documentation to things? 19:19
[Coke] masak: yes, I'm saying that I had working code before with both kinds of Suits.
grondilu I wonder why they used a string and not just comments.
[Coke] now has to decide what he meant.
masak [Coke]: oh! you expected it to work having an `enum` and a `class` with the same name like that? 19:20
harmil_wk masak: yeah, I was just trying to figure out what the minimal change would be. I think that's the right thing to do... it's a project for the back-back-burner, though.
unmatched} m: #`(some docs)␤sub foo {}␤say foo.WHY
camelia rakudo-moar 079da9: OUTPUT«(Any)␤»
unmatched} harmil_wk: FWIW, I forget the exact syntax, but Perl 6 does have a way of attaching docs to a sub. They'd be accessible via .WHY
grondilu you need #|
[Coke] masak: ... it USED TO WORK 19:21
Xliff Wow! SEGV has been banished!
unmatched} m: #|some docs␤sub foo {}␤say foo.WHY
camelia rakudo-moar 079da9: OUTPUT«(Any)␤»
masak [Coke]: yes, I hear you.
unmatched} m: #|(some docs)␤sub foo {}␤say foo.WHY
camelia rakudo-moar 079da9: OUTPUT«(Any)␤»
grondilu hum
Xliff Updating gist.
masak [Coke]: but I was still surprised at your expectation. I know Rakudo has bugs :)
grondilu m: #=(some docs)␤sub foo {}␤say foo.WHY
camelia rakudo-moar 079da9: OUTPUT«(Any)␤»
[Coke] ponders just nuking this project from orbit and starting over.
harmil_wk Next question, more relevant to active work: I recall someone saying that some work was done at some point on importing the OEIS sequences, but that that was dropped.
[Coke] I only expected it to work in Dec 2014, apparently. 19:22
harmil_wk Is there anything left of that, since I now have a module half-written, I don't want to step on anything that's already there.
[Coke] harmil_wk: yah, we're not doing that.
moritz harmil_wk: I don't think it was ever seriously planned for core
harmil_wk: but for a module, that's a good idea
unmatched} m: gist.github.com/zoffixznet/1f0b59a...158cfc8035
camelia rakudo-moar 079da9: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Invalid typename 'Spell' in parameter declaration.␤at <tmp>:1␤------> 3sub cast(Spell7⏏5 $s)␤»
unmatched} m: #= some docs␤sub foo {}␤say foo.WHY 19:23
camelia rakudo-moar 079da9: OUTPUT«(Any)␤»
unmatched} Oh, damn
m: #= some docs␤sub foo {}␤say &foo.WHY
camelia rakudo-moar 079da9: OUTPUT«Nil␤»
unmatched} ~_~
harmil_wk moritz: thanks. Yeah, I started with just wanting to have a more functional ℤ, ℕ and ℝ and then it got... out of hand :-)
moritz harmil_wk: the usual terminology is "that escalated quickly" :-) 19:24
harmil_wk yes, exactly. only when dealing with OEIS "quickly" has lots of definitions :-)
unmatched} m: sub foo␤ #= some docs␤ {}␤say &foo.WHY 19:25
camelia rakudo-moar 079da9: OUTPUT«some docs␤»
unmatched} There we go :) lol took awhile
masak harmil_wk: pretty sure there must've been a toggled "kidding" bit on that conversation
harmil_wk :) 19:26
grondilu so the #= must be just before the opening curly?? I had no idea. 19:27
makes sense, though. 19:28
grondilu hang on 19:33
unmatched} hangs off 19:34
grondilu #| { test } sub {}.WHY.say
m: #| { test } sub {}.WHY.say
camelia ( no output )
unmatched} m: #| { test } ␤sub {}.WHY.say
camelia rakudo-moar 3c2e29: OUTPUT«{ test }␤»
grondilu not sure why the newline is required 19:35
m: (#| { test } sub {}).WHY.say
camelia rakudo-moar 3c2e29: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in parenthesized expression; couldn't find final ')' ␤at <tmp>:1␤------> 3(#| { test } sub {}).WHY.say7⏏5<EOL>␤»
grondilu m: #| { test } sub foo {}; say foo.WHY
camelia ( no output )
unmatched} It just treats it as a comment, I presume
m: #| { test } ␤sub foo {}; say &foo.WHY 19:36
camelia rakudo-moar 3c2e29: OUTPUT«{ test }␤»
unmatched} m: #| meow ␤sub foo {}; say &foo.WHY
camelia rakudo-moar 3c2e29: OUTPUT«meow␤»
unmatched} The reason it wasn't working for me above is 'cause I forgot the & on the sub
grondilu m: #= { test } sub {}.WHY.say
camelia ( no output )
unmatched} m: #=(test) sub {}.WHY.say 19:37
camelia rakudo-moar 3c2e29: OUTPUT«Nil␤»
grondilu ^I suspect this not working is a bug
grondilu unmatched}: if you don't end by newline you must use curlies 19:38
unmatched} m: #={ test } sub {}.WHY.say
camelia rakudo-moar 3c2e29: OUTPUT«Nil␤»
grondilu m: #= { test } sub {}.WHY.say # <- this not working is suspicious
camelia ( no output )
grondilu m: #= { test } sub {}.WHY.say; say "alive!"
camelia ( no output )
grondilu oh 19:39
m: #={ test } sub {}.WHY.say; say "alive!"
camelia rakudo-moar 3c2e29: OUTPUT«Nil␤alive!␤»
grondilu Ic
unmatched} Well, I don't see a problem with that. It just it assumes it's a regular comment when there's space after |= or whatever
grondilu yeah I forgot that the space makes it ignore the opening curly
I'm not familiar with those things 19:40
Xliff m: @a = <<a b c>>; say @a 19:44
camelia rakudo-moar 3c2e29: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@a' is not declared␤at <tmp>:1␤------> 3<BOL>7⏏5@a = <<a b c>>; say @a␤»
Xliff m: my @a = <<a b c>>; say @a
camelia rakudo-moar 3c2e29: OUTPUT«[a b c]␤»
Xliff m: my @a = <<a b c>>; dd @a
camelia rakudo-moar 3c2e29: OUTPUT«Array @a = ["a", "b", "c"]␤»
harmil_wk Mathematical / philosophical / perhaps religious question... Should ℕ.elems give Inf or fail? I'm leaning toward Inf... 20:08
It's technically imprecise as I think it's something like 2^aleph0 but for all Perl really cares, I think Inf is fine. 20:09
grondilu m: constant ℕ = ^Inf; say ℕ[^10] 20:20
camelia rakudo-moar 920295: OUTPUT«(0 1 2 3 4 5 6 7 8 9)␤»
grondilu that'd be a fun constant to define
moritz harmil_wk: we don't do different infiniteies :-)
tailgate^2 m: ℕ.elems 20:24
camelia rakudo-moar 920295: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ ℕ used at line 1␤␤»
tailgate^2 m: constant ℕ = ^Inf; say ℕ.elems 20:24
camelia rakudo-moar 920295: OUTPUT«Inf␤»
harmil_wk tailgate: Yeah, the default would definitely be Inf. I'm inclined to go that way 20:36
moritz: Not... yet ;-) 20:37
grondilu: It's in the module I'm writing along with ℤ, ℝ and lots of OEIS sequences. 20:38
grondilu ℝ can not be a sequence though, can it? 20:44
sena_kun grondilu, it cannot. 20:46
harmil_wk grondilu: it can. There are only limited things you can reason about it. It's essentially "-Inf, {fail "Not countable"} ... Inf" Same problem, to a lesser extent with the Integers
But it's useful in a few contexts as a sentinel value, for assertions and a few other things. 20:47
harmil_wk One good example is you should be able to ask "is pi in ℝ" and get True, but "is 1i in ℝ" should give False. 20:53
Xliff Is there an easy way to currency print in P6 so that 1000 becomes "$1,000"? 20:54
grondilu pi is defined as a Rat though, so it's not in R 20:55
grondilu Xliff: not builtin. But a module would be welcome 20:55
there may be a printf code for thousand separator though 20:56
m: printf "%'d", 1e6 20:57
camelia rakudo-moar 920295: OUTPUT«Directive 'd is not valid in sprintf format sequence %'d␤ in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1␤ in any panic at /home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm line 1␤ in any statement a…»
Xliff m: my $a = "100000"; say $a.comb(3)
camelia rakudo-moar 920295: OUTPUT«(100 000)␤»
Xliff m: my $a = "100000"; say $a.comb(3).join(',')
camelia rakudo-moar 920295: OUTPUT«100,000␤»
Xliff m: my $a = "1000000"; say $a.comb(3).join(',')
camelia rakudo-moar 920295: OUTPUT«100,000,0␤»
Xliff D'oh
grondilu bash supports %' 20:58
Xliff m: my $a = "1000000"; say $a.reverse.comb(3).reverse.join(',')
camelia rakudo-moar 920295: OUTPUT«Cannot resolve caller comb(List: Int); none of these signatures match:␤ (Cool $: *%_)␤ (Cool $: Regex $matcher, $limit = Inf, *%_)␤ (Cool $: Str $matcher, $limit = Inf, *%_)␤ in block <unit> at <tmp> line 1␤␤»
Xliff m: my $a = "1000000"; say $a.reverse.comb(3)
camelia rakudo-moar 920295: OUTPUT«Cannot resolve caller comb(List: Int); none of these signatures match:␤ (Cool $: *%_)␤ (Cool $: Regex $matcher, $limit = Inf, *%_)␤ (Cool $: Str $matcher, $limit = Inf, *%_)␤ in block <unit> at <tmp> line 1␤␤»
Xliff m: my $a = "1000000"; say $a.reverse
camelia rakudo-moar 920295: OUTPUT«(1000000)␤»
Xliff Humm...
harmil_wk grondilu: all rationals are real. You're talking types, I'm talking ranges.
ℝ is not a type (even though the category theorists will try to assert that there's little difference) 20:59
grondilu well we do have Real, don't we? Or maybe I'm not sure what your point is. 21:00
grondilu m: say pi ~~ Real; say 1i ~~ Real 21:00
camelia rakudo-moar 920295: OUTPUT«True␤False␤»
harmil_wk You're still talking about type comparisons. As you pointed out a Rat is not a Real, but the value you put in a Rat is a "real number". 21:01
grondilu oh yeah.
of course what I wrote above was inaccurate indeed
harmil_wk I find it interesting that pi is Real... I assumed it was a Rat too 21:02
grondilu well Real is a Role implemented by Rats
(IIRC)
harmil_wk I thought that was Rational and Rat was a class... maybe I have it backwards. 21:03
grondilu Perl6's Real is the closest you can get from math's concept of Real numbers.
MasterDuke m: my $a = "1000000"; say $a.flip.comb(3).reverse.join(',') 21:04
camelia rakudo-moar 920295: OUTPUT«1,000,000␤»
harmil_wk Yeah, it's definitely better than a machine float
MasterDuke Xliff: is that ^^^ what you were looking for?
grondilu it's a bit unfortunate that "Complex" is not the equivalent for complex numbers, if you ask me.
geekosaur Rat is class, Rational is role, Real is role (done by Rational)
grondilu m: say 1 ~~ Complex # arguably that should be true 21:05
camelia rakudo-moar 920295: OUTPUT«False␤»
harmil_wk $a.flip.comb ... I find myself thinking it should say, "aaaayyyyy" after that.
kyclark Is there a way to trigger the default USAGE from within a script? 21:06
kyclark Also, could I add a statement to it? E.g., “k must be positive”? 21:06
timotimo m: say USAGE 21:07
camelia rakudo-moar 920295: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤ USAGE used at line 1␤␤»
timotimo m: say &*USAGE
camelia rakudo-moar 920295: OUTPUT«Dynamic variable &*USAGE not found␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
timotimo m: say $*USAGE
camelia rakudo-moar 920295: OUTPUT«Dynamic variable $*USAGE not found␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
timotimo m: say $USAGE
camelia rakudo-moar 920295: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$USAGE' is not declared␤at <tmp>:1␤------> 3say 7⏏5$USAGE␤»
timotimo i don't even know
grondilu $?USAGE exists in the source
timotimo ah, that one
grondilu m: say $?USAGE
camelia rakudo-moar 920295: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$?USAGE' is not declared␤at <tmp>:1␤------> 3say 7⏏5$?USAGE␤»
grondilu lol 21:08
kyclark So I’ve declared a “subset PosInt of Int where * > 0;” and then I have “PosInt $k”
MAIN prints USAGE if I pass -k=-3, but it doesn’t say why
Xliff MasterDuke, LOL! That's actually pretty close to what I came up with. 21:08
grondilu kyclark: UInt exists in the core
Xliff m: "10000000".flip.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«10,000,000␤»
grondilu m: say sub (UInt $) {}
camelia rakudo-moar 920295: OUTPUT«sub (Int $ where { ... }) { #`(Sub|69905928) ... }␤»
Xliff MasterDuke, I think I like yours better. 21:09
Thanks!
MasterDuke welcome 21:10
kyclark Hmm, UInt is good, thanks!
Xliff Ack!
MasterDuke...
m: my $a = "10000000"; say $a.flip.comb(3).reverse.join(',')
camelia rakudo-moar 920295: OUTPUT«01,000,000␤»
Xliff Mine gets that right.
*sob* -- the syntax of .flip.comb(3).reverse.join(',') sounds like it DWIM though! 21:11
m: "10000000".flip.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«10,000,000␤»
Xliff m: "10000000".flip.comb(3).join(',') 21:11
camelia ( no output )
Xliff m: "10000000".flip.comb(3).join(',').say
camelia rakudo-moar 920295: OUTPUT«000,000,01␤»
Xliff LOL
kyclark Can I “die” without the trace info? 21:14
masak kyclark: you can "note" and then "exit" 21:15
kyclark OK
masak probably exit(1) or some other nice non-zero exit code
Xliff m: "3859486323".flip.comb(3).join(',').say 21:17
camelia rakudo-moar 920295: OUTPUT«323,684,958,3␤»
Xliff m: "3859486323".flip.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«3,859,486,323␤»
Xliff ARGH! This gets complex with floating point. 21:19
m: "3859486323.81".flip.comb(3).join(',').flip.say 21:20
camelia rakudo-moar 920295: OUTPUT«3,859,486,323,.81␤»
Xliff m: "3859486323.81667".flip.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«3,859,486,323,.81,667␤»
perlpilot why the spurious quotes? :)
MasterDuke m: "3859486323.81667".flip.comb(3).join(,).flip.say 21:21
camelia rakudo-moar 920295: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix , instead␤at <tmp>:1␤------> 3"3859486323.81667".flip.comb(3).join(,7⏏5).flip.say␤»
MasterDuke don't think any of the quotes are spurious? 21:22
geekosaur quotes around the number are superfluous (Cool)
grondilu m: say 1i.im
camelia rakudo-moar 920295: OUTPUT«1␤»
MasterDuke m: 3859486323.81667 .flip.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«3,859,486,323,.81,667␤»
MasterDuke m: 3859486323.81667.flip.comb(3).join(',').flip.say 21:23
camelia rakudo-moar 920295: OUTPUT«3,859,486,323,.81,667␤»
grondilu since we were talking about it, couldn't we define Complex as a role and have Real implement it? Something like role Real does Complex { method im { 0 } }
MasterDuke only since the flip comes first, couldn't comb() directly after 21:24
m: 3859486323.81667.comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«Cannot resolve caller comb(Rat: Int); none of these signatures match:␤ (Cool $: *%_)␤ (Cool $: Regex $matcher, $limit = Inf, *%_)␤ (Cool $: Str $matcher, $limit = Inf, *%_)␤ in block <unit> at <tmp> line 1␤␤»
MasterDuke m: 3859486323.81667 .comb(3).join(',').flip.say
camelia rakudo-moar 920295: OUTPUT«Cannot resolve caller comb(Rat: Int); none of these signatures match:␤ (Cool $: *%_)␤ (Cool $: Regex $matcher, $limit = Inf, *%_)␤ (Cool $: Str $matcher, $limit = Inf, *%_)␤ in block <unit> at <tmp> line 1␤␤»
perlpilot btw, does RosettaCode have a commify routine? It probably should 21:37
(hint, hint :)
grondilu what's "commify"? 21:38
perlpilot docstore.mik.ua/orelly/perl/cookbook/ch02_18.htm
It was actually an example in Programming Perl IIRC 21:39
grondilu all languages will probably use this very regex, though.
so it's of relatively little interest for RosettaCode 21:40
IMHO
perlpilot perhaps
grondilu feel free to make a draft task though. It's quite easy to do. 21:41
grondilu m: role C {...}; role R does C { method b returns C { C } }; role C { method a returns R {...}; method b returns R {...} }; # testing if circularity 21:55
camelia ( no output )
grondilu .=trans(C => "Complex", R => "Real") 21:56
I mean I remember being annoyed when I had to explicity convert an Int to Complex when feeding a function that accepted Complex arguments. That should not be so. 21:57
grondilu m: sub (Complex $z) { say "$z" }(1) 21:57
camelia rakudo-moar 920295: OUTPUT«Type check failed in binding to $z; expected Complex but got Int (1)␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
grondilu ^that's LTA if you ask me
"expected Complex but got Int" <-- that's just embarassing, really. 21:58
geekosaur I think you just proved your point about having a Complex role
masak numeric types not matching type-wise the way they naturally embed math-wise continues to be a surprise to people at all levels of Perl 6... :) 22:00
geekosaur it does seem not-Perl-ish 22:01
in Haskell it makes perfect sense
grondilu masak: yes TimToady once told me the same thing. I'm just not still convinced.
masak not trying to convince anyone of anything right now 22:02
just stating a fact about surprise
grondilu rather he told me that was a conscious decision not to nest numeric types as in maths or something. 22:02
masak well, I do think it's a very Liskov notion to say that an Int isn't a type of Rat 22:03
nor is a Rat a type of Num
you might argue that Perl 6 comes at it from how the types are represented (efficiently), not how they nest mathematically 22:04
El_Che still about the errors: does rakudo only output utf8 errors? I am thinking of ⏏ (I tried using LANG C and stuff and it looks like utf8 only) 22:05
grondilu one day, if I ever find time and courage, I'll rewrite the whole thing with roles and stuff, and see if that runs the spectests and if we lose any performance. 22:06
geekosaur performance is likely to suffer, yes 22:07
masak grondilu: also consider things like `if $n ~~ Rat`, but then it's actually an Int, but under your regime suddenly it matches True 22:08
grondilu not that I doubt there is any, but I'm struggling to see an example of use case where you really want to check that a variable is really a Rat and not an Int. 22:11
masak grondilu: I'm just pointing out that there's the risk of people writing `if $n ~~ Rat` while not considering that Int would be included in that check. 22:15
grondilu also in any case you could write if $n.denominator !== 1
masak yes, but you'd *have to*, that's my point
grondilu true
masak for all its faults, with the current factoring, you don't have to do anything like that
you also don't have to live in a world where an Int has a .denominator :) 22:16
grondilu but they do :/
masak I'm almost ready to classify that response as some kind of Stockholm syndrome 22:17
but let's call it a simple disagreement for now ;)
grondilu I do see how that's can be confusing though. To be frank none of the points of view entirely satisfy me. 22:19
masak fair enough 22:22
[Coke] (numeric types not the same hier as maths) could be done in a Math:: module. 22:29
kyclark I just wrote up a section on types. I’d appreciate any input. kyclark.gitbooks.io/metagenomics/c...types.html 22:33
grondilu [Coke]: in order to be useful such a module would have to override literals. That can be tough to write. 22:34
masak you could override literals in a slang 22:39
grondilu yes. I'll try that one of these days. 22:43
harmil_wk m: class Foo is Range { multi method new(:$min=0, :$max=10, :$excludes-min = True, :$excludes-max = False) { nextwith :$min, :$max, :$excludes-min, :$excludes-max } }; say Foo.new.excludes-min 23:05
camelia rakudo-moar 920295: OUTPUT«False␤»
harmil_wk How can that be false? I'm setting it to True...
geekosaur m: my $s = Range.new(:min(0), :max(10), :excludes-min, :!excludes-max); say so $s.excludes-min 23:11
camelia rakudo-moar 920295: OUTPUT«False␤»
masak m: say Range.new(:excludes-min(True)).excludes-min 23:11
camelia rakudo-moar 920295: OUTPUT«False␤»
geekosaur I suspect excludes-min is not a keyword parameter to the Range constructor, so does nothing when nextsame-d
and theres no sane way to report "no constructor along the build plan used this keyword"
(sadly) 23:12
er nextwith-d
masak 'night, #perl6 23:16
japhb Good night, masak! 23:17
Sleep well ...
timotimo we alaread have a slang that lets you override literals 23:38