»ö« 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.
BenGoldberg m: say Inf; 01:22
camelia rakudo-moar a1347c: OUTPUT«Inf␤»
BenGoldberg m: say [max];
camelia rakudo-moar a1347c: OUTPUT«-Inf␤»
AlexDaniel BenGoldberg: irclog.perlgeek.de/perl6/2016-02-10#i_12017010 01:44
and if you read that long enough, you'll see a mention of #127506 01:46
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127506
AlexDaniel m: sub min(*@a) { return ‘Oh no, NaNs!’ if NaN === any(@a); max @a }; say min NaN, 5 01:47
camelia rakudo-moar a1347c: OUTPUT«Oh no, NaNs!␤»
AlexDaniel m: sub min(*@a) { return ‘Oh no, NaNs!’ if NaN === any(@a); max @a }; say min Inf, 5
camelia rakudo-moar a1347c: OUTPUT«Inf␤»
BenGoldberg m: say [max] NaN; 01:50
camelia rakudo-moar a1347c: OUTPUT«NaN␤»
BenGoldberg m: dd (NaN <=> NaN); 01:51
camelia rakudo-moar a1347c: OUTPUT«Nil␤»
BenGoldberg m: so (NaN <=> NaN);
camelia rakudo-moar a1347c: OUTPUT«WARNINGS for <tmp>:␤Useless use of "so " in expression "so (NaN <=> NaN)" in sink context (line 1)␤»
BenGoldberg m: say so (NaN <=> NaN);
camelia rakudo-moar a1347c: OUTPUT«False␤»
BenGoldberg thinks comparisons on NaNs should return failures. 01:53
Xliff \o 01:55
Hey there, can you use Perl6 subs as C handlers via NativeCall? 01:58
Xliff I don't think that's covered in the docs, anywhere. But I will admit it has been a while since I've looked. 01:59
Xliff Also, here's a thought... is there any possibility that libxslt would be used without libxml2? 02:02
BenGoldberg m: say 4 == 1E12.log10 div 3 02:08
camelia rakudo-moar a1347c: OUTPUT«Cannot resolve caller infix:<div>(Num, Int); none of these signatures match:␤ (Int:D \a, Int:D \b)␤ (int $a, int $b --> int)␤ in block <unit> at <tmp> line 1␤␤»
Xliff m: say 4 == 1E12.log10.Int div 3 02:44
camelia rakudo-moar a1347c: OUTPUT«False␤»
Xliff m: 1E12.log10.say 02:45
camelia rakudo-moar a1347c: OUTPUT«12␤»
Xliff m: (1E12.log10 div 3).say
camelia rakudo-moar a1347c: OUTPUT«Cannot resolve caller infix:<div>(Num, Int); none of these signatures match:␤ (Int:D \a, Int:D \b)␤ (int $a, int $b --> int)␤ in block <unit> at <tmp> line 1␤␤»
Xliff m: (1E12.log10.Int div 3).say
camelia rakudo-moar a1347c: OUTPUT«3␤»
timotimo m: (1E12.log10.round div 3).say
camelia rakudo-moar a1347c: OUTPUT«4␤»
Xliff Figures. 02:46
timotimo m: (1E12.log10 - 12).say
Xliff timotimo: Do you know if perl6 subs can be passed as handlers to C code via NativeCall?
camelia rakudo-moar a1347c: OUTPUT«-1.77635683940025e-15␤»
timotimo they can
though i don't know what you mean by "handlers"s
Xliff kk
timotimo: Basically -- function pointers
timotimo ah, yes 02:47
that's what you get when you pass a sub as a &foo param
Xliff Now I feel dirty for saying "pointers" in this channel. Thanks for that.
So if I have a sub f(int, int, int) that returns a class A, how would I set that up? 02:48
timotimo it returns a class? :)
Xliff I'm being complex for a reason. ;)
so...
timotimo you can put --> A inside the parenthesis
though C doesn't care what the function looks like 02:49
Xliff sub myNativeCode(&foo(int, int, int) --> A)
timotimo as long as the code that's compiled to work with the argument uses it correctly
no, not like that
Xliff (although generally handlers are void)
(not always, though)
timotimo first off, you don't have to give any signature for that at all
there's no signaling or difference, really, for the C side which will be receiving that "function" 02:50
Xliff Maybe look into nativecall examples in roast again... ;P
timotimo the only difference is what perl6 will allow you to put in there 02:51
Xliff Also, can you see any possibility of libxslt being used without libxml2?
timotimo i have no clue about either of these libraries
Xliff Oh, so it's the "these are not the droids you are looking for" excuse? ;)
timotimo don't forget that the "signature" you declare in C only changes how the compiled code grabs its arguments from registers and the stack 02:53
Xliff OK. Confirms what I suspected. Thanks. 02:54
timotimo when you receive a function pointer from C, that's when you'll have to give it the right signature in perl6-land 02:54
so that perl6 knows what registers and stack positions to fill how
Xliff Yes, yes. 02:58
Xliff I've done the getting-functs-from-C-to-p6 dance, already. It was the other way that I hadn't done. 02:59
It's one thing to be able to run C-code in perl. It's another for C to accept P6 code. Although I guess that would just be a pointer to MoarVM byte-code? 03:00
timotimo nope
that would be insane
Xliff i'll shut up now, then.
"It's magic!"
timotimo we don't have a cpu that runs moarvm byte code yet
Xliff Nope. Now I'll shut up.
timotimo we just create a tiny piece of runnable code that grabs the arguments it's configured to take and invokes a sub-interpreter
gfldex leave him be, he is scared! :-> 03:01
Xliff Well. I meant a function pointer to a piece of moar VM that does the actual execution.
timotimo right
sadly, having a piece of C stack in the middle makes us really inflexible to what we can do
Xliff ((gfldex++)--) ^^ 0.314159
timotimo for example, we can't route exceptions through from the sub-interpreter to the main interpreter :( 03:02
that's what "unwound entire stack and missed the exception handler" means
Xliff Aha!
timotimo because who the F knows what was going on inside that moarvm sandwich
for all we know, it could have spawned a thread that constantly writes new values into the stack region that belongs to that piece of C code
timotimo and when we just say "well, we're done with this stack, now that we've got an exception through" 03:03
we're screwed bigtime :)
sadly, i know nothing about how C++ exceptions work. we could potentially cooperate with those 03:04
Xliff Ah! The joys (and hair-pulling-complexity) of language internals.
timotimo :)
Xliff (gfldex was right...)
timotimo this first article that showed up when searching for "c++ exception internals" suggests how exceptions are compiled/run depends on the compiler 03:07
fun!
but that can't be right 03:08
timotimo huh. so maybe it puts a symbol named "cxxabisomethingsomething" into the object file 03:11
maybe that's how they manage interoperability
timotimo how hard can it be to register a catch handler that just catches everything and uses some kind of introspection to figure out what the thrown exception class is called and build an X::Cpp::AdHoc with the name in it? :D 03:33
geekosaur "some kind of introspection" may not be a thing 03:39
(or rather, possibly exists but different for every c++ compiler or even version thereof)
wtwt5237 hi guys, I am an enthusiastic perl5 user. But I have to admit not many people are using perl now. Do you guys think perl6 will revive the glory of perl one day? Just curious what other people think 03:43
timotimo geekosaur: we're already crazy enough to support name mangling of a few different c++ compilers 03:45
timotimo wtwt5237: i've seen people say "perl usage is declining" and other people say "perl usage is staying strong"; i have no way to figure out which is accurate :( 03:46
seatek wtwt5237: ha! personally doesn't matter to me what other people are getting glorified on. this is working great for me.
timotimo but we're pretty certain that perl6 is a fantastic programming language and i'm certain its charm reaches more than just perl5 programmers
gfldex wtwt5237: so far all folk who spend time with Perl 6 and spoke up here where all very happy with Perl 6 and didn't want to look back.
wtwt5237: my personal view is, that given good performance will be had, Perl 6 will replace all dynamic languages. (this is a hopeful exaggeration) 03:48
seatek i'm one of those recent "crossovers" and it's been hard adjusting to something things, but every little struggle has been well worth it in unexpected payoffs so far
MasterDuke timotimo: did you happen to see my question in -dev? do you know anything about Perl6::World?
wtwt5237 good to meet all perl6 supporters here! 03:49
timotimo let me see
what is "the settings"?
well, i shall answer in -dev
MasterDuke m-CORE.setting
gfldex wtwt5237: making it easy to use of those cores will become more important and Perl 6 is shining in that area. There are a few bugs left tho. Given the current rate they should be gone in halve a year or so. 03:51
timotimo hopefully a bit earlier :) 03:52
seatek I've noticed that most of the documentation is reference-y. Some that go into more depth with examples. But I don't notice much in the way of tutorial-ish stuff. Is that not meant to be there, or has it just not been done much? I ask because I'm finding myself going overboard a bit on this grammars introduction, which honestly is seeming more like a tutorial now. 04:16
timotimo doc.perl6.org is indeed a reference. there's other documents for other purposes 04:18
perl6.org/resources/ - links to a bunch of them
seatek gotcha
timotimo though the language/ pages of the doc are supposed to be a bit less referency and a bit more tutorialy 04:19
seatek yeah that's the "advanced" intro to grammars in there. 04:20
timotimo are you refering to the regexes page or actually the grammars page? 04:21
seatek the grammars
it doesn't even say what they are, and drops people straight into protoregexes 04:22
timotimo yeah, that document is pretty short
"Grammar is the superclass that classes automatically get when they are declared with the grammar keyword instead of class." 04:23
seatek yeah so far i've got a bout 1500 words worth of intro to grammars and i'm probably half way through
yes that's very helpful
timotimo the sentence should probably be made less dense
but it contains everything that needs to be known: if you use "grammar", you're defining a class. it gets the default superclass Grammar.
seatek no because it's still not telling you want grammars are. anything could be a superclass
timotimo a grammar is really just a class. it's almost that simple. 04:24
seatek you guys can't see it because you're too used to it
timotimo probably
seatek yeah it was a 2 day struggle for me to get the lightbulb to go off fully including actions
and the docs are circular. make makes as ast. ast is a tree. made returns what you make 04:25
timotimo mh, yes
a little picture should be put in to clarify
seatek it's all dependent upon having specialized knowledge or insight 04:26
timotimo (plus a good description for people who don't have vision)
seatek yeah that's what i've been working on -- one little step at a time so it just makes sense the whole way 04:26
and then they can go to the advanced gammar page :)
grammar
timotimo it doesn't seem like the grammars page mentions that regexes, rules, tokens are extremely method-like 04:27
seatek yes, but i do ;)
timotimo that's good
in case that wasn't obvious, i appreciate that you're improving this part of the docs
seatek and i'm explaining about TOP and bubbling up
timotimo i haven't looked at this part much in the past, but i now see it's clearly deficient
do you already mention that the name "TOP" is only a convention? 04:28
seatek yes i said "by default"
timotimo good
i wonder if there should be a section for "under the hood" people: how to build a grammar without mentioning "grammar", "regex", "rule", or "token" in your code 04:29
seatek and i keep using method interchangeably with regex token and rule, keeping them all together in people's heads
seatek i think in the advanced stuff maybe 04:29
but grammars are weird at first. i'd let them get used to the conventional way first. that's the path i'm taking at least 04:30
timotimo sounds good
seatek but i want to write this while the wounds and suffering are still fresh in my mind
timotimo when you realize a grammar is "just" a class, it helps to get a little nudge in the "derive a grammar from another" and "mix in a role into a grammar"
good idea
seatek yes they're quite weird conceptually still to me.. and with their automated/hidden piping going on too ;) 04:31
timotimo piping? 04:32
seatek metaphoric piping. yes, like in actions especially -- how the token names can popage from the class into the TOP you make there, or optionally the method names in your actions 04:33
propagate
timotimo ah
seatek you guys don't think about that stuff
but it's a confusing mess to anyone new to it 04:34
timotimo hm
seatek it's beautiful -- and it's so helpful 04:34
timotimo <foo> is "just" an invocation to regex foo, which also (because it captures) puts the result of regex foo into $/<foo>, and when some rule or regex finishes matching with success, it'll look if there's a foo method in the current action object 04:35
that's what you mean?
seatek after that even -- when you're making the TOP for the action to return with your .made in the match 04:36
labster m: say Inf.new == 0;
camelia rakudo-moar a1347c: OUTPUT«True␤»
timotimo i couldn't parse that sentence, seatek
m: say "Hello!".new eq ""
camelia rakudo-moar a1347c: OUTPUT«True␤»
seatek TOP is built in the action as well, with make
labster yeah, I know, Inf is a Num. 04:37
timotimo um, i don't understand
seatek $m = GRAM.parse('stingy thing'); $m.made returns what your TOP in the action had
timotimo ah, i see what you mean 04:38
seatek even that is not made clear
timotimo because you never explicitly invoked TOP anywhere
but it still gets called, and its action method also gets called
labster m: say "Hello world".new.chars == Inf.new; # and we can combine them!
camelia rakudo-moar a1347c: OUTPUT«True␤»
seatek and how to you put your "make" 'stuff in there? what does it even mean to "make" something? ;) 04:39
look that up in the docs ;)
Sets the AST to $ast, and returns it.
so i'm trying to fill in all the gaping holes that exist for someone coming in fresh and new to these grammar beasties 04:40
timotimo right
well, the return value of Grammar.parse is just the $/ that's in your TOP
seatek yeah... to my mind, if you're bothering to use actions, and you're making stuff in your actions, you might as well make your own tidy TOP 04:42
so that when you call $m.made it's exactly the structure you expect
timotimo right 04:43
seatek i swear this gave me flashbacks to the feeling i had when i first realized what recursion was 04:45
timotimo :D 04:46
dalek c: 4f7b5a5 | timotimo++ | doc/Type/IO/Handle.pod6:
long explanation about getc and keyboard input

warn of buffering terminals and potential combining characters
05:16
timotimo ^- how do you feel about this?
seatek timotimo: i really like it, at least. those are the kinds of details that can make all the difference 05:36
it could save someone hours of frustration 05:37
timotimo mhm 05:38
samcv timotimo, sounds good. maybe make `a` in quotes like "a" it reads weird. maybe could change a to be a letter that isn't an actual work? 06:03
like z or x?
timotimo ah 06:04
samcv a probably the worst letter to you :P 'i' coming in second
*use
but i think it's great having info like that. those are the kinds of things that make me happy to read 06:05
timotimo so what quotes should i be using?
samcv well you use "a" later on, and i think that's fine 06:05
just change it to another letter preferably not a vowel 06:06
dalek c: d2da116 | timotimo++ | doc/Type/IO/Handle.pod6:
use e instead of a for less confusion
timotimo there we go
i think i used =item wrong here
samcv e is fine as well 06:07
dalek c: ae7ab1a | timotimo++ | doc/Type/IO/Handle.pod6:
indent prose text for items
samcv also
<3 for everyone working on the perl 6 docs
timotimo that's mostly not me :) 06:08
samcv you count though!
also curious. how useful are the perl 6 design docs for things that docs.perl6.org don't cover? 06:09
at least for object orientation is concerned
timotimo they haven't been updated to cover the latest changes for half a year or a whole year now
samcv docs or design docs?
timotimo design docs
timotimo they have been changed from being called "the specification" to "the design docs" 06:10
samcv hah
seatek timotimo: are protoregexes basically roles with arguments?
timotimo no, they are basically proto methods 06:11
all regexes may take arguments
proto is about multiness
seatek ok .. oh yes. that makes much more sense 06:12
seatek ok i'm filing that away for later study. it's enough to be able to start the car and drive at this point, rather than disassembing the transmission 06:15
timotimo :)
dataf3l hey guys 06:18
dataf3l I have a small CGI problem 06:18
timotimo greetings dataf3l
timotimo CGI is already a problem in itself, but let's hear what's wrong in your specific case 06:18
dataf3l Yeah I know CGI sucks but I want to use it temporarily until HTTP::Simple starts supporting concurrent requests 06:19
timotimo mhm
dataf3l this is my script: 06:20
#!/usr/local/bin/perl6
print("Content-Type: text/html\r\n\r\n");
print("nice\n");
I did chmod 755
when I run it I get a 500
timotimo what does your error.log say?
dataf3l Error message:
End of script output before headers: mine3.cgi
[Wed Nov 02 00:24:43.809494 2016] [cgi:error] [pid 70545] [client ::1:55190] AH01215: (8)Exec format error: exec of '/Applications/XAMPP/xamp 06:21
pfiles/htdocs/mine3.cgi' failed: /Applications/XAMPP/xamppfiles/htdocs/mine3.cgi
timotimo what does it look like when you /usr/local/bin/perl6 yourscript.p6?
dataf3l [Wed Nov 02 00:24:43.809788 2016] [cgi:error] [pid 70545] [client ::1:55190] End of script output before headers: mine3.cgi
timotimo looks like the path may be wrong
dataf3l Felipes-MacBook-Pro:htdocs a$ /usr/local/bin/perl6 mine3.cgi
Content-Type: text/html
nice
Felipes-MacBook-Pro:htdocs a$
timotimo and just ./mine3.cgi gives the same thing probably? 06:22
did you make sure cgi is allowed outside your cgi-bin folder?
dataf3l I have a bash file with a simple cgi script on the same folder with the same permissions 06:24
it works
Felipes-MacBook-Pro:htdocs a$ cat mine.cgi
#!/bin/bash
echo "Content-Type: text/html"
echo ""
echo "HelloWorld"
timotimo ah, i think i know what's happening 06:25
your \r\n may be getting translated to something else
try running your script through xxd to see what exactly it outputs 06:26
dataf3l good idea! 06:27
timotimo on mac, newlines are actually \r, aren't they?
dataf3l you were right! 06:28
I’m on a mac 06:29
Felipes-MacBook-Pro:htdocs a$ perl6 mine3.cgi|xxd
0000000: 436f 6e74 656e 742d 5479 7065 3a20 7465 Content-Type: te
0000010: 7874 2f68 746d 6c0d 0a0d 0a0a 6e69 6365 xt/html.....nice
0000020: 0a0a ..
I can see it shoud be 0a0d 0a0d but it reads 0a0a instead.
timotimo it seems like it's actually 0d0a0d0a0a
dataf3l why did \r\n\r\n get interpreted as such?
utf8?
timotimo it tries to get your platform's newlines right when you write \n 06:30
we translate on the way out of the program
seatek both a thank you and a grrr ;)
timotimo it looks like it can be configured on a per-stream basis 06:31
dataf3l wait
so the solution is?
how do I tell perl6 to just output the bytes I wrote in the source code verbatim instead of trying to do weird stuff? 06:32
also, you guys have been helpful
timotimo you're not telling it bytes to output 06:33
you're giving it a unicode string
you can output bytes with .write and a Buf
well, write in this case
since you want it to be a sub instead of a method
m: say $*OUT.perl 06:34
camelia rakudo-moar a1347c: OUTPUT«IO::Handle.new(:path(IO::Special.new(what => "<STDOUT>")),:chomp)␤»
timotimo you can change the .out-nl in any case 06:35
m: say $*OUT.out-nl
camelia rakudo-moar a1347c: OUTPUT«No such method 'out-nl' for invocant of type 'IO::Handle'␤ in block <unit> at <tmp> line 1␤␤»
timotimo m: say $*OUT.nl
camelia rakudo-moar a1347c: OUTPUT«No such method 'nl' for invocant of type 'IO::Handle'␤ in block <unit> at <tmp> line 1␤␤»
timotimo ho-hum?
m: $*OUT.print-nl
camelia rakudo-moar a1347c: OUTPUT«␤»
timotimo m: $*OUT.nl-out 06:36
camelia ( no output )
timotimo m: $*OUT.nl-out.perl.say
camelia rakudo-moar a1347c: OUTPUT«"\n"␤»
timotimo that's how.
dataf3l m: say $*OUT.^methods
camelia rakudo-moar a1347c: OUTPUT«(open nl-in close eof get getc comb words lines read readchars Supply seek tell write opened t lock unlock print put print-nl slurp-rest chmod IO path flush encoding DESTROY e d f s l r w x modified accessed changed mode watch native-descriptor umask split…»
dataf3l > say $*OUT.nl-out.perl
"\n"
timotimo that's the thing you get when you use things that'll put a newline at the end
like "say"
dataf3l ah
does print add an nl? 06:37
timotimo still not sure how to influence the automatic translation
it does not
dataf3l this works on the command line but the CGI doesn’t like it stll 06:39
$*OUT.write("Content-Type: text/html\r\n\r\ntest".encode);
xxd looks good 06:40
testFelipes-MacBook-Pro:htdocs a$ perl6 ./mine3.cgi|xxd
0000000: 436f 6e74 656e 742d 5479 7065 3a20 7465 Content-Type: te
0000010: 7874 2f68 746d 6c0d 0a0d 0a74 6573 74 xt/html....test
but still no workie on apache
timotimo that's strange. same error as before?
dataf3l pretty much 06:41
End of script output before headers: mine3.cgi
timotimo can you try outputting the same thing you're writing to $*ERR, too? 06:42
i think that ought to output it into the errors.log
oh, i mean: output .encode.perl
m: "Content-Type: text/html\r\n\r\ntest".encode.perl.say
camelia rakudo-moar a1347c: OUTPUT«utf8.new(67,111,110,116,101,110,116,45,84,121,112,101,58,32,116,101,120,116,47,104,116,109,108,13,10,13,10,116,101,115,116)␤»
dataf3l ok 06:43
utf8.new(67,111,110,116,101,110,116,45,84,121,112,101,58,32,116,101,120,116,47,104,116,109,108,13,10,13,10,116,101,115,116)
timotimo 13 10 13 10, that looks correct 06:44
hm. is it having trouble with not having a newline at the very end? shouldn't, though.
dataf3l End of script output before headers: mine4.cgi 06:45
how could I see what apache is seeing
timotimo good question
dataf3l maybe apache sees an error isntead of the output 06:46
and the error has no new lines or anything, jsut error lines
maybe this daemon user doesn’t have a good-looking perl6 install
seatek i have had trouble with some programs being able to kick off perl6 programs 06:47
timotimo perhaps, but you were able to get the error output from $*ERR.write
dataf3l what do you mean by het the error output 06:51
dataf3l how can I get said output 06:51
timotimo well, you put something in $*ERR and it landed in errors.log
so the script was clearly being run 06:52
dataf3l AH I see what you mean
seatek yeah
dataf3l let me try
ok now I have a new error :) 06:53
[Wed Nov 02 01:52:51.676830 2016] [cgi:error] [pid 91925] [client ::1:58640] AH01215: (13)Permission denied: exec of '/Applications/XAMPP /xamppfiles/htdocs/mine4.cgi' failed: /Applications/XAMPP/xamppfiles/htdocs/mine4.cgi
but this is my fault
timotimo fantastic
so ... forgot to +x? :) 06:54
timotimo i just gave synopsebot6 a little piece of code that'll hopefully build doc.perl6.org links from doc commits 06:55
but i'm not sure if it'll work :P
seatek is there some kind of special tagging you have to use to link elsewhere? 06:56
timotimo hm? 06:57
seatek i'm to 2000 words on this so far and haven't even got to actions yet
timotimo something with L<...>, but i'm not sure about the specifics
seatek oh is it podish?
timotimo yeah, pod6
seatek k
dataf3l ERR write does not write to err or apache logs 06:58
which means script never ran
timotimo oh? 07:00
dataf3l [Wed Nov 02 02:01:03.032448 2016] [cgi:error] [pid 94121] [client ::1:58777] AH01215: (13)Permission denied: exec of '/Applications/XAMPP/xam 07:02
ppfiles/htdocs/mine4.cgi' failed: /Applications/XAMPP/xamppfiles/htdocs/mine4.cgi
[Wed Nov 02 02:01:03.032646 2016] [cgi:error] [pid 94121] [client ::1:58777] End of script output before headers: mine4.cgi
timotimo well, "permission denied" is kind of obvious?
about what's going wrong?
dataf3l ok bad permissions was I needed to do chmod 755 to the file 07:03
the file now indicates: [Wed Nov 02 02:02:53.756409 2016] [cgi:error] [pid 94119] [client ::1:58812] AH01215: (8)Exec format error: exec of '/Applications/XAMPP/xamp
pfiles/htdocs/mine4.cgi' failed: /Applications/XAMPP/xamppfiles/htdocs/mine4.cgi
which is the error I’ve always had
no wait
that’s a different one!!!
YES! :)
dataf3l this is just too frustrating 07:09
problem appears to be with my apache installation, since test-cgi doesn’t work 07:12
even though the other, simple cgi script I wrote in bash DID work...
seatek do you have any space at the top of the file? 07:13
before the #!/usr/bin/perl6 stuff?
dataf3l 1st line: #!/usr/local/bin/perl6 07:14
verbatim
I wish I had that space mr.
incidentaly, the perl5 cgi example worked without issue
I can’t believe I’ll say this: perl5 is somehow looking attractive?!? 07:15
seatek do you have sudo access?
dataf3l is that possible?
yeah it’s my mac
but the script run as “daemon"
seatek try running that script as the user apache runs under
dataf3l some user created by the XAMPP installation
ok I’ll try
seatek i'll bet the apache user doesn't have a proper environment to run perl6... but then again, i don't know how you installed perl6... i do know that /usr/local/bin for anything to run from a web server would make me nervous 07:17
seatek synopsebot6 is agitated this evening 07:18
timotimo i fixed that doc link detection stuff and when the next doc commit lands it should give some output
i restarted it a bunch
manually, that is
seatek ah! so you're responsible for its agitation! 07:19
dataf3l brew install perl6
you are probably correct, seatek
seatek brew sets up specific environment variables for you to be able to run perl6 07:20
you will need to give those to the user apache runs under
and make sure they have permission to execute that file hierarchy in which it's installed
or just install again after sudo'ing to the apache user :) 07:21
timotimo that's the great thing about running web apps via mod_proxy
you can much more easily step in the middle and inspect what's up 07:22
seatek i've gotten spoilt by the psgi stuff, and mst's stuff 07:22
seatek psgi is here if i'm remembering right, in perl6... cracker it's called, or something. 07:23
crispy crust
crust
i think that's it 07:24
timotimo crust is definitely a thing
seatek yeah that's on my near horizon
seatek wait. didin't you do a json thing? 07:25
timotimo i'm responsible for JSON::Fast 07:26
seatek i love that module. i hate json. that module lets me love and hate json
timotimo only the parsing portion, though
seatek ah ok. i can't remember if i went with that one or the other one.. tiny or something
timotimo yeah 07:27
they are functionally equivalent except in corner cases
dataf3l this feels like too much work, I’m trying to use perl6 so much, but for some reason, it doens’t like any of my ideas
seatek i probably went with fast instead of tiny. i'm a sucker like that
dataf3l: yeah it can be awkward getting it to install globally on a system. 07:28
dataf3l I wanted a simple cgi thingie, nope. tried the http::simple, nope (single thread), tried http tiny: too complicated, tried importing modules, couldn’t figure out how to import modules.
dataf3l I wanted to avoid golang, since it’s syntax makes it too verbose, but at this point, golang looks more atractive than perl6, I’m sad to say 07:29
seatek i've run into that too. i can't wait until distributions start picking it up with the latest.
timotimo how do you feel about HTTP::Server::Threaded? 07:29
timotimo BBL 07:31
dataf3l downloading...
seatek i always, even with perl5, do a brew install for the user that the http process will be running under
stmuk_ I like both go and perl 6. There is a place for both 07:32
dataf3l that makes sense
stmuk_ they do have virtually opposite philosophies
dataf3l tried the example:
github.com/tony-o/perl6-http-server-threaded
the example failed 07:33
Cannot directly create a Supply. You might want:
- To use a Supplier in order to get a live supply
- To use Supply.on-demand to create an on-demand supply
- To create a Supply using a supply block
in method at /usr/local/Cellar/rakudo-star/2016.07/share/perl6/site/sources/3CA3A94E8EC6BDFE95FC1E93CCDF60DD679B9836 (HTTP::Server::Threaded) line 9
in block <unit> at threaded.p6 line 3
since the example failed, then I guess I feel “unsure” about HTTP::Server::Threaded, given it was the “simple example” from the readme, timotimo
seatek is that the latest version? there was a commit 5 days ago 07:34
dataf3l what does panda install? 07:34
seatek the latest at the time 07:35
you can just a panda install <modulename> again to get the latest
dataf3l I fear any mistake I do in the code will bring down the server 07:37
if the server is all perl6
which is why I was thinking of cgi, old school, but no server down, just user 500
seatek Ah. yeah. I haven't gotten into the server stuff yet here in p6... slowly working my way there. 07:38
i glanced a couple times though -- there were even a couple frameworks 07:39
dataf3l ok 07:40
I stumbled into this
github.com/tony-o/perl6-http-server-async
downloads OK from panda
builds ok and passes all unit tests
hello world works, although I had to read the source in order to determine the default port
which was 1666
seatek we're all gonna die 07:41
dataf3l for now, this might be what I’m looking for, let’s hope it’s multi-threaded.
valar morgulis
[ptc] valar doaheris
dataf3l guys, you all have been super helpful, I f-ing love this community 07:42
seatek :)
async is nothing to sneeze at, even if it is single-threaded ;)
masak guten morning, #perl6 08:56
arnsholt o/
eiro o/ 09:03
tbrowder \o 09:45
ref file handles: i'm trying to do some sig type constraints on an open file handle
according to the docs, i should be able to test for single letter methods (of which only t seems to be explicitly mentioned in the class) 09:47
e.g., my $f = open 'f'; say $f.r; => True, fine 09:48
tbrowder and these all say False: t, d; That checks 09:54
but this should say False but shows True: w 09:55
note also that if the file is open as writable, then it still shows r as true 09:57
now i'm looking at the smart match to see if anything changes... 09:58
tbrowder same results 10:08
(note there are doc issues for most of the single-letter methods) 10:09
avar mst: Status of your not-so-shitty packaging for p6 moar/nqp/rakudo/modules? 11:35
tbrowder .tell viki Your solution was almost perfect (except you used my inefficient code that created the sting), i tweaked a bit and have working code that does what i want. see it at gist gist.github.com/tbrowder/60914f63c...06078ffb41
yoleaux tbrowder: I'll pass your message to viki.
avar Building rakudo* 2016.10 with my shitty hacky build.. 11:36
ab6tract avar: i believe they are somewhere on shadow.cat, but it's been a while since his presentation 12:26
DrForr And he's probably en route here. 12:27
ab6tract DrForr: so mst is kind of like bloody mary? "mst... mst... mst..." 12:28
[Coke] moritz++ I had sending out the request on my todo list for a month! :( 12:29
DrForr I... suppose so.
[Coke] (for advent) 12:30
moritz so far no new signups in response :( 12:33
DrForr In response to what? (I've been offline for a few days, but not long enough to feel the effects...) 12:39
user100500 hello all! (testing) 12:40
DrForr Your client seems to work :) 12:41
[Coke] timotimo: why did you indent the text in IO::Handle? 12:41
(it turns it into a block quote) 12:42
dalek c: 5ad05a7 | coke++ | xt/words.pws:
learn new words
timotimo i was hoping it'd indent it to become part of the =item 12:43
[Coke] docs.perl6.org/routine/getc 12:44
it renders it as code.
timotimo i see it. i don't know how to fix it properly 12:48
=begin item title text blah maybe?
[Coke] just follow the style from elsewhere? 12:50
not sure we have that style elsewhere. Maybe make them the next smaller head. 12:51
timotimo i could do that, actually 12:55
user100500 Question (bad English): how to draw a conclusion binary data as in python? Example: perl6 -e "my $bdata = Buf.new('qwerty'.encode('utf-8')); say $bdata;" # Buf:0x<71 77 65 72 74 79> python -c "bdata = b'qwerty'; print(bdata)" # b'qwerty' 13:09
timotimo you can just .decode('latin1') it, for example
user100500 Thanks. Next example (binary key in hash): python -c "bdata = {'Вася Уткин'.encode(): b'test'}; print(bdata)" # {b'\xd0\xb2\xd0\xb0\xd1\x81\xd1\x8f \xd1\x83\xd1\x82\xd0\xba\xd0\xb8\xd0\xbd': b'test'} perl6 -e "my $v = Buf.new('test'.encode('utf-8')); my %bdata = $v => $v; say %bdata;" # error :( 13:32
timotimo the problem is that Buf is read-write, whereas bytestrings in python are read-only 13:33
maybe use .Blob on the result of .encode to make it read-only
ilmari m: 'test'.encode().Blob.say 13:37
camelia rakudo-moar 8c3e57: OUTPUT«No such method 'Blob' for invocant of type 'utf8'␤ in block <unit> at <tmp> line 1␤␤»
ilmari m: Blob.new('test'.encode()).say
camelia rakudo-moar 8c3e57: OUTPUT«Blob:0x<74 65 73 74>␤»
ilmari m: my $v = Blob.new('test'.encode()); my %bdata = $v => $v; dd %bdata; 13:38
camelia rakudo-moar 8c3e57: OUTPUT«Cannot use a Buf as a string, but you called the Str method on it␤ in block <unit> at <tmp> line 1␤␤»
ilmari m: my $v = Blob.new('test'.encode()); my %bdata = $v => $v; say %bdata
camelia rakudo-moar 8c3e57: OUTPUT«Cannot use a Buf as a string, but you called the Str method on it␤ in block <unit> at <tmp> line 1␤␤»
timotimo user100500: were you able to do it? 13:54
m: my $v = Blob.new('test'.encode('utf8')); my %bdata = $v => $v; say %bdata.perl 13:55
camelia rakudo-moar 8c3e57: OUTPUT«Cannot use a Buf as a string, but you called the Str method on it␤ in block <unit> at <tmp> line 1␤␤»
timotimo ah, that's the error. of course!
m: my $v = Blob.new('test'.encode('utf8')); my %bdata{Any} = $v => $v; say %bdata.perl
camelia rakudo-moar 8c3e57: OUTPUT«(my Any %{Any} = (Blob.new(116,101,115,116)) => Blob.new(116,101,115,116))␤»
timotimo user100500: ^ this is the solution. you need an object hash. the regular hash will stringify all of the keys
user100500 I was trying to make a library to parse torrent files and I can't. To parse the string easily, but a binary string is a lot harder. 13:59
timotimo it's true
nicq20 Hello o/ 14:04
timotimo greetings nicq20 14:04
viki tbrowder: FWIW, this whole thing can be written as just $f.say: $str x 2 + $triple; This way you don't duplicate $str all over the place in code and don't need to create a separate variable just to store a temporary result: gist.github.com/tbrowder/60914f63c...-txt-L7-L9 14:05
yoleaux 11:35Z <tbrowder> viki: Your solution was almost perfect (except you used my inefficient code that created the sting), i tweaked a bit and have working code that does what i want. see it at gist gist.github.com/tbrowder/60914f63c...06078ffb41
user100500 timotimo: Thank you :) 14:14
viki BenGoldberg, RE comparisons with NaNs: we didn't come up with that willy-nilly. We follow the IEEE 2008-754. Table 5.3 confirms the results you got. 14:20
tbrowder viki: for the simple case that's true, but i believe my cookbook template method is required when more complicated text mods are being made. thus avoiding string dup becomes more important. 14:42
viki or do we... 14:44
viki reads more
tbrowder you'll see what i mean when i release my next module (or see the multi sub write-paragraph at github.com/tbrowder/Misc-Utils-Perl6 14:50
viki I hope to FSM you won't name that module Misc::Utils :)
tbrowder what do you suggest? 14:51
viki Yeah, we're good with NaN's. The Nil basically signals the comparison is unordered. 14:52
m: say (4 <=> NaN) ~~ Same|Less|More
camelia rakudo-moar 8c3e57: OUTPUT«False␤»
viki And 5.11 says "Every NaN shall compare unordered with everything, including itself."
tbrowder: ANYTHING else. Misc::Utils is like inventing a product and calling it "Generic Widget" 14:53
tbrowder well, it is a generic widget
viki No, it isn't.
tbrowder well put out a suggested name then 14:54
viki I don't know what it does.
Misc::Utils conveys exactly zero information about what the module is about.
FWIW token decimal is forgetting to match the sign 14:56
m: my $hexchar = "F"; say :16($hexchar) 14:57
camelia rakudo-moar 8c3e57: OUTPUT«15␤»
viki m: my $time-in-seconds = 3671; say $time-in-seconds.polymod: <60 60 24> 14:59
camelia rakudo-moar 8c3e57: OUTPUT«(11 1 1 0)␤»
viki m: my $un-normalazed-string = " fo bar ber "; dd $un-normalazed-string.words.join: " " 15:02
camelia rakudo-moar 8c3e57: OUTPUT«"fo bar ber"␤»
viki tbrowder: well, now that I've read the source, I can give a better analogy: it's like writing four novels of different genre, gluing them together, then putting the result in "General" section in the library. 15:03
tbrowder: you go from timing a run of a command, to stripping comments (of which language?), to performing date operations, to doing string operations, to doing some sort of numeric base conversion operations. A module's name is a mnemonic for its function. I'm unsure what you're hoping to create with this module: a go-to library? If I want any hex operation or date operation, I just pull out Misc::Utils or 15:06
something?
Your strip-comment sub is entirely broken, BTW. { say "Hello # World!"; } <-- the '#' is not a comment in this code, but it'll assume it is.
I don't mean to sound like I'm intentionally poo-pooing your idea, but I can guarantee the current tragectory will leave you with you being the sole user of your module. 15:08
viki & lunch
tbrowder well it is called "Misc"Utils" after all. And I can later try to organize into categories if that would help. And I don't pretend it's perfect yet (thanks for the bug report), either, that's why I haven't released it. 15:09
ilmari TBrowder's::Random::Stuff 15:11
viki Right, but if I want a module to strip comments, I won't be looking for Misc::Utils. I'll be looking for String::Strip, String::Comment, Str::Utils or something like that. Even if I notice Misc::Utils in my search results, it'd likely be a waste of my time trying to read its documentation to see whether it actually does perform this particular string operation.
It's trying to do too much.
Release 4 modules instead of 1 15:12
DrForr Does ' still work for a namespace separator?
ilmari m: package Foo'Bar { sub baz { say "yay" } }; Foo'Bar::baz() 15:13
camelia rakudo-moar 8c3e57: OUTPUT«Could not find symbol '&baz'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
ilmari m: my $foo'bar = 42; say $foo'bar 15:14
camelia rakudo-moar 8c3e57: OUTPUT«42␤»
ilmari works in variable names, at least
viki DrForr: no
m: package Foo'Bar { our sub baz { say "yay" } }; Foo'Bar::baz() 15:15
camelia rakudo-moar 8c3e57: OUTPUT«yay␤»
viki Works in package names too, but it's not a replacement for ::. It's just a char
viki s/replacement/synonym/; 15:16
DrForr I expect I'll have more questions, though I'm probably better off RTFS.
tbrowder viki: have you read the short desciptions? I know they need improvenent 15:24
tbrowder viki: another thing to be done is to organize more export tag groups (such as the "4" you mentioned). also more info in the META6 would help 15:26
viki You'll end up with a giant document describing the functionality of the module with the most non-descript name in the universe. 15:42
Don't let me stop you, tho.
tbrowder viki: i appreciate yr comments, and will see what i can do... 15:44
tbrowder viki: another subject. did you see my comments earlier about tests on an IO::Handle? i get true values where i don't expect them, e.g., on a handle for a file opened read only i get true on "say $fh ~~ :w;" 15:47
dalek c: b982e3d | gfldex++ | doc/Language/functions.pod6:
doc nextcallee
15:57
synopsebot6 Link: doc.perl6.org/language/functions.pod6:
[Coke] m: my $a = say "HI"; say $a; 15:58
camelia rakudo-moar 8c3e57: OUTPUT«HI␤True␤»
[Coke] tbrowder: ^^ that?
viki tbrowder: no, haven't seen them. Weird. 15:59
s: &infix:<~~>, open("/tmp/foo", :w), \(:r)
SourceBaby viki, Something's wrong: ␤ERR: Cannot resolve caller sourcery(Sub+{Precedence}, IO::Handle, Capture); 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␤␤
viki s: &infix:<~~>, \(open("/tmp/foo", :w), :r)
SourceBaby viki, Something's wrong: ␤ERR: Could not find candidate that can do \(IO::Handle.new(:path("/tmp/foo".IO(:SPEC(IO::Spec::Unix),:CWD("/home/zoffix/services/sourceable/perl6"))),:chomp), :r)␤ in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 37␤ in block <unit> at -e line 6␤␤
viki hmm
s: &infix:<~~>, \(Pair.new("r", True), open("/tmp/foo", :w)) 16:00
SourceBaby viki, Sauce is at github.com/rakudo/rakudo/blob/8c3e...Mu.pm#L807
viki s: open("/tmp/foo", :w), 'w', \() 16:01
SourceBaby viki, Sauce is at github.com/rakudo/rakudo/blob/8c3e...le.pm#L752
viki tbrowder: yeah, I can reproduce it on 2016.10-15-g43dbc96. { my $fh = open "foo", :r; say $fh.path.w } gives True 16:04
and opening in :w, gives True for .e
I mean for .r
viki m: say "foo".IO.w 16:05
camelia rakudo-moar 8c3e57: OUTPUT«True␤»
viki star: say "foo".IO.w
camelia star-m 2016.04: OUTPUT«Failed to find 'foo' while trying to do '.w'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
viki bisectable6: \say "foo".IO.w 16:06
bisectable6 viki, On both starting points (old=2015.12 new=abf6caf) the exit code is 1 and the output is identical as well
viki, Output on both points: Failed to find 'foo' while trying to do '.w'␤ in block <unit> at /tmp/o6bKR1Pahw line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/o6bKR1Pahw line 1␤
viki dafuq 16:06
bisectable6: say "foo".IO.w
bisectable6 viki, On both starting points (old=2015.12 new=abf6caf) the exit code is 1 and the output is identical as well
viki, Output on both points: Failed to find 'foo' while trying to do '.w'␤ in block <unit> at /tmp/mUSQ6zoXba line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/mUSQ6zoXba line 1␤
viki Oh, I *did* have foo locally :} (and camelia is restricted, I'm guessing) 16:07
or too has foo in there 16:08
tbrowder viki: My test code is in gist: gist.github.com/tbrowder/90c50fff3...8b1a7552d0 16:10
viki tbrowder: I think I get it. The :r, :w test the readness/writeness of the *file* the open opened. Not whether it was open in read/write mode
tbrowder ah, only a stat test, then--bummer. well then maybe that's a nice new feature for IO::Handle! 16:12
viki Well, it *is* a part of IO::Handle.
tbrowder with it as a type constrain it could be useful
viki It basically boils down to this test: github.com/rakudo/rakudo/blob/8c3e...s.pm#L1708 Note the `abspath` featured there. 16:13
Oh wait. I'm confusing things.
viki stops doing two things at once
brb
tbrowder i mean add or fix it so it truly applies to the handle, NOT the file (i.e., a meta characteristic i guess) 16:14
I meant to try the introspection on IO::Handle but haven't yet
gotta leave for a while... 16:15
dalek c: 80ab9ff | timotimo++ | doc/Type/IO/Handle.pod6:
use head3 instead of item for getc extra text
16:37
synopsebot6 Link: doc.perl6.org/type/IO/Handle.pod6:
timotimo damn, it kept the : %)
timotimo (the reason was that it had .pod6, but i expected only .pod) 16:56
tbrowder viki: disregard all I've complained about IO::Handle for now. If a parameter file handle is expected to be writable and it's not, we get an exception, so that should take care of it for now. I've just started experimenting with introspection with IO::Handle so I may have some more questions later. 16:57
TimToady just realized that "put" can mean "print using terminator" :) 17:04
jnthn hands backronym of the day award to TimToady :) 17:07
TimToady I knew that I already liked 'put' a little because it started with the same letter as 'print'; now I know why :) 17:08
tbrowder viki: i tried all the documented metamethods and the lost interesting is .VAR, it gave: 17:22
s/lost/most/ 17:23
IO::Handle.new(:path("test-file.txt".IO(:SPEC(IO::Spec::Unix),:CWD("/usr/local/people/tbrowde/mydata/tbrowde-home-bzr/perl6/p6-repo-scripts-and-tests/signatures"))),:chomp)
looks like the open mode should be there if it were anywhere
viki OK. I'm done with the other thing. 17:25
tbrowder: well, the .w test on the handle is just a .w test on the path: github.com/rakudo/rakudo/blob/8c3e...le.pm#L752
So it's not a test of the open mode, it's the test of the file the handle points to. 17:26
tbrowder exactly, that's why we need to find the file open mode on the handle if it's available, the single letter methods as you say point back to the stat call on the file itself which should be rw unless changed with a stat call after closing the handle. 17:28
sorry, chmod
at least on *nix
viki It's not stored in IO::Handle 17:31
tbrowder viki: leaving again..i'll do some more work on Misc::Utils later. BTW, remember it's a WIP and the feedback is VERY helpful (see issues i entered raised by you)
tbrowder i know, but that (.VAR) would be the place to find it, no? 17:32
viki No. 17:33
tbrowder: $llmode contains that information and as you can see, it's just passed to nqp ops. The $!PIO may contain that info, I dunno: github.com/rakudo/rakudo/blob/8c3e...pm#L94-L96
FROGGS o/ 17:35
viki \o
tbrowder viki: i think i see the logic, and i'm beating a dead horse again: the system throws if we try to write to a file open read only, that's the the way system open works and i don't see any way to add any useful info--case closed, Watson! 17:41
bye again for a while... 17:42
viki Well, nothing's impossible :)
We can always add open-mode 17:43
And stick $llmode into it on .open
viki tbrowder: so we'd add $.open-mode attribute. Default it to Nil and set it to $llmode here: github.com/rakudo/rakudo/blob/8c3e...dle.pm#L99 and set it back to Nil on .close and on .slurp-rest when :close is set. Maybe you could try submitting a PR with that. 17:45
(maybe with an enum for open mode rather than 'r'/'-'/'+' strings) 17:46
viki m: sub infix:<∅>(**@p) is pure { dd @p.elems }; say ∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅ 18:05
camelia rakudo-moar abf6ca: OUTPUT«Too many positionals passed; expected 2 arguments but got 9␤ in block <unit> at <tmp> line 1␤␤»
viki ?
Oh, wrong symbol in the op 18:06
Curse you, Unicode!
viki m: sub infix:<⊖>(**@p) is pure { dd @p.elems }; sink ∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅⊖∅ 18:06
camelia rakudo-moar abf6ca: OUTPUT«9␤»
viki Cool. I didn't realize infixes behaved like that.
m: sub infix:<⊖>(**@p) is pure { dd @p }; sink 2⊖3⊖5⊖10⊖11⊖44⊖55⊖82⊖101 18:07
camelia rakudo-moar abf6ca: OUTPUT«[2, 3, 5, 10, 11, 44, 55, 82, 101]␤»
viki m: sub infix:<😻>(**@p) is pure { dd @p }; sink 2 😻 3 😻 5 😻 10 😻 11 😻 44 😻 55 😻 82 😻 101 18:08
camelia rakudo-moar abf6ca: OUTPUT«[2, 3]␤[Any, 5]␤[Any, 10]␤[Any, 11]␤[Any, 44]␤[Any, 55]␤[Any, 82]␤[Any, 101]␤»
viki Awww. Apparently that only works for ops that are marked as changed in grammar? 18:09
TimToady token infix:sym«⊖» { <sym> <O(|%junctive_or)> } 18:10
TimToady and junctive_or is list associative 18:10
vendethiel m: sub infix:<😻>(**@p) is assoc("list") is pure { dd @p }; sink 2 😻 3 😻 5 😻 10 😻 11 😻 44 😻 55 😻 82 😻 101
camelia rakudo-moar abf6ca: OUTPUT«[2, 3, 5, 10, 11, 44, 55, 82, 101]␤»
vendethiel @viki ^
oh. Typing esc on a docs.perl6.org page will scroll up because it's caught by the field. mmh... 18:11
TimToady and we haven't thought about whether (^) can have a list associative meaning that is, er, meaningful...
vendethiel viki: see docs.perl6.org/language/operators#...Precedence (scroll to the 2nd table, associativities)
TimToady it's rather similar to ^^ though, which is defined as as a one() listop, not as the parity-based binary +^ 18:12
viki vendethiel: neat
m: sub infix:<😻>(**@p) is assoc("chain") { dd @p; '😻' }; sink 2 😻 3 😻 5 😻 10 😻 11 😻 44 😻 55 😻 82 😻 101 18:14
camelia rakudo-moar abf6ca: OUTPUT«[82, 101]␤[55, "😻"]␤[44, "😻"]␤[11, "😻"]␤[10, "😻"]␤[5, "😻"]␤[3, "😻"]␤[2, "😻"]␤»
viki cool
dalek c: f4fd7fa | coke++ | xt/code.pws:
Track new code varnames
19:24
harmil_wk Examples above inspired me: 19:38
m: sub infix:<%%%>(**@p) is assoc("list") is pure { ([%] @p) == 0 }; say 8 %%% 6 %%% 2
camelia rakudo-moar 5d1b2c: OUTPUT«True␤»
harmil_wk Equivalent to a % b % ... %% n
tbrowder viki: i'll put that on my todo list, but low priority--in the meantime i'm working on breaking up my misc::utils module 19:42
masak I've been experiencing test failures in the `prove` harness (but not outside) on recent Rakudos 19:45
`prove` just reports "Non-zero wait status: 11" and "Parse errors: No plan found in TAP output" for some test files
(same ones every time)
but when I run them in any other way, they come out fine 19:46
viki masak: that's a segfault
moritz masak: have you tried strace or similar on prove, to see if there's actuall an exit code 11 involved? 19:47
viki masak: which test in particular btw?
test file
and when they "come out fine" do they actually include the TAP plan? :) 19:49
FROGGS masak: do these test files involve testing io? like subprocesses, captures, or similar? 19:50
viki Hum, "Now part of the Proc::Async class, but looks to work as in Perl 5" docs.perl6.org/language/5to6-perlfunc#kill 19:51
Except it ain't. Perl 5's kill can kill any pid, but P::A's kill kill's the P::A instance :/
masak FROGGS: yes. uncanny. it does a qqx[grep] 19:53
jnthn masak: Maybe try running them under prove with passing --exec="perl6-gdb" or so
masak hmm
...does that actually work? :)
I mean, does prove end up giving gdb control in case of a segfault? 19:54
FROGGS masak: the harness combines stdout and stderr or so, and this used to break tests in the past that deal with the stuff mentioned
FROGGS I never understood why this happens 19:54
jnthn masak: Um...well, gdb may not end up giving you control actually :)
*prove
So yeah, may not work quite as well as hoped 19:55
FROGGS you can invoke perl6-gdb-m there, did that already
jnthn ah, cool
FROGGS though, that does not mean that the error will still be present
jnthn *nod*
Yeah, hanging ones under prove are easier in that you just attach gdb to them using the PID 19:56
jnthn Guess you can get a core dump 19:57
masak what's a recommended way to say "I know this value will trigger a 'useless use' warning, but just sink it uselessly anyway" ? 20:01
masak has found `$ = ...` so far, but doesn't feel that's so clear 20:02
moritz m: sink 1
camelia rakudo-moar 5d1b2c: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
moritz :(
masak: I'm curious, where does the need arise? 20:03
moritz has no better ideas right now
[Coke] m: quiet 1
camelia rakudo-moar 5d1b2c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ quiet used at line 1␤␤»
[Coke] m: quietly 1
camelia rakudo-moar 5d1b2c: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
[Coke] m: INI 1 20:04
camelia rakudo-moar 5d1b2c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤ INI used at line 1␤␤»
[Coke] maybe we should add phasers to the lookup list.
moritz m: start 1
camelia rakudo-moar 5d1b2c: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
masak moritz: I'm golfing a tough one 20:05
usually you can bisect and identify which bits contribute to the error 20:06
with this one it feels like a dozen or so things conspire to bring it about; remove any one of them, and the error geos away
goes*
labster m: my $year = 2006; my @firstdayofmonth = (1..12).map: Date.new( :$year, :month( * )).day-of-year 20:13
camelia rakudo-moar 5d1b2c: OUTPUT«Cannot call Date.new with these named parameters: month year␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in any at gen/moar/m-Metamodel.nqp line 3096␤ in block <unit> at <tmp> line 1␤␤»
labster m: Date.new( :2006year, :12month); 20:14
camelia ( no output )
moritz argument lists generally don't *-curry 20:15
labster but doesn't infix:<+> work with an argument list too? 20:17
Treated differently by the grammar, I guess. But that error is still LTA, because it's actually a false statement.
moritz m: say Date.new(year => 2016, month => 1) 20:18
camelia rakudo-moar 5d1b2c: OUTPUT«2016-01-01␤»
masak gives up this golf and just replaces a `gather` block with pushing to an array, making the bug go away 20:23
boring, reliable code wins the day. 20:24
yeah. I'm definitely seeing more segfaults since I built latest rakudo. now I got one in a test file that doesn't do any subprocesses. 20:31
I was able to run perl6-gdb-m just now, but the error did not happen since it was outside of `prove` 20:32
[Coke] a/me wonders if we'll ever have a day when someone is trying to debug a "why doesn't my all inclusive perl6 IDE using this 3rd party plugin fail in this weird way" like I am having today with eclipse. :| 20:40
avar When I'm building rakudo star, ./perl6 <what> allows me to load with -m one of the modules I build in modules/? 20:56
raiph avar: do you mean -M rather than -m? 21:12
avar yes 21:15
viki Yeah 21:16
Well, -M just adds paths to module search path, just like in P5. Not sure what's in modules/ :) 21:17
*M adds module to load
gah
-I adds paths to lib :) /me needs sleeps
FROGGS -I is what you said first
star has a folder called "modules"
and when you installed star, all modules will be accessible via -FThe::Module and via perl6 -e 'use The::Module;' 21:18
viki hm hm... yeah. After you install them. I'm looking now and just ./perl6 after building won't work, because they're in repo folders and proper paths that would work with -Imodules -MWhatever 21:19
avar Yeah, what I'm doing is debugging the build of rakudo* itself, with 2016.07 monkeypatching modules/MODULES.txt and dropping in a new modules/* module worked to make it build Inline-Perl5
But now it doesn't work, poking at "make install" now to see if I can somehow get it to tell me what it actually built 21:20
viki Interestingly, I don't see Inline-Perl5 in MODULES.txt in 2016.10. 21:21
avar It's not there, I'm manually adding it 21:22
viki I guess it's not part of it ¯\_(ツ)_/¯
avar tar zxf %{_sourcedir}/Inline-Perl5-2016-11-02-65ceb50.tar.gz -C modules
echo "Inline-Perl5" >> modules/MODULES.txt
viki I see 21:23
DrForr Does the trailing colon in an expression like 'try parse: $x;' have a special name? 21:25
moritz uhm, is that indirect object notation? 21:26
or is the 'parse:' a label there?
timotimo i don't think a label is allowed in that location
timotimo so yeah, indirect object notation 21:26
geekosaur neither, foo: bar is an alternative to foo(bar) 21:27
timotimo um, no.
geekosaur does not think of that as indirect since bar is not an object there...
necessarily
timotimo foo: bar is just bar()
DrForr Well, it's 'try Exp24.parse: $x;' # I assumed it was the equivaent of 'try Exp24.parse( $x );'
timotimo yes, that is correct 21:28
what you see there is a statementlist prefix form
the try just goes in front for funsies, like a sub would
but try Exp24.parse: $blah is very different from try parse: $blah 21:29
avar If I find issues with rakudo* in particular, what's a good point of contact? I.e. is there a bug tracker, or do I just harass this channel?:)
timotimo rakudo star in particular has rakudo/star on github
that has an issue tracker
avar will poke that, thanks 21:30
DrForr I'll treat it as an argument list with a single prefix colon. Tomorrow night :)
harmil_wk In current rakudo, what would be the equivalent if any of the S05-specced /^ <before $prefix> <* $full> $/ where $prefix is a left-anchored subset of $full? 21:35
timotimo i don't know what that means. at all. 21:37
harmil_wk <* ...> was supposed to be a partial match, so <* $foo> should match zero-or-more characters of $foo. 21:38
To quote S05, "A leading * indicates that the following pattern allows a partial match. It always succeeds after matching as many characters as possible." 21:39
moritz harmil_wk: I don't think there's any equivalence
harmil_wk Hmm, okay.
thanks
avar files github.com/rakudo/star/issues/77 21:40
harmil_wk m: my $_ = "apple"; my $prefix = "ap"; my $full = "applesauce"; say (/^ $prefix (.*) $/ and $full ~~ /^$0/); 21:44
camelia rakudo-moar ebcc33: OUTPUT«Potential difficulties:␤ Redeclaration of symbol '$_'␤ at <tmp>:1␤ ------> 3my $_7⏏5 = "apple"; my $prefix = "ap"; my $full ␤Nil␤»
harmil_wk m: $_ = "apple"; my $prefix = "ap"; my $full = "applesauce"; say (/^ $prefix (.*) $/ and $full ~~ /^$0/); 21:45
camelia rakudo-moar ebcc33: OUTPUT«Nil␤»
harmil_wk Bah
timotimo i didn't know of that feature yet. cool. 21:46
i think you could have something like / $prefix & [ .* $suffix ] /
oh, but that doesn't do the partial match part that you apparently want
never mind. 21:47
harmil_wk I think today it needs to be two matches, just trying to figure out how
Ugly but working: 21:50
m: $_ = "apple"; my $prefix = "ap"; my $full = "applesauce"; say (/^ $prefix (.*) $/ and (my $m = $0) and $full ~~ /^$prefix$m/)
camelia rakudo-moar ebcc33: OUTPUT«「apple」␤»
moritz m: my $full = 'applesauce'; my $re = $full.flip.comb.reduce: { "$^b\[$^a]?"}; say 'apple' ~~ /<$re>/ 21:52
camelia rakudo-moar ebcc33: OUTPUT«「apple」␤»
harmil_wk Ha! Nice 21:53
I think I've actually done that in Perl 5... years ago.
moritz if you think in terms of automatons, <*...> is very easy: every state is an accepting state. Over.
avar I get the uncanny feeling with some p6 stuff that I'm really the first person ever to use some trivial feature: github.com/rakudo/star/issues/78 :( 21:54
harmil_wk It's sort of the regex equivalent of a try block. "whatever gets done is great". 21:55
timotimo avar: the star makefile and stuff is basically a big pile of crap :) 22:09
harmil_wk m: say "abc" ~~ /^<{?True}>/ 22:16
camelia rakudo-moar ebcc33: OUTPUT«Nil␤»
harmil_wk Shouldn't that match?
timotimo you put the ? after the { 22:30
it should go before the {
right now you're trying to match "abc" against / "True" / 22:31
harmil_wk Ah, thanks
harmil_wk m: $_ = "app"; my $prefix = "ap"; my $full = "applesauce"; say $_ ~~ /^ <before $prefix> (.*) $ <?{$full.starts-with(~$0)}>/ 22:32
camelia rakudo-moar 40429f: OUTPUT«「app」␤ before => 「」␤ 0 => 「app」␤»
harmil_wk At least that's only one regex, and doesn't require building it on the fly. 22:33
timotimo right, interpolating code into regex is extremely costly 22:38
naptastic How does Perl 6 represent strings? I've learned about the complexities of unicode, but not how to handle them, and everything I've heard is that Perl 6 is really the only language that gets it right natively, and that it does so in a smart way. 23:13
Where can I read more? :)
timotimo we have something called "NFG" 23:15
where we pretend the unicode consortium has assigned combined codepoints for every combination you can come up with
we call these "synthetic codepoints" and we build them whenever they are needed
the user never gets to see them
but you get O(1) access from "index of grapheme" to "the grapheme in the string" 23:16
which you don't when you have anything else
naptastic How big are synthetic codepoints? 23:17
And what happens if I create a character with a large number of combining diacritics? 23:18
timotimo then you get just one grapheme 23:20
we store graphemes as 32bit signed integers, we use the negative values for synthetics
naptastic I'm ok with that. But how does Perl 6 keep from running out of synthetic code points? 23:21
timotimo you'll have to have a very long-running program with an attacker to exhaust it 23:22
in the future we'll have a stage in the GC that can free up synthetics 23:23
naptastic I would have to create more than 2^31 unique graphemes.
And a string to contain them. Ok, attacking that is not practical. I approve of your approach. :)
timotimo for now i'd just say restart your moarvm instance when it gets problematic
seatek hehe
timotimo like, regularly restart it
the cleanup thing will be implemented, but it is not yet a priority 23:24
rodrigok hello there 23:25
novice here, trying to understand a simple thing about p6 class "static fileds" 23:26
like described in here docs.perl6.org/language/classtut#Static_fields?
timotimo that piece of description is ... hardly helpful 23:27
rodrigok the last paragrah of that title, states "Class attributes may also be declared with a secondary sigil" 23:28
timotimo the rest of the docs call that "twigil"
rodrigok yes
but the thing is
I can not use the static field 23:29
inside the class
when I put a twigil in it
timotimo can you show a short piece of code that shows the problem?
rodrigok I can show an example
timotimo cool 23:30
i'm distracted by being knee-deep in C code :)
rodrigok class Test1 { has $x = 1; has $.y = $x; }
class Test6 { my $x = 6; has $.y = $x; }
in the Test1, I can write "has $.x" 23:31
and make $y = $.x
In the second example, I cant
I know the '$.x' is really using an acessor 23:32
I could also use $!x
timotimo with "my $.x" it shouldn't be possible to do $!x
rodrigok yes
what about "my $.x; has $y= <the value of x>?" 23:33
the dot also does not seems to work 23:34
timotimo it could just be that the docs are wrong :S 23:35
rodrigok It gives a compiler error 23:36
"Virtual method call $.x may not be used on partially constructed object (maybe you mean $!x for direct attribute access here?)"
gfldex m: class Test6 { my $x = 6; has $.y = $x; } 23:37
camelia ( no output )
rodrigok that works 23:38
gfldex m: class Test6 { my $x = 6; has $.y = $x; }; say Test6.new.y;
camelia rakudo-moar 88cb05: OUTPUT«6␤»
rodrigok If I put a twigil in $.x
I can even create a Test6 object
and call the 'x' method
but not from _inside_ the class, it seems 23:39
class Test6 { my $.x = 6; has $.y = 7; }
my $t6 = Test6.new();
say $t6.x;
(sorry, I don't know how to use the bot)
skids m: class Test6 { has $.x = 6; has $.y = $!x; }; say Test6.new.y;
camelia rakudo-moar 88cb05: OUTPUT«6␤»
gfldex prefix code with "m:" 23:40
prefix code with "m: " actually
rodrigok thanks
skids Initializers happen before the object is complete, so you have to use direct attribute access.
rodrigok ok, but, I was trying it in a _class_ attribute 23:41
called "static filed" in that link
m: class Test6 { my $.x = 6; has $.y = $!x; }; say Test6.new.y;
camelia rakudo-moar 88cb05: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Attribute $!x not declared in class Test6␤at <tmp>:1␤------> 3ass Test6 { my $.x = 6; has $.y = $!x; }7⏏5; say Test6.new.y;␤ expecting any of:␤ horizontal whitespace␤»
rodrigok I replaced the "has $.x" by "my $.x" 23:42
skids Ah. Yeah, I would guess that should probably be made to work.
Not that but...
m: class Test6 { my $.x = 6; has $.y = $.x; }; say Test6.new.y; # this 23:43
camelia rakudo-moar 88cb05: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Virtual method call $.x may not be used on partially constructed object (maybe you mean $!x for direct attribute access here?)␤at <tmp>:1␤------> 3class Test6 { my $.x = 6; has $.y = $.x7⏏5; }; say …»
rodrigok I understand that the "!" would not work
and the "." will try to access a method before the object is ready
which is not allowed, ok 23:44
timotimo you can try to Type.x instead
rodrigok I could not figure out what syntax I should use
whats that?
skids of course you can workaroud with:
m: class Test6 { my $.x = 6; has $.y = self.x; }; say Test6.new.y; 23:45
camelia rakudo-moar 88cb05: OUTPUT«6␤»
rodrigok ohh, I tried that
skids self would be the type object.
rodrigok I sear!! haha
seatek ++skids for self -- that's what i always do
rodrigok let me see here
skids or wait... 23:45
rodrigok (you may have noted, I have examples from 1 to 7)
skids m: class Test6 { my $.x = 6; has $.y = self.say; }; 23:46
camelia ( no output )
skids m: class Test6 { my $.x = 6; has $.y = self.say; }; Test6.new;
camelia rakudo-moar 88cb05: OUTPUT«Test6.new(y => Any)␤»
skids I guess self is somehow not just the type object.
seatek timotimo: are the doc links made always by L<JSON::Tiny module|URL> ? 23:47
timotimo i have no idea
rodrigok I had not tried the "self" for the static attributes
seatek k
timotimo i haven't written docs in ages *cough cough* 23:48
seatek but you were doing something with the links in them just last night! so i thought you'd be the guy to ask about links in docs. ;) 23:49
naptastic (Assuming a host with infinite memory) How many objects can I create in Perl 6?
rodrigok well, I dont understand very well what you said about the self and tpye object
rodrigok but that example worked, so, thanks 23:50
timotimo seatek: no, exclusively links shared to the irc by dalek
seatek aha! :) 23:50
mscha m: (1,2 * * + 1 ...^ * > 2**100).grep: *.is-prime; 23:51
camelia ( no output )
mscha m: (1,2 * * + 1 ...^ * > 2**100).grep(*.is-prime)».say; 23:51
camelia rakudo-moar 88cb05: OUTPUT«3␤7␤31␤127␤8191␤131071␤524287␤2147483647␤2305843009213693951␤618970019642690137449562111␤»
mscha Perl6 slow? I don't think so...
m: (1,2 * * + 1 ...^ * > 2**10000).grep(*.is-prime)».say; 23:53
camelia rakudo-moar 88cb05: OUTPUT«(timeout)3␤7␤31␤127␤8191␤131071␤524287␤2147483647␤2305843009213693951␤618970019642690137449562111␤162259276829213363391578010288127␤170141183460469231731687303715884105727␤686479766013060971498190079908139321726943530014330540939446…»
seatek i dont' suppose there is any HTML -> pod6 converter yet 23:56
skids HTML *to* pod6? 23:57
seatek yes, i wrote up my long-winded doc in and html editor. now i need it to be in pod6
i'm going through line by line right now by hand, dreaming of icecream 23:58