»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
scovit but for a problem in dlsym unrelated to perl6 00:00
probably puts is a macro in linux?
different values of RTLD_DEFAULT? 00:02
yep
m: gist.github.com/scovit/d328be9817e...98f99ee3a3 00:03
camelia Signature $sign = :(Str $text --> int32)
This comes from a dynamically generated nativecast of puts obtained by dlsym!
scovit success 00:04
now I can make a function with a slurpy and call my symbol with an appropriate dynamically generated signature 00:06
I wonder if there was no easier way.. 00:07
sena_kun >Serialization Error: missing static code ref for closure '' (src/Perl6/World.nqp:963)
heh
if it was so simple. :)
sena_kun m: my $new-enum = Metamodel::EnumHOW.new_type(name => 'custom', base_type => Int); $new-enum.^compose_repr; my \Two = $new-enum.new(2); my \custom = $new-enum; my custom $two = Two; 00:40
camelia ===SORRY!===
No compile-time value for custom
sena_kun m: my $new-enum = Metamodel::EnumHOW.new_type(name => 'custom', base_type => Int); $new-enum.^compose_repr; my \Two = $new-enum.new(2); my \custom = $new-enum; my custom $two = Two;
camelia ===SORRY!===
No compile-time value for custom
sena_kun hmmm...
m: my $new-enum = Metamodel::EnumHOW.new_type(name => 'custom', base_type => Int); $new-enum.^compose_repr; my \Two = $new-enum.new(2); my \custom = $new-enum; my custom $two = Two; 00:41
camelia ===SORRY!===
No compile-time value for custom
lookatme_q m: constant $new-enum = Metamodel::EnumHOW.new_type(name => 'custom', base_type => Int); $new-enum.^compose_repr; my \Two = $new-enum.new(2); constant \custom = $new-enum; my custom $two = Two; say $two; 00:46
camelia 2
sena_kun well, in my real code I am getting: `Type check failed in assignment to $!custom; expected Custom but got 2`. :| 00:48
I guess I have to sleep with this issue unresolved. 00:49
lookatme_q good night sena_kun
sena_kun o/
timotimo well, it wasn't imported 00:57
oops, i was scrolled way up
Xliff Can you use Perl6 to parse perl6? 02:16
(of course you can...)
A better question would be... how can you do it?
For example, I'd like to parse a Grammar definition without reinventing the wheel
AlexDaniel Xliff: see also: github.com/drforr/perl6-Perl6-Parser 02:52
Xliff AlexDaniel++: Thanks for the recommendation, but perl6-Perl6-Parser may work, but I have no idea how to use it based on the code. 03:36
Everything in the t/ directory is kinda inscrutable. :/
I shall play with it further. 03:39
Thanks!
SmokeMachine Xliff: github.com/FCO/GccJit/blob/master/jit.p6 06:16
rindolf Hi all! I was saddened to learn that PerlJam passed away - www.reddit.com/r/perl/comments/ab0...es_in_and/ 06:35
Geth doc: 616941013f | (JJ Merelo)++ | doc/Language/modules.pod6
Some rewording and reflow
06:41
doc: 70681c551f | (JJ Merelo)++ | doc/Language/variables.pod6
We're no longer using tables here
synopsebot Link: doc.perl6.org/language/modules
Link: doc.perl6.org/language/variables
doc: 09a0263e4c | (JJ Merelo)++ | doc/Language/variables.pod6
Makes distinction between "gist" and "stringification"

Also some reflow and grammar changes. This would close #2545.
jmerelo finanalyst: ^^^ and hi!
holyghost hi JJ, I worked on PaganSound2, a wave editor in perl6 06:43
using SDL2::Raw 06:44
jmerelo holyghost: great!
holyghost I need to grep the fourier analysis :-)
DFT, DTFT 06:52
holyghost bit pattern to wave and vv. 06:59
moritz had a fun venture into Lomb-Scargle analysis to find periodicity in unevenly spaced time series data 07:20
masak that does sound like fun. 07:48
holyghost I'm working on a video server for perl6, is there anything interfaced such as ffmpeg ? 07:58
s/interfaced/modularized
daxim m: subset Nonempty of Str where *.chars ≥ 0; my Nonempty $x = ''; say $x.chars; 10:33
camelia 0
lizmat m: m: subset Nonempty of Str where *.chars > 0; my Nonempty $x = ''; say $x.chars; 10:35
yoleaux 8 Jan 2019 15:31Z <Kaiepi> lizmat: msg me once you're on
camelia Type check failed in assignment to $x; expected Nonempty but got Str ("")
in block <unit> at <tmp> line 1
yoleaux 8 Jan 2019 16:52Z <sjn> lizmat: link in 2019.01 weekly to Brad Gilbert's tweet seems wrong
daxim I'm stupid
jnthn The * isn't needed there either, since the thing after `where` is already thunked wiht $_ set 10:36
daxim I'll keep posting the examples, sometimes they are legitimate, sometimes I just need a whack 'side the head
lizmat .tell sjn fixed link, thanks for noticing! 10:38
yoleaux lizmat: I'll pass your message to sjn.
sjn yay!
yoleaux 10:38Z <lizmat> sjn: fixed link, thanks for noticing!
sjn yay2!
:)
El_Che .tell sjn You funny guy 10:41
yoleaux El_Che: I'll pass your message to sjn.
sjn yay3! 10:42
yoleaux 10:41Z <El_Che> sjn: You funny guy
holyghost lol 11:33
the video server might be deamonized :-)
kurahaupo dæmonic video? 😋 11:43
holyghost scalar video :-) 11:54
Kaypie m: class X::Foo is Exception { method message(--> Str) { 'foo' } }; X::Foo.new.throw 12:09
camelia foo
in block <unit> at <tmp> line 1
Kaypie m: class X::Foo is Exception { method message(--> Str) { 'foo' } }; die X::Foo.new 12:10
camelia foo
in block <unit> at <tmp> line 1
Kaypie what's the difference between throwing these two ways?
timotimo if someone overwrites the throw method on the exception object to do something funny, something funny will happen :D 12:15
Kaypie do people do that? 12:18
timotimo the answer to that question is always yes 12:20
El_Che $ brew info rakudo 14:07
rakudo: stable 2018.12 (bottled)
Perl 6 compiler targeting MoarVM
rakudo.org
Not installed
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3stable 2018.127⏏5 (bottled)
expecting any of:
infix
infix stopper
postfix
statement end
statement…
El_Che From: github.com/Homebrew/homebrew-core/.../rakudo.rb
==> Dependencies
Required: nqp ✘
El_Che ==> Analytics 14:07
install: 44 (30 days), 50 (90 days), 50 (365 days)
install_on_request: 44 (30 days), 50 (90 days), 50 (365 days)
oops
anyway: good news
there is now a rakudo pkg on homebrew
next to rakudo-star
It was on my todo list to create a rakudo only formula, but it's already done! 14:08
lizmat El_Che++ 14:09
El_Che (not by me: El_Che--)
I'll keep an eye on it, and try to collaborate on that repo 14:10
tyil I vaguely remember something about rakudo-star looking for a new maintainer/releaser 14:55
was one ever found, or am I remembering wrong and were they not looking for a new one to begin with? 14:56
El_Che there where a few candidates on github 14:58
tyil I only have GNU+Linux machines, so I can't release for mac/windows, so I'm not a great person to get into that stuff 15:00
I'm mostly interested in the updates for it rn because it should be time for a new R* soon-ish
El_Che I release the Linux packages with Travis
so that help
s
but need to get into windows packaging, btut don't use Windows enough to be knowledgable 15:01
tyil I build R* from source, so that's not relevant for me :p
I thought you only did regular Perl 6 releases, not the R* releases
El_Che yes, I don't use star 15:02
El_Che I was looking at expanding rakudo packages with macos and windows once I have the time 15:02
not there yet
Xliff m: $a = ( do => 1 ); $a.gist.say 15:30
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3<BOL>7⏏5$a = ( do => 1 ); $a.gist.say
Xliff m: my $a = ( do => 1 ); $a.gist.say
camelia do => 1
Xliff m: my $a = ( do => 1 ); $a<done> = $a<do>:delete; $a.gist.say 15:53
camelia Cannot modify an immutable Str (Nil)
in block <unit> at <tmp> line 1
Xliff m: my $a = ( do => 1 ); $a<done> = $a<do>; $a.gist.say
camelia Cannot modify an immutable Str (Nil)
in block <unit> at <tmp> line 1
Xliff m: my $a = ( do => 1 ); $a<d> = $a<do>; $a.gist.say 15:54
camelia Cannot modify an immutable Str (Nil)
in block <unit> at <tmp> line 1
Xliff m: my %a = ( do => 1 ); %a<d> = %a<do>; %a.gist.say
camelia {d => 1, do => 1}
Xliff m: my %a = ( do => 1 ); %a<d> = %a<do>:delete; %a.gist.say
camelia {d => 1}
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= $a<e>:delete; %a.gist.say 15:56
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared. Did you mean '%a'?
at <tmp>:1
------> 3= %a<do>:delete; %a.gist.say; %a<d> //= 7⏏5$a<e>:delete; %a.gist.say
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= %a<e>:delete; %a.gist.say
camelia {d => 1, e => :P}
{d => 1, e => :P}
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= %a<e> && %a<e>:delete; %a.gist.say 15:57
camelia 5===SORRY!5=== Error while compiling <tmp>
You can't adverb &infix:<&&>
at <tmp>:1
------> 3ist.say; %a<d> //= %a<e> && %a<e>:delete7⏏5; %a.gist.say
expecting any of:
pair value
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= %a<e> && (%a<e>:delete); %a.gist.say 15:58
camelia {d => 1, e => :P}
{d => 1, e => :P}
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= %a<e> || (%a<e>:delete); %a.gist.say
camelia {d => 1, e => :P}
{d => 1, e => :P}
Xliff m: my %a = ( do => 1; e => ':P' ); %a<d> = %a<do>:delete; %a.gist.say; %a<d> //= %a<e>; %a<e>:delete; %a.gist.say
camelia {d => 1, e => :P}
{d => 1}
cfa o/ 16:13
Kaiepi m: 'hastebin.com/raw/abcdefghij' ~~ / [ [ https?:\/\/ ]? hastebin\.com\/ [ raw\/ ]? ]? ( \w+ ) [ \.\w+ ]? /; say $0 16:17
camelia 「https」
Kaiepi m: 'hastebin.com/raw/abcdefghij' ~~ / [ [ https?\:\/\/ ]? hastebin\.com\/ [ raw\/ ]? ]? ( \w+ ) [ \.\w+ ]? /; say $0 16:18
camelia 「abcdefghij」
Kaiepi why does the colon in the non-capturing group make it capture if it isn't escaped?
moritz it doesn't capture 16:19
you're printing $/, and that matches only the string 'https'
wait, no
the first part doesn't match, but since there's a ? before it, that doesn't cause the match to faile. So the (\w+) matches https 16:20
moritz (and it doesn't match because there's nothing that could match the : in the input string) 16:21
tobs` m: 'hastebin.com/raw/abcdefghij' ~~ /^ [ [ https?:\/\/ ]? hastebin\.com\/ [ raw\/ ]? ]? ( \w+ ) [ \.\w+ ]? $/; say $0
camelia Nil
avuserow m: 'hastebin.com/raw/abcdefghij' ~~ /^ [ [ https?\:\/\/ ]? hastebin\.com\/ [ raw\/ ]? ]? ( \w+ ) [\.\w+]? $/; say $0 16:29
camelia 「abcdefghij」
Kaiepi oh 16:30
avuserow colon needed to be escaped, tobs`, otherwise it has meaning
tobs` yes, I understood the explanation 16:31
avuserow ah okay, I just saw the last one not matching anything and jumped in 16:32
tobs` "if you have lots of optional parts and you expect to match the whole string anyway, use the ^ and $ anchors to prevent false positive matches" is what I wanted to reaffirm with that line, I think 16:35
Geth ecosystem: 38090d7fda | (Ben Davies)++ (committed using GitHub Web editor) | META.list
Add Hastebin module to META.list
16:43
jmerelo Hi! 17:05
.tell AlexDaniel did you check out the Squashathon calendar? github.com/rakudo/rakudo/wiki/Mont...Squash-Day 17:06
yoleaux jmerelo: I'll pass your message to AlexDaniel.
AlexDaniel yes
yoleaux 17:06Z <jmerelo> AlexDaniel: did you check out the Squashathon calendar? github.com/rakudo/rakudo/wiki/Mont...Squash-Day
AlexDaniel .
jmerelo Hi, Alex
AlexDaniel IMO we should try to keep it more fun
so maybe more new ideas 17:07
jmerelo AlexDaniel: the only new idea is to look at the Most Wanted modules list and decide on the creation of new ones.
AlexDaniel also the unbitrot one for the next month needs this resolved: github.com/perl6/Blin/issues/1
jmerelo AlexDaniel: OK, right. 17:08
That's on me.
Geth ¦ Blin: JJ self-assigned Automatically populate/update ecosystem-unbitrot issues github.com/perl6/Blin/issues/1
jmerelo Sorry about that.
AlexDaniel let me know if you need any help 17:10
maybe you'd also need to do github.com/perl6/Blin/issues/5 first
Geth ¦ Blin: JJ self-assigned JSON output is needed github.com/perl6/Blin/issues/5 17:14
jmerelo I self-assigned it too, but of course anyone can do something about it if needed.
melezhik Hi! I have module name in string variable. $name 17:22
yoleaux 8 Jan 2019 06:36Z <SmokeMachine> melezhik: something like this: "Pod::To::Markdown:ver<0.1.4+>"
melezhik thanks! yoleaux: 17:22
how do I call module's function having $name ?
timotimo have you already "require"d it? 17:23
melezhik yes 17:24
tyil m: my $f = "say"; ::("&$f")("hello!");
camelia hello!
tyil melezhik: ^
melezhik yeah, tyil: thanks
tyil: how the things are, btw? ((:
tyil not bad, living with samcv in Amsterdam these days 17:25
jmerelo melezhik: you need to use the module before the function, maybe.
tyil got a new job as devops in amsterdam, where I can sometimes use Perl 6
jmerelo: would probably need a require, so it happens at runtime instead
tyil melezhik: will u attend fosdem or TPC in Riga later this year? 17:25
jmerelo tyil: great to hear about your new job. Congrats!
tyil jmerelo: I've had said job for abour 3 months now, but I ahvent spoken to melezhik in a long time :( 17:26
melezhik tyil: not sure, I am in the US now ((: congrat on new job!
tyil melezhik: permanent basis, or holidays in USA?
melezhik kinda permanent, already 9 months here ... working visa 17:27
TX
tyil nice
congrats!
melezhik thanks
tyil doing perl stuff?
melezhik no ... it's devops ... but I am tireless perl6 guy ... try to use my opensource tools here ha-ha ((: 17:28
tyil same here
if I get the chance I'm rewriting some tools to use Perl 6
melezhik or else it's sometimes so boring .... ((;
tyil I rewrote one tool to both Perl 6 and Python 3 today, to compare them against eachother (and the original posix sh script) 17:29
melezhik I mean my main job atcitivities ..
tyil omw to a Linux user group now, where someone will inspect the python variant to see if it can be made better for a more fair comparison
melezhik ok, who won?
ok ... good
jmerelo melezhik: I would say nothing beats sh...
tyil currently Perl 6 i both smaller and more readable :p
mostly because I dont need to getopts with perl 6 17:30
jmerelo melezhik: I mean, in terms of speed. If you are able to write something in awk, it will beat the hell out of C or anything else...
tyil speedwise I didn't check, as performance is not the primary concert (it msotly fires off commands over ssh to other servers)
once I've given the python variant a pass with a more experienced py dev I'll check work if I can release the script in a blog post 17:31
melezhik ok, understand ...
tyil sadly work has taken time away from working on Perl 6 modules for me, but so long as I can use it at work from time to time I'm okay with it 17:33
I saw in the weekly that Red has finally been going to CPAN, so this might be the time to try it out in a new small API project, in combination with Cro
tyil that shouldn't take too much time to play around with to get a feel for it, as APIs are rather easy to create 17:34
timotimo did y'all see VoIRC? :D 17:47
jmerelo timotimo: I'm not sure I want to 17:50
timotimo it uses "codec2" at about 1.4kbps 17:51
it sounds pretty terrible :D
jmerelo timotimo: even if it didn't 17:52
timotimo ?
jmerelo I mean, so many people saying stuff.
eiro i didn't see. any defined link ?
timotimo obviously you only hear people who have voirc
jmerelo I would wait for the selected and abridged version. It a written tweet, if possible. 17:53
timotimo youtu.be/0R--_ATzE6o?t=61 - here you can hear a bit 17:54
eiro timotimo: thanks for the link :) i'm really happy some people want to improve IRC 18:00
timotimo the cool trick is that they don't have to change anything about irc to make it "work" :D 18:15
Kaiepi what does the $limit parameter do in Supply.throttle? 19:23
the docs say "The first positional parameter specifies the limit that should be applied." but i don't understand what that's supposed to mean
melezhik I am struggling with error when requiring Perl6 module in runtime and trying to call module's function - gist.github.com/melezhik/59fbdc0d4...5bff16a3b6 19:24
tobs melezhik: the error is raised from sub profile-list at Tomtit line 339, which isn't shown in your gist. It looks like you should try to declare profile-data is our in Pets.pm6 19:34
I mean "our sub profile-data". 19:35
melezhik it is declared and exported - gist.github.com/melezhik/59fbdc0d4...le1-txt-L9
line 339 is shown in gist as well 19:36
gist.github.com/melezhik/59fbdc0d4...nt-2805346
just added
tobs if you declare "sub profile-data is export", you make ::("&profile-data") work, if you declare "our sub profile-data", you make ::($profile ~ '::&profile-data')() work 19:39
melezhik your right, our sub should fix it!
thanks tobs: 19:40
tobs no problemo, although I wish I could find words to explain the mechanism properly :-)
TreyHarris What's a one(ish) liner to answer the question, "what range of values can be stored in an N-bit vector?" 19:42
(I know how to raise 2 to a power; I'm talking about signed integers. I fear the obvious math formula may be inelegant and lead to off-by-one error.) 19:48
tobs TreyHarris: stored in the conventional unsigned int way? The answer is no longer than `^2**$N`
heh
moritz -2**($N-1)..2**($N-1)-1
m: say -2**$_ .. 2**$_ -1 given 8-1 19:49
camelia -128..127
TreyHarris moritz: thanks; I'd hoped there was a method on Blob or Buffer to help me, but that formula is a little more readable than the one I first wrote 19:49
moritz neither are bit vectors 19:50
tobs m: my $N = 16; say ^2**$N-- - 2**$N
camelia -32768..^32768
tobs (I wonder if that's defined behaviour)
TreyHarris Is there a bit vector type? You can stuff a sequence of N bits into a Blob or Buffer pretty easily, so that's why I was thinking in that direction anyway 19:52
moritz tobs: no, I don't think so
TreyHarris tobs: what's ambiguous about it? 19:53
tobs TreyHarris: $N occurs twice in that expression but one occurrence changes its value 19:54
The compiler might not be obliged to always read from left to right
moritz TreyHarris: I don't think there's a buit-in bit vector type 19:55
TreyHarris tobs: oh, right. how does C deal with that? I know I've used a language where postincrement was after evaluation while preincrement was during evaluation
(I can test gcc; just not sure where to look if it's defined in C11.) 19:57
tobs hmm, gcc -Wall tells me "the operation may be undefined". I don't know about C standards anyway. 19:58
TreyHarris In C++ it's specifically illegal it looks like (see "sequence points") 20:00
Ah well, OT anyway; was just curious. Thanks, I'll use moritz++ formula
TreyHarris (I think I assumed this was easy because I've been doing a bit of Swift recently and every value type including generics can tell you the largest and smallest values they can represent.) 20:02
*er, every ordered value type at least 20:03
Xliff m: my \n = 3; say 2ⁿ 20:05
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3my \n = 3; say 27⏏5ⁿ
Xliff :*
:(
m: my \ⁿ = 3; say 2ⁿ
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3my \ⁿ = 3; say 27⏏5ⁿ
tobs m: "\c[SUPERSCRIPT DOLLAR SIGN]".say 20:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized character name [SUPERSCRIPT DOLLAR SIGN]
at <tmp>:1
------> 3"\c[SUPERSCRIPT DOLLAR SIGN7⏏5]".say
tobs too bad :)
TreyHarris n, i, the digits, parens, and a few arithmetic operators are the only SUPERSCRIPT.* character names, so probably for the best; if n and i work, people would expect any letter to work 20:13
since the digits are all there, it's more reasonable to support them
Xliff TreyHarris: Good point. :/\ 20:16
Xliff However, there are SUPERSCRIPT letters. 20:16
Not all of them, though. I see your point. 20:17
TreyHarris I do wonder if there's an argument why you can't create a Rat literal like ³/₁₆ 20:21
Since composing characters let you do it for any fraction
TreyHarris m: say <3/16>.WHAT; say <³/₁₆>.WHAT; 20:25
camelia (Rat)
(Str)
Xliff What does it mean when rakudo bombs out in stage parse with: 20:33
===SORRY!===
MVMArray: Index out of bounds
timotimo it could mean anything; without a --ll-exception we won't know anything much 20:34
TreyHarris Does Unicode subscripting have any meaning like superscripting does?
timotimo i don't think it does 20:35
TreyHarris Then a fraction written as superscript, solidus, subscript could be recognized as a Rat without ambiguity I think.
Even mixed, which Rat doesn't allow AFAIK 20:37
m: say <3/4>.WHAT; say <2/3/4>.WHAT
camelia (Rat)
(Str)
TreyHarris er, which <> literals don't allow 20:38
timotimo you don't really have three slashes in a mixed fraction, though
TreyHarris m: say <2 3/4>.WHAT; say <2-3/4>.WHAT; 20:39
camelia (List)
(Str)
timotimo yeah, that's already list 20:40
it'd have to be a +, i'd say?
kind of like <1+5i>
SmokeMachine Xliff: this is working! github.com/FCO/GccJit/blob/master/jit.p6 thank you for your help!
TreyHarris yeah, but 2³/₁₆ could be interpreted as <35/16> rather than as 2**3 / 16 20:41
Xliff SmokeMachine: \o/ 20:42
anytime 20:43
SmokeMachine (but I had to create a vm with linux... I couldn't install libgccjit on my mac...) 20:44
Xliff timotimo: Here's your --ll-exception 20:45
pastebin.com/FZwL7yuJ
timotimo aha? that's our precedence parser implementation 20:50
Xliff Yep. 20:53
I think I've narrowed it down to the code that caused the problem.
Yep! Found it. Lemme gist it.
timotimo: gist.github.com/Xliff/74a6f61e059d...6900cd9550 20:57
Without that block, I don't have any problems.
timotimo m: given 1 { when .value<toggled>:exists | .value<check>:exists | .value<toggle>:exists { say "hi" } } 20:59
camelia ===SORRY!===
MVMArray: Index out of bounds
timotimo this also doesn't do what you mean
the adverbs have a rather different precedence than you would expect
m: given 1 { when (.value<toggled>:exists) | (.value<check>:exists) | (.value<toggle>:exists) { say "hi" } }
camelia No such method 'value' for invocant of type 'Int'. Did you mean 'values'?
in block <unit> at <tmp> line 1
timotimo this fixes the issue and works around the crash
but the crash shouldn't be happening in the first place, of course 21:00
Xliff I know. ;)
Thanks for that fix. I suspected as much.
No wonder I get complaints about adverbing && when I do "%a<e> //= %a<blah> && %a<blah>:delete"
timotimo yeah 21:01
Xliff m: my %a = (e => 1); %a<e> //= %a<blah> && %a<blah>:delete
camelia 5===SORRY!5=== Error while compiling <tmp>
You can't adverb &infix:<&&>
at <tmp>:1
------> 3); %a<e> //= %a<blah> && %a<blah>:delete7⏏5<EOL>
expecting any of:
pair value
timotimo i think it's a common "huh"
Xliff :)
timotimo i wonder if we have enough information at that point in the compiler to suggest parenthesis around %a<blah>:delete
Xliff m: my %a = (e => 1); %a<blah> //= %a<e> && (%a<e>:delete)
camelia ( no output )
Xliff m: my %a = (e => 1); %a<blah> //= %a<e> && (%a<e>:delete); %a.gist.say
camelia {blah => 1}
Xliff \o/
timotimo for adverbs that we know are interesting to hash accesses
sena_kun I know I am a bit annoying, but can anyone help me with proper MOP-driven enum value creation? My code golfed is at gist.github.com/Altai-man/049f7bf4...6f7929a9f6 and I assume that first smartmatch should be evaluated to True, but it's False. 21:05
timotimo sena_kun: i'm confused why you .^add_method on the $value? 21:06
sena_kun it does't work otherwise, `add_enum_value` requires `key` and `value` (likely Pair) methods to be implemented. I suspect it might be part of my issue. 21:07
give me a second...
timotimo that's strange 21:08
sena_kun github.com/rakudo/rakudo/blob/mast...OW.nqp#L70 <- .key and .value are accessed here.
timotimo oh
sena_kun I also saw code that adds `Enumeration` and `NumericalEnumeration` roles to the enum.
timotimo yeah, $value wouldn't appear in the enum at all
sena_kun But wasn't sure if that has any sense in this situation.
timotimo it's supposed to be an object that has a key and a value method, nothing more 21:09
having it be an instance of the enum class is super strange
hold on
i did that totally wrong
sena_kun well, `.new(2)` was suggested by jnthn otherwise. I was quite happy, becuase it was something better than passing a plain Str->Int pair, but... But it didn't pass a smartmatch and usual type checks which I must have. 21:10
s/otherwise/yesterday/
timotimo tbh i don't know what the compose_repr exactly is for 21:11
sena_kun well, without this line it doesn't work either. :( or without `^compose`. 21:12
sena_kun doesn't work as in "dies", not as in "fails smartmatch". 21:12
timotimo mhm
i would have to look at the World code that creates enums
sena_kun I did. 21:13
it uses nqp::rebless.
github.com/rakudo/rakudo/blob/mast....nqp#L3898
^ here.
timotimo that might be important, then?
sena_kun and high level equivalent of this one sounds like just a `.new` call on enum type. 21:14
well, I don't want to use nqp.
As a last resort, maybe.
sena_kun tries out nqp::rebless 21:17
Kaiepi Supply.throttle is awesome 21:31
in a chat bot i'm writing i deal with the server's message throttling in just 3 lines because of it hastebin.com/awoyutoheg.rb 21:32
when i wrote something similar to this in node it was a really hacky queue that took up something like 100 lines 21:34
Xliff It's nice when you can write clean code, eh? 21:39
Kaiepi yep :) 21:41
Xliff Why is it that perl6 is constantly recompiling things I've just compiled? 21:42
Xliff Is it due to the fact that I am trying to run a script in a different directory (since I am passing a lot of -I options) 21:42
zachk how do I turn a string into either an array of strings, one for each character, or an array of characters? 22:06
sena_kun .comb 22:07
m: 'ehehe'.comb.say
camelia (e h e h e)
sena_kun it can do more things with various args, but arg-less call does it. zachk ^
zachk oh thank you 22:08
sena_kun you are welcome 22:10
guifa Really odd question. If you using .assuming on a function, is there anyway to recover the bound arguments? 22:11
zachk how do I export a function/sub from a module? 22:12
guifa Like my &foo = sub ($x) { ... }; &bar = &foo.assuming: 1; &foo.assumed --> (1) 22:13
sena_kun zachk, use `is export` trait. like `sub a is export { #`[ things done here ]}`
zachk how do I export using function arguments? 22:14
sena_kun there are more ways, of course, but this one is likely what you want.
sub a($foo) is export {}
you can read more about traits at docs.perl6.org/language/traits 22:15
or look up `is export` into docs.perl6.org/routine/is%20export
guifa, cannot help with this one. maybe you want to use different approach for your task? I can only imagine caching arguments passed to `assuming`. 22:20
guifa sena_kun Yeah, I've been using a different approach, just seems that with all the introspection possible that there would have been a way 22:22
(more of a curiosity question than a practical one)
zachk can I use an if over a smarth match ~~ regex and still bind $0 and $1, etc from the regex in the successful if block?
Xliff guifa: That might be a good feature request for 6.e 22:24
sena_kun well, not sure if you checked that, but a resulting object has empty `.signature`(in case if all args were passed, of course), so I think there is no way to recreate this info, it's already another call in a sense. There might be some really black metal hackery, of course, but you likely don't want to use it. :)
m: if $a ~~ /('ehe') ('he')/ { say $0; say $1; } 22:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3if 7⏏5$a ~~ /('ehe') ('he')/ { say $0; say $1;
sena_kun m: my $a = 'ehehe'; if $a ~~ /('ehe') ('he')/ { say $0; say $1; }
camelia 「ehe」
「he」
sena_kun zachk, ^?
zachk yes like that 22:26
guifa sena_kun: it's a minor optimization I'd be making, and the workaround would add a whole intermediate layer so... as Xliff said, maybe in 6.e 22:34
sena_kun guifa, don't know the context, but if that'd be useful, patches are welcome, I think. :) 22:36
guifa sena_kun: that may be a bit beyond my current level of coding, but perhaps once my dissertation is done I'll try to sit down and figure out the innards enough for that 22:38
sena_kun guifa, good luck with your dissertation paper! 22:39
guifa bashes head in with old books 22:39
(my own head haha)
Except I don't think the librarians will like me doing that (I'm a medievalist)
zachk how do i force the reloading of a successfully loaded module at the repl, once I have changed the source to the module? 22:40
sena_kun zachk, have you tried just using `use Foo` again?
zachk yeap, doesn't seem to run changes 22:43
sena_kun oh, I guess it loads precompiled version of a module... 22:44
zachk yea I want to force a reload from source 22:45
sena_kun zachk, give me a second...
zachk, I don't know/see any easy way to do that, but to some extent stackoverflow.com/a/52615999 may help. 22:47
zachk is there anywhere I can purchase a plushie camelia? 22:52
sena_kun zachk, you want to ask lizmat or AlexDaniel, I think. 22:54
zachk evalfile doesnt seem to bring the defined subroutines into a scope available to the repl :-/
AlexDaniel you can't purchase it ATM, as far as I know
sena_kun it probably still can be made Gentoo-way though. :> 22:55
AlexDaniel we do promise a plushie to every squashathon winner (which happens every month), though I'm not sure if anybody claimed theirs yet
so that's one way I guess
another is to talk to lizmat in person on one of the conferences :) 22:56
Xliff AlexDaniel: Could you do me a fav and create an item in p6-GtkPlus for the cumulative graph? 23:08
zachk can I have call perl6 with a "one-liner" from the command prompt and have it dump its environment from that one liner into a repl?
AlexDaniel Xliff: done 23:10
Xliff AlexDaniel: Thanks! 23:10
AlexDaniel: Discovered I was missing properties in one GTK object and added over 1300 lines to it, yesterday. 23:11
That will be interesting to track.
:S 23:14
How can I get Perl6 to clear a grammar definition, especially if I've made changes to it?
I'm using EVAL to define it.
timotimo how do you make changes to it? with add_method, or with mixins?
Xliff I get "Redeclaration of 'T'" when I resubmit the eval 23:15
timotimo: I just keep EVALing the grammar dec
(now I can always cheat and add a bloody serial to it, but... don't wanna!)
timotimo if it puts it into a package, try "my grammar T"
zachk how can I use EVAL from the repl, use MONKEY; and use MONKEY-SEE-NO-EVAL don't seem to work :( 23:20
sena_kun m: EVAL 'say 1'; 23:21
camelia 1
sena_kun you mean like this?
zachk yea 23:21
sena_kun that's about it, I think. :)
zachk EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error, 23:22
but only if you're VERY sure your data contains no injection attacks)
sena_kun hmm, are you loading a file? then you need to add a pragma it suggests at the beginning of the file. 23:22
or at the point where you are using EVAL, I think. so... 23:23
in file `foo.p6` it'd be like `use MONKEY-SEE-NO-EVAL; EVAL 'say 1';` and then `perl6 foo.p6` should work.
Xliff m: my $a = "a\nb\nc\n"; say $a.lines.elems.Str.chars 23:24
camelia 1
Xliff m: my $a = "\n\n\n\n\n\na\nb\nc\n"; say $a.lines.elems.Str.chars
camelia 1
Xliff m: my $a = "\n\n\n\n\n\na\nb\nc\n\n\n\n\n\n\n\n"; say $a.lines.elems.Str.chars
camelia 2
timotimo zachk: you probably have to have monkey see no eval on every line in the repl 23:31
the repl doesn't remember everything between lines
it also forgets custom operators, for example
zachk i found the error, i was escaping a $ :-/
i wasnt
sena_kun has handmade enums working (using nqp though) 23:35
gfldex sena_kun++ # for being crafty :) 23:38
vrurg m: sub f1 ( $msg, Int $i ) { }; sub f2 ( $msg, *@_ ) { }; sub f3 ( $msg, *%_ ) { }; say &f1.signature ~~ :( $, | ); say &f2.signature ~~ :( $, | ); say &f3.signature ~~ :( $, | ); 23:41
camelia True
True
False
vrurg Does anybody know why *%_ makes difference here? 23:42
vrurg suspects a bug 23:43
timotimo huh, interesting
the semantics of smart match of signature vs signature are "is superset of"?
or "is subset of"
vrurg Dunno 23:44
It is not documented anyway.
m: sub f ( Str $msg ) { }; say &f ~~ :( Any $, | )
camelia False
Xliff sena_kun: Do you have an example of the code? 23:45
sena_kun Xliff, sure, give me a second...
Xliff Thanks!
vrurg m: sub f ( Str $msg ) { }; say &f ~~ :( Any $ )
camelia False
sena_kun Xliff, that's a cheating though, so... :)
vrurg m: sub f ( Str $msg ) { }; say &f.signature ~~ :( Any $, | )
camelia True
vrurg I would guess that left is subset of the right. 23:46
sena_kun Xliff, gist.github.com/Altai-man/b97ba9d8...bf55ae392b <- 23:47
sena_kun create_enum_value is a copy-paste from World.nqp. 23:47
I still don't know how to get rid of `+Enumeration`, it is absent in "normal" enums, but as long as this code does the job I am fine with it being present. 23:48
sena_kun ok, sleep time. o/ 23:54