»ö« 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.
lookatme morning 00:29
sacomo morning 01:06
zengargoyle hrm, i wonder if rakudo is actually relocatable without recompilation... could one build p6 to /opt/perl6 and then `mv /opt/perl6 /usr/local` and have it still work? 02:16
Morfent didn't work when i fucked up and built it in /usr/local/bin/bin 02:17
zengargoyle i know p5 took a few flags to be able to be relocatable. my only p5 contribution was making sitelocal work with relocatableinc. :) 02:19
MasterDuke zengargoyle: it's not currently relocatable 02:21
zengargoyle i fear perl6hobo's idea of zipping up a folder isn't goint to work in the "just unzip the folder somewhere and it will work" way.
MasterDuke: thanks, sorta didn't think it was. 02:22
MasterDuke i think mst has done some work to make it more so, but that hasn't made its way into the repo yet 02:23
zengargoyle ah, cool. 02:24
reino4477 how can I read an enviromental variable, for example, $SHELL? 02:43
AlexDaniel %ENV<SHELL>
m: say %*ENV<SHELL>
camelia /bin/bash
AlexDaniel sorry, %*ENV<SHELL>
with * 02:44
reino4477 ok
why is the * required? %ENV<SHELL> --> doesn't work 02:45
geekosaur the latter is a lexical variable. the * twigil indicates a dynamic variable 02:47
AlexDaniel See this also: docs.perl6.org/language/variables#..._variables
reino4477 thx
reino4477 I have a method which accepts a dictionary. How can I a) specify the names of keys it expects b) specify what keys can be passed together and which can't? 02:56
for example "connect(:url => "someurl")" or "connect(:user_name => "fdsfd", password => "passw")" but url and user_name/pass can't be passed at the same time 02:57
multi methods? 02:58
AlexDaniel m: sub foo(%h (:$hello, :$world)) { dd %h }; foo({hello => 45, world => 50}) 03:01
camelia Hash % = {:hello(45), :world(50)}
AlexDaniel m: sub foo(%h (:$hello, :$world)) { dd $hello }; foo({hello => 45, world => 50})
camelia Int $hello = 45
AlexDaniel m: sub foo(%h (:$hello, :$world)) { dd $hello }; foo({hello => 45, wor => 50})
camelia Unexpected named argument 'wor' passed in sub-signature of parameter %h
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
AlexDaniel this seems to be working just fine
reino4477: yes, you can also use multi methods with this
reino4477: see this for some info: docs.perl6.org/type/Signature#inde...gnature%29 03:02
reino4477 thx 03:09
reino4477 I have: "enum Result<Success Error>;" 03:31
Is there any way to do something like this "enum Result<Success Error(Str message)>;"?
geekosaur not with an enum 03:33
although it could be argued that you want a custom Failure instead 03:34
AlexDaniel actually… 03:44
m: enum Result<Success Error>; sub foo(Result $x) { say ~$x }; foo(Error but ‘oh my gawd what is this’) 03:46
camelia oh my gawd what is this
AlexDaniel I can't justify having something like this in a real code base, but… you can do it if you really want to
m: enum Result<Success Error>; multi sub foo(Success) { say ‘\o/’ }; multi sub foo(Result $x) { say ~$x }; foo(Success); foo(Error but ‘oh my gawd what is this’) 03:47
camelia \o/
oh my gawd what is this
AlexDaniel m: enum Result<Success Error>; multi sub foo(Success) { say ‘\o/’ }; multi sub foo(Error $x) { say ~$x }; foo(Success); foo(Error but ‘oh my gawd what is this’)
camelia \o/
Cannot resolve caller foo(Result+{<anon|43370320>}::Error); none of these signatures match:
(Result $ where { ... })
(Result $x where { ... })
in block <unit> at <tmp> line 1
AlexDaniel m: enum Result<Success Error>; multi sub foo(Success) { say ‘\o/’ }; multi sub foo(Error() $x) { say ~$x }; foo(Success); foo(Error but ‘oh my gawd what is this’)
camelia \o/
No such method 'Result' for invocant of type 'Result+{<anon|43222896>}'
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
AlexDaniel well, doesn't really work… :) 03:47
Todd__ anyone home? 04:53
timotimo Todd__: yo 04:55
Todd__ Ho Timo. I jsut upgraded one from my machines from Fedora 25 to 26. A previously running program gives me the following error. I am stumped! 04:56
This type cannot unbox to a native string: P6opaque, Failure]
Hi not ho
timotimo ah, that's not such a good error message
does passing --ll-exception directly after perl6 in the commandline give more info? 04:57
Todd__ will try
timotimo that'll tell us where a Failure is being fed to code that expects to be working with a string 04:58
Todd__ vpaste.net/RpJnJ 04:59
timotimo looks like it's failing to load some precompiled file 05:00
it shouldn't fail like that, but you can probably help things by removing precompilation folders 05:01
timotimo if you set RAKUDO_MODULE_DEBUG=1 in the environment it'll give you more detail on what exactly is breaking 05:01
Todd__ vpaste.net/a1HxE 05:03
how do I remove "precompilation folders"? 05:04
ugexe whats your perl6 -v? 05:08
Todd__ Found whre it is happening. It is in a pm module I wrote:
use X11Clipboard; #`{ WritePrimaryClipboard, WriteSecondaryClipboard, ReadPrimaryClipboard, ReadSecondaryClipboard }
do you guys mind if I paste the module into vpaste for you guys to look at? 05:10
timotimo it's probably not a problem with the module itself
ugexe github.com/rakudo/rakudo/blob/nom/...nit.pm#L51 this is where its failing
Todd__ it happen right at the use X11Clipboard` with all calls to it commented out 05:11
timotimo okay so the slurp is failing
Todd__ I don't understand the link you send 05:12
timotimo it makes sense that it'd blow up with that error about unboxing to string, as nqp::sha1 is a low-level op that only wants to have strings
ugexe right, so something about updating the os is also likely to run that path (re-precompiling outdated stuff) 05:13
Todd__ here is another debug on a shorter program that call that module
vpaste.net/hCijR
timotimo Todd__: please give us the output you get when you set RAKUDO_MODULE_DEBUG
ugexe maybe permissions
timotimo ah there it is
hmpf, not as helpful as i had hoped 05:14
Todd__ would you like to see the module in question? 05:15
timotimo could you make a change to your local rakudo and recompile + reinstall it? 05:16
also, tell us your perl6 -v please?
Todd__ r&r ing 05:17
ugexe /usr/lib64/perl6 makes me think its permissions
timotimo could be, yeah, but doesn't it just slurp there?
Todd__ # rpm -qa \*rakudo\* rakudo-0.2017.06-1.fc26.x86_64 05:18
perl6 -v This is Rakudo version 2017.06 built on MoarVM version 2017.06 implementing Perl 6.c.
timotimo ugexe: should we just put a .self after the slurp call there?
Todd__ no symptom change after r&r 05:19
timotimo r&r?
ugexe probably. if you try to slurp a file you dont have permissions for it would probably give you a Failure that its failign to unbox
Todd__ I have two slurps in my module 05:20
my $proc = run('xclip', '-selection', 'primary', '-o', :out);
my $Str = $proc.out.slurp-rest.lines;
timotimo it's not about your module
Todd__ the other is similar
timotimo the problem happens deep inside rakudo
Todd__ sounds like I came to the right place
Are you the same Timo that helped me attach a zip file to an eMail? 05:21
ugexe m: use nqp; say nqp::sha1("/root".IO.slurp)
camelia This type cannot unbox to a native string: P6opaque, Failure
in block <unit> at <tmp> line 1
timotimo c: 2017.06 Failure.new.self
committable6 timotimo, ¦2017.06: «Failed␤␤Actually thrown at:␤ in block <unit> at /tmp/NKWlsBH3i4 line 1␤ «exit code = 1»»
timotimo c: 2017.06 "hi".self
committable6 timotimo, ¦2017.06: «»
timotimo that's good
timotimo the problem now is that you can't change the rakudo source you're using because you're using a binary package :( 05:23
ugexe maybe rm -rf /home/linuxutil/.precomp
Todd__ I renamed .precomp. That got rid of the error. Now I have an error in xclip to trobleshoot. I will stay connected for a bit in case you guys need me to test anything 05:25
Todd__ Fedora 26 is using Wayland. I bet that is the issue with xclip. Chuckle. 05:27
shinobi_cl r: say "abc".split.perl; 05:52
camelia Died
in block <unit> at <tmp> line 1
Cannot resolve caller split(Str: ); none of these signatures match:
(Str:D $: Regex:D $pat, $limit is copy = Inf;; :$v is copy, :$k, :$kv, :$p, :$skip-empty, *%_)
(Str:D $: Cool $match;; :$v is copy, :$k, :$kv, :$p, :$skip-empty, *%_)
(…
shinobi_cl r: say "abc".split('').perl;
camelia ("", "a", "b", "c", "").Seq
shinobi_cl Hi all, how can i make it so split returns only "a","b","c", without the empty elements? 05:53
moritz m: say "abc".comb() 05:54
camelia (a b c)
moritz shinobi_cl: ^^
shinobi_cl i mean, i think skip-empty does that, but, i'm more curious about the presence of these empty elements
moritz don't use split
shinobi_cl oh, i see. Thanks :)
moritz well, the default argument to split is the empty string
it's like when you have a regex that can match an empty string, you also get empty strings from split 05:55
geekosaur r: say "abc".comb.perl
camelia ("a", "b", "c").Seq
Todd__ calling it a night! 06:00
exit
nadim lizmat: you asked yesterday "nadim: do you need to be able to return from the sub ?" that was about declaring an anonymous sub without the sub keyword. I don't think I saw an answer after I answered "no" to your question. 12:43
I may have found a bug, compiling the lates to see if it is gone. I get a "Cannot invoke null object" when I am pretty sure the object is/should not be null. It is reproducible but no easy golfing. how does one go with those? 12:51
nadim ah! bug is gone in the latest 12:52
lizmat *phew* :-) 12:53
nadim Good work :) 12:54
it's weird, like most bugs, "$_.comb($width).map:" generated the error when I know $_ is not null, I print it the line above the .comb 12:55
nadim lizmat: what about those anonymous subs? 12:57
jnthn If you don't need to return, you don't need sub at all, just use a pointy block
lizmat aka -> { } vs sub { } 12:58
jnthn Other difference between them is that -> uses Mu as the default parameter type, and sub uses Any 12:59
nadim I need the -> in front of the block?
jnthn Only if you want to have a (possibly empty) signature 13:00
nadim what the code looks like nopaste.linux-dev.org/?1159759 13:01
nadim I am using interactive input now but I still would like to know 13:01
jnthn { } will be interpreted as a hash rather than an empty block
But other than that you could just delete the word "sub" in front of all of them and get the same 13:02
Also $_() can be written .()
nadim OK so it's only the firs {} that is a hash, the rest isn't 13:03
I had them all without sub in front, got the hash error, thought it was about all the blocks. 13:04
timotimo yeah { } is a hash, if you want it to be a code block you can put a ; in the midle 13:41
m: my $foo = { ; }; say $foo.^name
camelia Block
nadim that was the first thing I tried when I understood that it was not all the block but just the first :) 13:42
timotimo tends to be a good idea to assign these tnings to a &-sigiled variable 13:52
nadim ok, why? 13:53
clarity?
jnthn Also that you get a type check that it's something callable 13:54
nicq20 When using slangs, should $*LANG.^name change from Perl6::Grammar? 14:07
nicq20 After it's `use`-ed that is. 14:07
cschwenz Is there an *efficient* Perl6 way to convert an integer into an array of bits which represent said integer (don't care about endianness)? Or would I be better off simply coding it myself using bitwise operators? 14:10
timotimo m: 123456.polymod(2 xx *) 14:24
camelia ( no output ) 14:24
timotimo m: 123456.polymod(2 xx *).perl.say
camelia (0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1).Seq 14:25
timotimo m: say 123456.base(2)
camelia 11110001001000000
cschwenz timotimo++ thanks! :-)
i knew about the .base(2) version, but Int —> Str —> Int just seemed inefficient. :-P 14:26
timotimo i'm not sure how fast polymod is
cschwenz fair enough, i will simply have to benchmark them :-) 14:27
bdmatatu m: say sprintf("%b",123456) 14:30
camelia 11110001001000000
cschwenz local tests for me are showing .polymod() to be twice as fast as any string based conversion method. :-) 14:40
llfourn nicq20: I think so, after you mixin something it should change 15:02
nicq20 llfourn: Ah, that would be my problem then. 15:03
llfourn nicq20: but hang on what's $*LANG atm 15:04
nicq20 Well when using it normally it should be Perl6::Grammar.
llfourn oh. Yeah I dunno how things work with the new $*LANG stuff. 15:05
didn't you have your slang at least running before?
timotimo did you make sure to BEGIN say $*LANG?
nicq20 From what I understand, applying a slang should modify the type to be Perl6::Grammar+{Slang::Class} 15:06
Err, Perl6::Grammar+{Slang::Role}
llfourn it does but I thought you had your slang working before? Did it stop? 15:07
at least the mixin part of it
nicq20 The slang works, but only when inside of a block.
llfourn inside of a block?
timotimo do we actually make sure to keep $*LANG around at run time? 15:08
nicq20 Seems that $*LANG does not change until inside of {}.
llfourn like when you 'use' inside a block or when i
timotimo i wouldn't expect so
llfourn ^ignore that
timotimo so if you don't BEGIN say it, you'll end up with whatever you get at run time
llfourn yeah I don't know what $*LANG will be at runtime ^^
timotimo m: say $*LANG.perl
camelia Failure.new(exception => X::Dynamic::NotFound.new(name => "\$*LANG"), backtrace => Backtrace.new)
timotimo ah 15:09
nicq20 It does not seem to exist at runtime.
timotimo right
llfourn hmmm so your slang only gets applied when the parser starts parsing the next block? ... that's weird
nicq20 Not sure if this is something I'm doing wrong though...
llfourn hmm so $*LANG is now the top level cursor with the language braid 15:11
tbrowder ref Perl 6 marketing: seems like lots of p5 people are nay sayers about p6 for various reasons. i believe young people (beginning programmers, including kids in the ones to tard
llfourn nicq20: it might be just a bug/implementation quirk 15:13
jnthn It'd be $?LANG by runtime, I'd think?
nicq20 llfourn: Possibly. I'll download a much more recent version to see if this still happens.
tbrowder (finger fumble)...kids in elementary-to-high school, are the ones to target. 15:14
llfourn m: say $?LANG
camelia No such method 'gist' for invocant of type 'Perl6::Grammar'. Did you mean any of these?
ast
isa
list

in block <unit> at <tmp> line 1
llfourn m: say $?LANG.^name
camelia Perl6::Grammar
llfourn nicq20: if you look at Actions.nqp it looks like the .rebless happens in statementlist. Might explain why it takes until the next statementlist (ie block) before it gets applied. 15:15
but that's just conjecture
tbrowder thus i propose a new mailing list and irc channel for them where the language is not so crude and the complete focus is mentoring. 15:16
lizmat tbrowder: isn't a mailing list too old fashioned for that target group ? 15:18
nicq20 llfourn: Where do you see that?
llfourn (nvm there's another rebless in statement which is the one that should do the job afaict)
<!!{ nqp::rebless($/, self.slang_grammar('MAIN')); 1 }>
I think that's the one that mutates the parser when you mixin to 'MAIN' 15:19
nicq20, gl I'm off :) 15:22
nicq20 llfourn: Thanks for your help!
tbrowder lizmat: maybe, but it might be comforting to parents. maybe people here with young kids in school can comment. 15:24
timotimo if we want to capture the minds of the young, we need to start a tumblr and a phpbb 15:28
sena_kun o/ 16:13
sena_kun >Private multi-methods are not supported 16:14
sena_kun Why so? Or, rather, what should I do right if I want private method with multi-dispatch? Lexical subroutine? 16:14
s/private/a private/ 16:15
timotimo lexical subroutine works, yeah 16:21
sena_kun _nods_
ah.
Anyway, thanks, timotimo.
andrzejku do you know who maintains plugin for atom? 16:48
tyil[m] The syntax plugin, andrzejku ? 16:50
andrzejku samcv, hey
it is probably samcv 16:51
tyil[m] She went to bed a couple minutes ago
Yes it is
andrzejku ohh
tyil[m] Whats the problem tho
andrzejku I need a code for highlighting lexer and how grammar looks 16:52
tyil[m] afaik those are selected using regexes it atom syntax plugins 16:52
Js regexes
andrzejku where can I find code for that shit?:D 16:53
tyil[m] i'm not at my laptop this moment, otherwise i would've checked for you, sorry 16:54
sena_kun andrzejku, github.com/perl6/atom-language-perl6 - googled it for 5 seconds. 16:55
andrzejku greate :)
Morfent is there a way to pipe output from perl to something like less? 17:55
timotimo sure 17:56
sena_kun Morfent, `perl6 -e 'say 1,2,3' | less`?
timotimo i think they mean from inside perl6 code
Morfent ^
sena_kun Awww.
timotimo you'd run less via Proc::Async and feed it your data through its input handle
Morfent perfect 18:00
thanks
nadim timotimo: github.com/nkh/P6-Data-Dump-Tree has an ncurses example with folding. When azawawi pops up again he said he will make a widget 19:07
there is a simple example in tne example directory
unfortunately no ansi gluphs nor colors, as ncurses doesn't accept ansi codes directly. I may do something about it not sure which way yet 19:08