»ö« 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.
00:08 khw left 00:19 tphilipp joined 00:24 tphilipp left 00:33 spider-mario left 00:50 tphilipp joined 00:52 telex left 00:58 cpage_ joined 01:08 telex joined 01:26 kurahaupo left 01:32 cdg joined 01:38 molaf left 01:42 kurahaupo joined 01:47 _nadim left
AlexDaniel we have s/a/b/ and S/a/b/, but what is the S-like equivalent for tr/a/b/ ? 01:48
m: $_ = ‘abc’; TR/a/X/ 01:49
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/fBdlU7XUZ9␤Missing required term after infix␤at /tmp/fBdlU7XUZ9:1␤------> 3$_ = ‘abc’; TR/a/X/7⏏5<EOL>␤ expecting any of:␤ prefix␤ term␤»
AlexDaniel Hotkeys: I've figured that it is possible to make S/‘ ’/_/ shorter if we had TR 01:50
Hotkeys ik
01:50 _nadim joined
Hotkeys I tried it when you first mentioned it 01:51
01:51 molaf joined
AlexDaniel Hotkeys: then where's your bug report? :) 01:51
Hotkeys I didn't realize it was a bug
AlexDaniel well, not a bug, but in my opinion it is a sad inconsistency
01:53 _nadim left 02:05 aindilis joined
AlexDaniel m: my $x := (my $y := $x); say $x.WHAT # let's see if it is still an issue… 02:06
camelia rakudo-moar b3b24b: OUTPUT«(signal SEGV)»
02:08 kurahaupo left
AlexDaniel haha, due to mass renaming of tickets in RT the main page is now full of SEGVs :D 02:10
02:13 aindilis left 02:14 kurahaupo joined 02:16 aindilis joined 02:18 tphilipp left
Xliff Hello. 02:18
My class definition starts with the following: 02:19
class XQC_Implementation_s is repr('CStruct') is export
02:19 kurahaupo left
Xliff Why is there no self reference in this class? 02:19
m: class A { method b { say self; } }; $a = A.new.b() 02:20
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/GrjwczkEhQ␤Variable '$a' is not declared␤at /tmp/GrjwczkEhQ:1␤------> 3class A { method b { say self; } }; 7⏏5$a = A.new.b()␤»
Xliff m: class A { method b { say self; } }; my $a = A.new.b()
camelia rakudo-moar b3b24b: OUTPUT«A.new␤»
02:24 _nadim joined 02:27 _nadim left 02:33 sortiz joined
sortiz \o #perl6 02:34
Xliff Sortiz.... how do you specify destructor for class that has access to self? 02:35
method DESTROY {}
?
sortiz, (Oh, and good evening... sorry...focused)
sortiz Use 'submethod DESTROY() { ... }' 02:36
Xliff Thanks. Will "say" produce any output if used within that method?
sortiz Yes, but don't expect that destruction happen in an deterministic time! 02:37
Xliff Ah. So expecting it to happen in -e one-liner is probably too much to hope for? 02:38
02:38 raoulvdberge left
sortiz Yep. 02:38
Xliff kk. Thanks.
sortiz I see you are working with native bindings, so I suggest you implement some kind of .dispose methods when need explicit deallocation, for example. 02:40
02:40 Herby_ joined
Herby_ Evening, everyone! 02:41
sortiz \o Herby_
Herby_ o/
02:42 noganex_ joined
nchambers o 02:42
o/
Herby_ \o/
nchambers whats everyone up to tonight? 02:43
Herby_ trying to find an interesting project to tackle with perl 6 02:44
coming up empty so far
yourself?
02:45 noganex left
sortiz Converting Oracle::Native to OO :) 02:45
BenGoldberg Herby_, how about this: create a perl6 irc plugin for </insert favorite irc client here> ! ;) 02:46
Hotkeys yes please do one for weechat and hexchat 02:47
Herby_ hmm. can't say i know much about that business. you know of a good starting point?
BenGoldberg Well, what's your irc client? 02:48
BenGoldberg is a hexchat user.
sortiz hexchat too 02:49
nchambers Herby_, installing an ubuntu server, considering downloading the new a-team movie (well "new"), thinking of some more things I could write in perl
Herby_ webchat.freenode.net :(
nchambers lame
02:49 skids joined
nchambers at least use kiwiirc 02:49
Herby_ BenGoldberg: reading up on the hexchat plugin interface now 02:50
BenGoldberg Hexchat has a decently documented C API for plugins; the python plugin and perl(5) plugins make use of the C API 02:51
Herby_ i'm a rookie that hasn't dealt too much with APIs or plugins... this seem pretty doable with perl 6?
BenGoldberg How's your C skills? 02:52
Herby_ I can spell it
i've dabbled some :)
BenGoldberg Basically, to create a perl6 plugin for hexchat, you would have to create a .dll file, which has a function named hexchat_plugin_init, which will get called by hexchat after it loads the .dll file. This entry point does all the heavy lifting, e.g., loading the perl6 interpreter. 02:55
02:55 nadim joined
Xliff \o Herby 02:57
Herby_ Xliff!
BenGoldberg Each real plugin (perl, python, whatever) can create "fake" plugins, usually one for each script. These fake plugins show up on the plugin list, and you can click on them, and unload/reload. 02:58
Herby_ BenGoldberg: sounds interesting/challenging. I'll see what I can dig up
02:58 telex left
Xliff Ouch. 02:59
OK. I have a NativeCall implementation that passes back a C struct with callback pointers.
02:59 nadim left
Xliff How can I execute the callbacks? 02:59
03:00 telex joined
Xliff I'm getting the following error when I try to use the callbacks as a method call 03:01
» Too many positionals passed; expected 1 argument but got 5
sortiz Xliff, If you have a pointer to a C func, you need to attach to it a signature first. 03:03
Xliff OK
sortiz See github.com/rakudo/rakudo/blob/nom/...pointers.t for an example.
Xliff Thanks much! 03:04
sortiz For attach the signature you need 'nativecast'
yw 03:05
Xliff Hrm. Where are actual docs on nativecast()? 03:07
Skarsnik there is none ^^ 03:08
Xliff Yikes!
03:09 Skarsnik left, rindolf left
Xliff So...if I understand this right.... 03:16
sortiz Add more NC docs is a task that I have queued.
Xliff my $func_ptr_w_sig = nativecast(:(type, type[, ...type] --> return_type, $func_ptr) 03:17
Or...
my $func_ptr_w_sig = nativecast(:(type, type[, ...type] --> return_type), $func_ptr)
sortiz Yep.
Xliff ok.
Yow... that makes this a little... harder....LOL! 03:18
sortiz Better: my &func_ptr_w_sig = nativecast(:(type, type[, ...type] --> return_type), $func_ptr); # See the '&' sigil.
Xliff OK. So no clean way to do it without defining methods and making the call. 03:19
So. 03:20
teatime you gotta know the arguments to call a function, if all you have is its address :)
sortiz Can't be a way for NC to infer that, you only have a pointer.
Xliff m: class A { has Pointer $!meth1; method meth1(Int) { say "Hi!" } }; say A.new.meth1(1)
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5===␤Type 'Pointer' is not declared␤at /tmp/DY3lcLzr37:1␤------> 3class A { has Pointer7⏏5 $!meth1; method meth1(Int) { say "Hi!" ␤Malformed has␤at /tmp/DY3lcLzr37:1␤------> 3class A { has7⏏5 Pointer $!meth1; method met…»
03:21 kaare_ joined
Xliff m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" } }; say A.new.meth1(1) 03:21
camelia rakudo-moar b3b24b: OUTPUT«Hi!␤True␤»
Xliff Oh, good!
m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" } method meth2 { $!meth1 = "A" x 3; say $!meth1 } }; say A.new.meth1(1) 03:22
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/SjW79owpFO␤Strange text after block (missing semicolon or comma?)␤at /tmp/SjW79owpFO:1␤------> 3$!meth1; method meth1(Int) { say "Hi!" }7⏏5 method meth2 { $!meth1 = "A" x 3; say $␤ expecting an…»
Xliff m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" } method meth2 { $!meth1 = "A" x 3; say $!meth1; } }; say A.new.meth1(1)
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Ad4XmTpSnl␤Strange text after block (missing semicolon or comma?)␤at /tmp/Ad4XmTpSnl:1␤------> 3$!meth1; method meth1(Int) { say "Hi!" }7⏏5 method meth2 { $!meth1 = "A" x 3; say $␤ expecting an…»
Xliff m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" }; method meth2 { $!meth1 = "A" x 3; say $!meth1; } }; say A.new.meth1(1);
camelia rakudo-moar b3b24b: OUTPUT«Hi!␤True␤»
Xliff m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" }; method meth2 { $!meth1 = "A" x 3; say $!meth1; } }; my $a = A.new; $a.meth1(1) $a.meth2(); 03:23
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/1KBi5hFj32␤Two terms in a row␤at /tmp/1KBi5hFj32:1␤------> 3$!meth1; } }; my $a = A.new; $a.meth1(1)7⏏5 $a.meth2();␤ expecting any of:␤ infix␤ infix stopper␤ statemen…»
Xliff m: class A { has Str $!meth1; method meth1(Int) { say "Hi!" }; method meth2 { $!meth1 = "A" x 3; say $!meth1; } }; my $a = A.new; $a.meth1(1); $a.meth2();
camelia rakudo-moar b3b24b: OUTPUT«Hi!␤AAA␤»
03:28 AlexDaniel left
Xliff OK. So if a function is expecting a pointer to a struct (or class), can I just pass that class instance? 03:32
my $i = ClassName.new; func_expects_class_ptr($i); <- ??? 03:33
03:46 nadim joined 03:48 nadim left
diakopter maybe of interest - KestrelInstitute open-sourced Specware (language name MetaSlang) on github 03:54
www.specware.org/documentation/4.2/...Manual.pdf 03:56
03:56 kid511 left 03:58 Ben_Goldberg joined 03:59 BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 04:02 Vlavv_ left 04:03 labster left 04:14 geekosaur left, geekosaur joined 04:15 Vlavv_ joined 04:17 _nadim joined 04:18 _nadim left 04:25 nadim joined
Xliff Does anyone know if NativeCall can handle C's FILE* ? 04:25
And how that could be passed to a NativeCall routine?
teatime if you already have the FILE* returned from something else native, then you can pass to something native like any other pointer. 04:27
04:28 Sgeo__ left 04:29 Sgeo joined 04:30 cdg left 04:31 nadim left
teatime you can get a FILE* from a Perl IO::Handle by passing .native-descriptor to native fdopen()... and you can get a file descriptor from a FILE* with fileno(), but I don't know how to turn that into a Perl IO object. I would be interested to know if there's anything in NativeCall to help w/ any of that, don't remember seeing anything. 04:33
04:35 labster joined
BenGoldberg Well, one thing you can do is write: class FILE is repr('CPointer') { }, to make C FILE* pointers easier to deal with... 04:37
teatime I've seen that example before; how does it help over just using OpaquePointer or Pointer ? 04:38
just that you can call it FILE fp in your code?
skids Maybe because you can add methods? 04:39
teatime ah, that makes sense. 04:40
but you cannot add attributes, or did I mis-understand that?
04:41 Cabanossi left
skids Right, no attributes because the REPR does not support it. 04:41
teatime and methods don't count as a kind of attribute?
04:42 nadim joined
teatime I guess when I read no attributes I assumed that meant no methods either. 04:42
skids Basically things that are stored per-class instead of per-instance are allowed.
methods are per-class. 04:43
04:43 Cabanossi joined
teatime perfect, thanks. 04:43
BenGoldberg For that matter, you can put such things as 'my sub feof(FILE) returns int is native { ... }' inside of the 'class FILE { ... }' definition, where they won't be externally visibile.
In this case, it's a silly way to do it, since the stdio interface won't ever change, but for some other library, you might want to 'hide' the C API, and present only perlish methods. 04:45
So if the underlying C library changes it's API in the future, there will be less risk that someone using your code will be relying on those private functions. 04:46
04:48 nadim left
teatime if you did need to track more state on the perl side, your class could also be a normal class w/ an attribute that's a pointer, right? 04:48
BenGoldberg If you wanted to, sure. 04:49
skids Sure, and you could have both -- the CPointer-based class as an attribute.
04:51 _nadim joined 04:54 _nadim left 04:56 Ben_Goldberg joined, _nadim joined 04:58 BenGoldberg left, Ben_Goldberg is now known as BenGoldberg
Xliff <teatime> you can get a FILE* from a Perl IO::Handle by passing .native-descriptor to native fdopen() 04:59
Wow... OK.
Working with NativeCall is more .... interesting... than I thought.
05:01 _nadim left
Xliff I hope to avoid making a true class, but it's looking like that might not be in the cards. 05:01
Mainly because the C API is a wrapper to C++ classes and methods.
teatime At least, I assume that's true; I haven't tried it.
Xliff So the C API I am trying to wrap is a struct filled with function pointers.
05:01 labster left
Xliff And they use a lot of **X where X is a struct/class for returning data. *sigh* 05:02
MadcapJake Xliff: yeah that sounds complicated
Xliff ErrStruct * = functionCall(arg1, arg2, **X) 05:03
MadcapJake maybe right a C file that has a few helper methods that pull out struct's internal data
Xliff It's fairly nifty for a C implementation, but moving that to Perl6 is showing a few difficulties... especially with my understanding of Perl6.
It's a great learning opportunity, but one that I'm probably not ready for at this moment. 05:04
Soo.... 05:10
sub fdopen(int, char)
is nativelib('libc')
returns Pointer { * };
teatime heh, it appears you're testing my theory :) 05:11
Xliff Yeah. 05:12
05:12 nadim joined
Xliff I'll let you know if it blows up in my face. It's a good idea, though. 05:12
Oh.
my $a = "/path/to/file"; die "BZZZT!" unless $a.IO.e; <-- this is valid, right? 05:13
m: my $a = "/path/to/file"; die "BZZZT!" unless $a.IO.e;
camelia rakudo-moar b3b24b: OUTPUT«BZZZT!␤ in block <unit> at /tmp/S7_wiTRnjw line 1␤␤»
Xliff HAH! At least it compiles.
I hope the evalbot is protected against IO hacks like that.
teatime works here.
Xliff Thanks. 05:14
teatime m: say my $a = "/etc/passwd"; die "BZZZT!" unless $a.IO.e;
camelia rakudo-moar b3b24b: OUTPUT«/etc/passwd␤»
teatime m: say my $a = "/etc/NotAFile"; die "BZZZT!" unless $a.IO.e; 05:15
camelia rakudo-moar b3b24b: OUTPUT«/etc/NotAFile␤BZZZT!␤ in block <unit> at /tmp/Bhjooy6SKc line 1␤␤»
05:16 nadim left
Xliff Ahh crap. Would I need native free() to handle the FILE* once I'm done with it? 05:18
05:18 nadim joined 05:19 nadim left 05:20 Herby_ left
teatime hrm, that's a good question... normally no, you'd fclose() it... but that would also close() the fd Perl knows about, not sure if that would break stuff? 05:23
05:24 nadim joined
teatime and not fclose()'ing would be a mem leak, I beleive. 05:24
awwaiid To read a single line from stdin, should I do $*IN.lines(1).first ? 05:27
05:29 nadim left
awwaiid oh, 'get' 05:29
05:44 nadim joined 05:49 nadim left
Xliff my $f = open "API.pm",:r; <-- Is this the right way to open a file in perl6? I am getting "error at :" when I try. 05:51
05:56 buharin joined
Xliff Oh crap. Using "perl" instead of "perl6" again. 05:56
Definite sign of sleep deficiency. 05:57
saaki :) 06:03
Xliff It's either that or NativeCall is eating my brain! 06:05
Probably both.
06:08 CIAvash joined
sortiz Xliff, yep Start learning NC produces these symptoms at first :-) 06:08
06:14 Khisanth left 06:17 rindolf joined 06:20 BenGoldberg left
awwaiid Xliff: some slight sugar, I think you can do: my $f = open "API.pm" :r; # space instead of comma. Also :r is the default. I think you can also do: my $f = "API.pm".IO 06:21
Xliff awwaiid, thanks! 06:23
OK. How can I specify Unsigned Integer in NativeCall where I do not have to worry about word size of the processor?
Will "Int" work regardless of 32-bit or 64-bit processor?
teatime I imagine Int would map to a signed int? 06:25
if you want a specific size you need to use the uint64_t -style types. 06:26
Xliff That's the problem. I don't want to map to a specific size. I want to use a single type and let rakudo and the c-lib duke it out as to what should be used. 06:27
teatime well, at least, in C. Probably not in Perl, since Perl's definitions can't depend on the specific compiler used, which is what would really determin the size of 'unsigned int'?
Xliff Shit.
Because I can't assume that "unsigned int" is uint64 on a 32 bit lib, right?
teatime what is it for?
06:28 skids left
teatime there's size_t, garunteed to hold the maximum array index, but that also only seems to me to have meaning for a specific compiler, not for an architecture/word-size. 06:28
06:28 BenGoldberg joined
Xliff read(void *, unsigned int) <- I need to convert that to something suitable to nativecall() 06:28
06:29 Khisanth joined
Xliff nativecall(:(Pointer, uint32)....) would be dangerous on a 64 bit machine. 06:29
See my problem?
06:29 _nadim joined
teatime ssize_t read(int fd, void *buf, size_t count); 06:29
Xliff Not quite libc's read. 06:30
teatime yeah sorry copied wrong one, sec
Xliff It's XQilla's XQC_Input_Stream's method but I am trying to simplify so as to not confuse ppl.
teatime I see. 06:31
Xliff However, if you really want the confusion....
xqilla.sourceforge.net/docs/xqc-api...aa5a0e0c66 06:32
sortiz Right now NC don't do that magic, your code should test for that.
Xliff sortiz: OK. How can I test for word size in P6?
sortiz You can use, nativesizeof(Pointer) for example.
06:32 Ben_Goldberg joined
teatime I don't think that's the question you need to ask. 06:32
Xliff (was worried about that) 06:33
sortiz m: use NativeCall; say nativesizeof(Pointer);
camelia rakudo-moar b3b24b: OUTPUT«8␤»
Xliff m: use NativeCall; say nativesizeof(Int) 06:34
camelia rakudo-moar b3b24b: OUTPUT«NativeCall op sizeof expected type with CPointer, CStruct, CArray, P6int or P6num representation, but got a P6opaque␤ in sub nativesizeof at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 399…»
Xliff m: use NativeCall; say nativesizeof(P6Int)
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Q4HeewSnmz␤Undeclared name:␤ P6Int used at line 1␤␤»
06:34 _nadim left
Xliff m: use NativeCall; say nativesizeof(P6int) 06:34
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/J2foV6liHB␤Undeclared name:␤ P6int used at line 1␤␤»
Xliff m: use NativeCall; say nativesizeof(CPointer)
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/KDaBaU1Gyc␤Undeclared name:␤ CPointer used at line 1. Did you mean 'Pointer'?␤␤»
06:35 BenGoldberg left
Xliff m: use NativeCall; say nativesizeof(int) 06:35
camelia rakudo-moar b3b24b: OUTPUT«8␤»
sortiz And you can only use nativesizeof with native types.
teatime Xliff: unsigned int must be 2 bytes, so I think the right answer might be use an int type ≥ 2 bytes and never pass a value larger than 2^16-1 ?
06:35 BenGoldberg joined
Xliff teatime: Short answer-"Use uint32" 06:36
06:36 djbkd joined
teatime sortiz: how does it work if 2 compilers that use different values for sizeof(int) compile 2 libs you want to use; I assume you have to know sizes to use an ABI, and I assume most .h's specify specific sizes for their public ABIs, but it seems like a lot of stuff expects you to be writing C and using their .h so a type like 'int' works fine even if it compiles as different sizes on different platforms... 06:37
06:38 Ben_Goldberg left
teatime I realize that's a rambling and open-ended question, but what would I look up to learn more about these issues? 06:38
Xliff: rather, must be *at least* 2 bytes. 06:39
BenGoldberg Are you cross compileing?
Xliff BenGoldberg, no. 06:40
NativeCall module
teatime: Well, I will start with uint32 and then test it on a 64-bit machine and see if it breaks. 06:41
BenGoldberg If two compilers on the same machine have different sizes of int, then you will not be able to reliably use int for parameters of a function in a .dll
teatime BenGoldberg: I'm just trying to figure out how to get from the C world where I am OK with knowing "I'm using the same type both places and I know it's at least n bytes" to the Perl world where I need to actually know the exact size of the type.
Xliff That's the safest route I see.
teatime yeah, I was just thinking, what I need to read more about probably is shared libraries.
sortiz Yep, is a difficult question. I recommend to look the code of some projects to see some working solutions.
BenGoldberg Even in the C world, "int" is only the same both places if the compilers are configured the same. 06:42
teatime yes.
Xliff sortiz, Yeah. However I don't have time to search *all* of the projects for useful answers.
I'm lazy that way.
I'd need more detailed directions! =) 06:43
However, I think I have progressed far enough, today.
Much in part due to the help I have found here.
Thank you!
sortiz Te best advice I can give you is to use the *.h file and define and use compatible types. For example see github.com/perl6/DBIish/blob/maste...ve.pm6#L11 06:44
Xliff Now to poke at King's Road for a few minutes.
06:44 labster joined
BenGoldberg One way to deal with the problem is to compile a tiny C program which does nothing more than output sizeof(int) and exit. 06:44
BenGoldberg just realized it's waaay past his bedtime, g'night folks. 06:45
06:45 BenGoldberg left
Xliff It's not that I don't know sizeof(int). It's not a question of that. It's a question of where this code will eventually run. 06:45
Well....LOL.
stmuk_ ugexe: ok thanks 06:46
06:47 cpage__ joined 06:48 cpage_ left, cpage__ is now known as cpage_ 06:52 rindolf left 06:55 kurahaupo joined 06:57 djbkd_ joined 06:58 djbkd left, djbkd_ is now known as djbkd
djbkd 3 06:59
07:00 djbkd left 07:13 djbkd_ joined, buharin left 07:27 djbkd_ left, RabidGravy joined 07:34 firstdayonthejob joined 07:38 wamba joined 07:47 domidumont joined 07:51 domidumont left 07:52 domidumont joined 08:14 darutoko joined
RabidGravy Boom 08:25
yoleaux 2 Apr 2016 23:21Z <AlexDaniel> RabidGravy: just in case: if some website is not accepting your [email@hidden.address] email, then use my.n....a...me@gmail.com, because 100% websites accept dots in emails and gmail ignores them all.
teatime I thought the gmail addr w/o dots was unique from the addr w/ one or more dots 08:27
but all of the one-or-more dots addrs were equiv
08:27 Actualeyes joined 08:33 pecastro joined 08:34 keix joined 08:43 Actualeyes left
RabidGravy no, I think in the case of gmail the reverse is true 08:43
08:44 pecastro left
RabidGravy at least it was 08:45
AlexDaniel, I have a simpler solution. If some website doesn't accept a perfectly compliant e-mail address then I don't use it as it is fairly good indication the programmers don't know what they are doing 08:47
.seen supernovus 08:50
yoleaux I saw supernovus 28 Dec 2015 18:21Z in #perl6: <supernovus> At some point I should look at rakudobrew to replace my moon script that I've been using for the last 4 years.
08:51 pecastro joined
RabidGravy going to have a tinker with Template6 later, looks like he is merging PRs at any rate 08:53
08:55 _nadim joined, _nadim left, _nadim joined 09:12 domidumont left 09:17 geekosaur left 09:18 buharin joined 09:19 geekosaur joined 09:20 frithnanth joined 09:23 buharin left 09:24 buharin joined 09:25 Actualeyes joined 09:27 buharin left, wamba left
dalek ar: 377eb1f | (Naoum Hankache)++ | README:
fix typo
09:28
ar: 4a0028d | (Steve Mynott)++ | README:
Merge pull request #67 from hankache/patch-1

fix typo
09:29 buharin joined, spider-mario joined 09:30 buharin_ joined 09:31 wamba joined, buharin left, buharin_ left 09:39 pecastro left, Khisanth left 09:43 cyberviking joined, cyberviking left 09:44 buharin joined 09:48 cyberviking joined, cyberviking left 09:50 pecastro joined 09:51 TimToady joined 09:53 CIAvash left, TreyHarris left 09:55 Khisanth joined 09:58 TreyHarris joined 09:59 TEttinger left 10:01 frithnanth left 10:03 Khisanth left, Actualeyes left 10:04 Actualeyes joined 10:08 buharin left 10:13 buharin joined
_nadim Good morning. Here is something that I find very surprising when using roles and multis nopaste.linux-dev.org/?1041278 10:13
10:14 pecastro left
_nadim I can see why I would get that error message but it feels a bit wrong because it doesn't let one use roles to compose behavior based on the arguments passed to methods (IMHO) 10:14
what's even more surprising is that I ave another example where the error message is not displayed at all 10:16
And it doesn't do what I xpect it to either (but that is more open to debate) 10:17
10:21 pecastro joined
sortiz m: say Array ~~ List; # At first remember that Array is List. 10:21
camelia rakudo-moar b3b24b: OUTPUT«True␤»
_nadim I certainly do
I expected the role that matches the most closely the argument to have its method called 10:22
sortiz So, when the multi in B matches both cases.
_nadim but apart from that expectation, I have another example, larger unfortunately, where the error message is not displayed 10:23
and where method that matches is the one that is the furthest from the type, it just happens to be te one in the last "done" role.
this also means that multis can not be refined via roles and in that case I wonder what would be used (short of implementing it "manually") 10:29
psch _nadim: a golf of the case where it seems to do the wrong thing would be interesting
_nadim: the paste behaves exactly as i'd expect
...i think 10:30
i'll grab another cup of coffee and get back to you... :)
_nadim psch: As I wrote above, my expectations are open for discussions ;) And Yes it does what it should if you are not expecting the new role to refine existing multis. So it works in the pasted example. 10:33
two problems remain. #1 refining a multi can not be done by a new role, that sucks a bit. Now if there is another way to add a multi to an existing object, I am alll ears. 10:34
#2 the example I have where I believe that it doesn't show the error it should ( according to how you think it should work (and does)), that is difficult to golf but I'll push a branch somewhere with the example in a little moment. 10:35
sortiz _nadim, As you see, the new B role refine the existing List multi, but add an ambiguity regards the Array multi. And that is the problem, thought. 10:36
10:38 buharin left
psch m: class A { multi method m (List $) { "list" } }; A.^add_multi_method("m", my multi method m (Array $) { "array" }); say A.m((1,2)); say A.m([1,2]) 10:38
camelia rakudo-moar b3b24b: OUTPUT«list␤list␤»
timotimo are yo usure you don't have to .^compose or something after adding a multi method like that? 10:39
psch m: class A { multi method m (List $) { "list" } }; A.^add_multi_method("m", my multi method m (Array $) { "array" }); A.^compose; say A.m((1,2)); say A.m([1,2])
camelia rakudo-moar b3b24b: OUTPUT«list␤Ambiguous call to 'm'; these signatures all match:␤:(A $: List $, *%_)␤:(Mu $: Array $, *%_)␤ in block <unit> at /tmp/9hEa0qKRNm line 1␤␤»
psch timotimo++
probably r-j making me used to method cache being borky :) 10:40
timotimo m: class A { multi method m (List $) { "list" } }; A.^add_multi_method("m", my multi method m (Int $a) { "int" }); say A.m(1, 2); say A.m(1);
camelia rakudo-moar b3b24b: OUTPUT«Cannot call m(A: Int, Int); none of these signatures match:␤ (A $: List, *%_)␤ in block <unit> at /tmp/oqKdMe7yx6 line 1␤␤»
timotimo m: class A { multi method m (List $) { "list" } }; A.^add_multi_method("m", my multi method m (Int $a) { "int" }); say A.m((1, 2)); say A.m(1);
camelia rakudo-moar b3b24b: OUTPUT«list␤Cannot call m(A: Int); none of these signatures match:␤ (A $: List, *%_)␤ in block <unit> at /tmp/4D4GJ8wD8k line 1␤␤»
Xliff How would I limit parameter argument to a Str array?
psch Xliff: depends on how much you want your users to suffer
choices are "not at all" and "a little maybe" 10:41
Xliff psch: It's gotta link to a NativeCall.
I think I will have to check manually, then. Thanks.
10:41 labster left
timotimo in that case it'll have to be a CArray anyway 10:41
Xliff Yeah.
psch Xliff: if it's for NativeCall bindings i'd probably expose a wrapper instead of the actual is-native traited sub
timotimo the thing is, if you want to expose a regular perl6 API, you'll have to go through the whole list anyway to push things into a CArray 10:42
Xliff But I don't want the P6 consumer to have to worry about that. They pass a perl array and the nativecall wrapper will create the CArray
timotimo so you can actually do proper checking there
10:42 buharin joined
Xliff Yeah. 10:42
Figured.
It's what I had started doing, then thought "Hey... maybe a better way exists?"
psch m: class A { multi method m (List $) { "list" }; multi method m (Array $) { "array" } }; say A.m((1,2)); say A.m([1,2]) 10:43
camelia rakudo-moar b3b24b: OUTPUT«list␤array␤»
Xliff This is what happens when you stop coding. Take a break playing a frustrating game. Then come back to your even more frustrating code.
psch okay, i think something is weird there
timotimo hah
psch .^add_multi + .^compose don't dispatch the same way as directly declaring both multis
timotimo yeah, you'll end up having composed twice 10:44
psch timotimo: right, but why does adding the multi make it ambiguous?
timotimo maybe there's some caches or something that keeps data around
it could be adding a multi method is about adding a proto rather than just a candidate? not sure.
calling .^compose twice may just be a contract validation 10:45
Xliff m: my $a = [1, 2, 3]; for ($a) { .print } 10:46
camelia rakudo-moar b3b24b: OUTPUT«1 2 3»
Xliff m: my $v = "This"; say $v ~~ Str; 10:48
camelia rakudo-moar b3b24b: OUTPUT«True␤»
dalek ar: 2f64d94 | (Steve Mynott)++ | README.star:
no longer for early adopters
10:56
10:56 rindolf joined
Xliff m: say 2^16 - 1 10:58
camelia rakudo-moar b3b24b: OUTPUT«one(2, 15)␤»
Xliff m: say 2 ** 16 - 1 10:59
camelia rakudo-moar b3b24b: OUTPUT«65535␤»
Xliff *sob*
psch m: say 2¹⁶ - 1 11:00
camelia rakudo-moar b3b24b: OUTPUT«65535␤»
Xliff \o/ 11:01
How did you get superscript!?!??
lizmat .u superscript
yoleaux U+00B2 SUPERSCRIPT TWO [No] (²)
U+00B3 SUPERSCRIPT THREE [No] (³)
U+00B9 SUPERSCRIPT ONE [No] (¹)
Xliff o
2⁴ 11:02
^_^
wincompose++
moritz welcome to the wonderful world of Unicode :-)
_nadim Xliff: if you want to superscribe longer strings, there's a Superscribe role in the Data::Dump::Tree module 11:05
Xliff moritz: Been visiting for a couple of weeks now. Thinking of moving here. :p 11:08
_nadim, I will have to look into that at some point. Thanks! 11:09
m: Say 3.1415962.WHAT
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/h9iJxqUrvj␤Undeclared name:␤ Say used at line 1␤␤»
Xliff m: Say (3.1415962).WHAT
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/P57AOZr4QM␤Undeclared name:␤ Say used at line 1␤␤»
Xliff m: say 3.1415962.WHAT
camelia rakudo-moar b3b24b: OUTPUT«(Rat)␤»
11:10 espadrine joined 11:12 nadim joined 11:15 _nadim left 11:18 cyberviking joined
Xliff m: say 3.14156 is Real 11:25
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/RyLAW3EtIp␤Two terms in a row␤at /tmp/RyLAW3EtIp:1␤------> 3say 3.141567⏏5 is Real␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
Xliff Hrm.
11:26 pierrot left, pierrot joined
sortiz m: say 3.1415 ~~ Real; 11:27
camelia rakudo-moar b3b24b: OUTPUT«True␤»
psch m: use Test; 3.14156 [&isnt] Real
camelia rakudo-moar b3b24b: OUTPUT«ok 1 - ␤»
psch ... :S
Xliff m: say 3.14156 has Real 11:28
camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/5swhiucPk9␤Two terms in a row␤at /tmp/5swhiucPk9:1␤------> 3say 3.141567⏏5 has Real␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
Xliff m: say 3.14156 ~~ Real 11:29
camelia rakudo-moar b3b24b: OUTPUT«True␤»
Xliff Oh good.
psch m: say 3.14156.does(Real)
camelia rakudo-moar b3b24b: OUTPUT«True␤»
sortiz m: say 3.1415 ~~ Num; # Num is float 11:30
camelia rakudo-moar b3b24b: OUTPUT«False␤»
Xliff So is .does() preferred over ~~? 11:33
nadim sortiz: yes it's a bit funny that the method in the second role clashes with a multi of another type in the first role but displays no error message when it redefined a method of the same signature. I'll live with it but I thin it is a surprising behavior, It' would have predered it to be an error in both cases, at least that is consequent. 11:34
Xliff OK. That's one "class" implemented via NativeCall. I have to do one more before I can start any reasonable test cases.
psch nadim: fwiw, i think there is something weird somewhere in MMD
nadim: consider the add_multi_method + compose vs declaring both multis in the class body i showed 11:35
nadim: seeing as composing a role into a class uses .^add_multi_method it seems related 11:36
nadim sortiz: will do, the discussion about that above didn't seem to be ended, is it with compose? twice compose? you said " .^add_multi + .^compose don't dispatch the same way as directly declaring both multis" 11:39
I also wonder if one can add a multi to an object, like does, rather than a class
or even add it to a role that is already played by an object (or more)
psch m: my $x = 42 but role { method foo { "bar" } }; say $x.foo 11:40
camelia rakudo-moar fd29b2: OUTPUT«bar␤»
psch m: my $x = 42 but role { method foo { "bar" } }; say $x.foo; say 42.foo
camelia rakudo-moar fd29b2: OUTPUT«bar␤Method 'foo' not found for invocant of class 'Int'␤ in block <unit> at /tmp/P_J5Tshalg line 1␤␤»
11:40 cyberviking left 11:50 edjsu left 11:51 nadim left 11:52 nadim joined 12:02 pochi joined
dalek Iish: aab9b69 | (Kaare Rasmussen)++ | / (3 files):
Add pg-socket (interface to Pg's PQsocket).
12:02
Iish: 75e53b0 | (Kaare Rasmussen)++ | / (2 files):
Forgot dox

  ... and it probably returns int32.
Iish: 60d9b0f | (Kaare Rasmussen)++ | README.pod:
... and change the README to reflect the new pg-notifies name
Iish: e92bfde | (Salvador Ortiz)++ | / (4 files):
Merge pull request #61 from kaare/master

Add pg-socket (interface to Pg's PQsocket).
12:06 djbkd joined 12:07 zakharyas joined 12:11 cpage__ joined, cpage_ left, cpage__ is now known as cpage_ 12:14 edjsu joined 12:16 BenGoldberg joined 12:17 djbkd left
dalek Iish: 306291e | (Salvador Ortiz)++ | lib/DBDish/Pg (2 files):
Pg: Minor cleanup for speed

Increment driver version reflecting added APIs
12:18
12:24 Ben_Goldberg joined 12:26 edjsu left 12:27 BenGoldberg left, Ben_Goldberg is now known as BenGoldberg, edjsu joined 12:29 hankache joined
dalek c: 23dd053 | (Tom Browder)++ | doc/Language/nativecall.pod:
change example lib name to agree with the explanatory text
12:29
c: 16ff534 | (Tom Browder)++ | doc/Language/nativecall.pod:
Merge pull request #438 from tbrowder/master

change example lib name to agree with the explanatory text
hankache hello #perl6
anyone using Perl 6 on windows? 12:30
m: my $name = 'Neo'; run 'echo', "hello $name";
camelia rakudo-moar 868d8b: OUTPUT«run is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub run at src/RESTRICTED.setting line 14␤ in block <unit> at /tmp/Dm7kGXcIE2 line 1␤␤»
12:30 Khisanth joined
hankache this ^^ runs ok on linux but not on windows 12:31
any ideas why?
timotimo is echo actually a program on windows? 12:32
hankache isn't it the same as linux? 12:33
timotimo i haven't a clue 12:34
hankache me neither :D
12:36 cyberviking joined, cyberviking left
masak I think `echo` is an internal command in Windows 12:36
not an executable
but I would still kind of expect it to work 12:37
timotimo m: say shell "echo", "hello you" 12:38
camelia rakudo-moar 868d8b: OUTPUT«shell is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub shell at src/RESTRICTED.setting line 15␤ in block <unit> at /tmp/QJ3sbVzKA8 line 1␤␤»
timotimo you probably have to use shell instead
hankache shell will not interpolate the variable 12:47
masak I'm back toying with Heroku. I got it to connect to the Postgres database -- yay! 12:49
timotimo of course not, that's why you used " and not '
masak what's a well-established way to have one's application connect to the database with the right url/port/user/pwd, *without* putting all those details into source control? 12:50
especially relevant with Heroku, I guess, since deployment happens via pushes...
timotimo have it in your environment? :P
hankache :)
teatime on linux, standard shell built-ins usually have executable fallbacks in $PATH
not so much on windows, I think. 12:51
on *nix, rather.
sortiz masak, PostgreSQL in particular accepts all connection parameters via environment vars. Can be what you need. 12:52
hankache aha
12:53 cpage_ left, cpage__ joined 12:55 kid51 joined
timotimo FWIW, "texas unicode" is still much better than trigraphs ... 12:56
12:59 Yary joined
Yary I'm building Rakudo (on x86 windows, using Strawberry Perl's toolchain...) getting a failure building Moar- what directory/Makefile controls the "gen-moar" sub-build? 13:00
masak sortiz: thank you. yes, I just found the same after some searching. 13:01
Yary (I did this build OK in Sep, with the only issue being with dyncall... this time I need to write down what I'm doing to help with the next time...) 13:03
timotimo Yary: i think it's nqp/MoarVM/ 13:07
in there, there's a Configure.pl of its own, just like in nqp/
Yary OK thanks. Failing during the Configure step (at the top level), so will try Configure.pl in there (I see it) and fix it 13:08
just didn't want to clone Moar a 3rd time!!
timotimo moar is - i think - the smallest of the three repositories :)
Yary I'm at a 5k while my wife runs a 5k, and using cellphone net 13:09
sorry I';m at a cafe
timotimo oh, that's problematic, then 13:10
Yary yeah. I got the build started at home where the web is fast and free
13:12 zakharyas left
timotimo i run a public access point in my home with sensible throughput limits 13:12
part of the "freifunk" projectin germany
13:16 Khisanth left 13:18 wtw left 13:21 pecastro left 13:23 Yary_ joined, pecastro joined 13:24 Yary left, Yary_ is now known as Yary
Yary /msg NickServ identify unsecure 13:26
psch ...autopun? :)
masak self-referential, yes. not sure about autopun. 13:29
it's hard to tell sometimes.
if it ends up in the next p6weekly, maybe then it's an autopun. or if the password was "hopenobodyeverseesmypassword" and it ended up there...
13:31 Khisanth joined
masak or if the password was "oops-i-did-it-again" 13:38
Yary everyone can be me
masak Yary is more of a concept than an actual individual 13:39
a way of life
timotimo a state of mind
masak a port of call
timotimo like ships meeting in the middle of the ocean 13:40
13:40 cdg joined
BenGoldberg Is the middle of the ocean really the best place for ships to be meeting? 13:43
. o O (The Greay Pacific garbage patch)
timotimo clearly i'm refering only to the surface between the ocean and the atmosphere
"in the middle of the ocean", usually only submarines would meet 13:44
13:47 ZoffixLappy joined 13:49 wtw joined 13:51 Begi joined, hankache left
nadim I tried to ^add_method on an object. that changed nothing. I noticed that It refuses to take a multi method, maybe they are all multi when added through ^add_method. 13:52
then I tried to do a ^compose on the object
psch nadim: .^add_multi_method exists
nadim psch: thnaks doing that right now
13:53 Yary_ joined
nadim and that also eliminated the weird error message I got. 13:54
13:54 Yary left, Yary_ is now known as Yary, BenGoldberg left
nadim Well, both lines ^add_multi_method and ^compose compiled but the output is af nothing was done 13:56
13:56 BenGoldberg joined
nadim I noticed that there was an "is also ..." but that seems t work in the compilation scope only 13:58
psch m: unit class Foo; also is Int; 14:00
camelia ( no output )
psch that's just an alternative to 'class Foo is Int { ... }'
timotimo richpreview.com/?url=http://perl6.org/ - interesting. 14:01
nadim this "oldish" document shows an example where the class can be "re-opened", i just got a re-definition error though. 14:07
timotimo you have to "use MONKEY-TYPING" for that 14:08
nadim is MONKEY-TYPING also necessary for ^add_method and ^compose? 14:09
timotimo no 14:10
but maybe it should be :)
nadim that would be more consistent
but âdd_method and ĉompose did not work for me. Must be doing something wrong
timotimo haha 14:11
i don't think we support grabbing the combining ^ out of the method name :)
m: class Test { method ârgh { say "argh" } }; Test.ârgh()
camelia rakudo-moar 868d8b: OUTPUT«argh␤»
nadim lol, I meant ^compose, ...
14:12 Yary left
ZoffixWin Would someone smarter than me review this commit? I don't think the "lib" prefix is needed, as it's added automatically: github.com/perl6/doc/pull/438 14:12
14:12 average joined
average the writer lock: i.imgur.com/9TNI5zT.jpg ; the reader lock: i.imgur.com/zORWzNw.jpg ; 14:12
does Perl6 have concurrency features in place ?
like locks ^^
timotimo it does, but locks are quite discouraged 14:13
ZoffixWin average, Perl 6 has higher-level features for you to use, like Promises, Supplies, and Channels: docs.perl6.org/language/concurrency
nadim timotimo: can ^add_method and ^composed be used on objects? I know that it does compile but then nothing happens really 14:14
timotimo what do i know. you're not supposed to play with that :)
average ZoffixWin: is there some unanimous decision that promises/supplies/channels are better than classic locks/threads/mutexes/semaphores/barriers/spinlocks ? 14:15
timotimo as in: if you use that stuff, it's on you if things break
nadim timotimo: I'd agree about not playing with it, this stuff responds very weirdly. 14:17
timotimo you're not supposed to add_method and such on an object that's already composed
at least i think that's the case 14:18
the normal workflow is .new_type, .add_method, .compose
average can Perl6 have a distributed job queue implementation ?
like celery or sidekiq ? 14:19
timotimo we have a thread pool, and currently our await implementation for that is thread-blocking; i don't think that's enough for that job 14:20
sounds like something for the ecosystem
nadim If one isn't upposed to play with add_method, then something must be done about roles because as they are they force one te redefine a bunch of methods to avoid error messages. I am not saying that it is not the right thig for roles but that roles are not cutting it in some cases. 14:24
mst nadim: could you explain the case where you're having that problem currently? 14:25
timotimo roles force you to declare what exactly you want to have happen when they get merged into a class or object; it's better than silently doing something, rather than another thing
mst I don't see anything about that above, just about your finding that add_method wasn't helpful
timotimo that's from earlier (today?)
irclog.perlgeek.de/perl6/2016-04-03#i_12278524 14:26
mst yeah, went back a couple hours, just you trying crazy stuff and discovering it had random results
timotimo i didn't actually evaluate that paste, because ... engh. so i don't know what the results were 14:27
i find it a best-practice to include the output you're getting in such a paste, unless you put it on a paste site we support with camelia
in the case of a supported paste site, i find it helpful to directly have camelia evaluate it on-channel
mst nadim: that looks like the wrong thing, what happens if you compose A and B and *then* compose them into a class simultaneously? 14:28
where by 'that' I mean nopaste.linux-dev.org/?1041278
timotimo m: class C {} ; role A {multi method m(List $l) {say 'list'} ; multi method m(Array $a) {say 'array'} } ; role B {multi method m(List $l) {say 'list2'} ; } ; my $c = C.new does A ;
camelia ( no output )
timotimo darn, got a newline in there
m: class C {} ; role A {multi method m(List $l) {say 'list'} ; multi method m(Array $a) {say 'array'} } ; role B {multi method m(List $l) {say 'list2'} ; } ; my $c = C.new does A; $c.m((1, 2)); $c.m([1, 2]); $c does B; $c.m((1, 2)); $c.m([1, 2]); 14:29
camelia rakudo-moar 868d8b: OUTPUT«list␤array␤list2␤Ambiguous call to 'm'; these signatures all match:␤:(C+{A} $: Array $a, *%_)␤:(C+{A}+{B} $: List $l, *%_)␤ in block <unit> at /tmp/J68Oma6WKF line 1␤␤»
nadim can't do, one part is under my control, the other is under the control of the end user. all I can do is document how to do it right.
timotimo hm. i find it a bit surprising that it doesn't complain about list and list2 clashing when you do it like that 14:30
m: class C {} ; role A {multi method m(List $l) {say 'list'} ; multi method m(Array $a) {say 'array'} } ; role B {multi method m(List $l) {say 'list2'} ; } ; class D is C does A does B {}; my $c = D.new does A; $c.m((1, 2)); $c.m([1, 2]); $c does B; $c.m((1, 2)); $c.m([1, 2]);
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/_n2vONUZbY␤Multi method 'm' with signature :(D $: List $l, *%_) must be resolved by class D because it exists in multiple roles (B, A)␤at /tmp/_n2vONUZbY:1␤»
timotimo like that
psch m: role R { multi method m(List $) { ... }; multi method m(Array $) { "array" } }; class C does R { multi method m(List $) { "list" } }; C.m((1,2)).say; C.m([1,2]).say 14:31
timotimo have to be AFK for a bit
camelia rakudo-moar 868d8b: OUTPUT«list␤array␤»
nadim that's the error I talked about earlier
timotimo oh, i know
when you compose the first role into the object, it gets flattened into the object. then, when you add the other one, it's as if the method was already there in the initial class definition
psch m: class A { multi method m(List $) { }; multi method m(List $) { } } 14:32
camelia ( no output )
timotimo roles getting applied to a class are allowed to completely overwrite/override a multi method candidate
m: say List.^mro; say Array.^mro # checking something
camelia rakudo-moar 868d8b: OUTPUT«((List) (Cool) (Any) (Mu))␤((Array) (List) (Cool) (Any) (Mu))␤»
mst nadim: ok, so, that doesn't answer my question
nadim: I am asking that, if you try what I propose, do you then get the behaviour you want? 14:33
nadim: external restrictions on your design that you haven't mentioned before are separate, since you hadn't mentioned them before.
timotimo AFK for a bit
mst nadim: so, please, does what I propose work for you?
nadim that is exactly what timotimo was talking about above; the first role is composed into the class, by me, the second is compose much later by whoever uses the module (this is what I told you a few lines above), so it is not under my control. 14:36
mst nadim: yes, and that's exactly not what I'm asking.
nadim: what happens if you compose the two roles and *then* compose them into the class?
telling me "ah, but this other thing that I didn't mention in the original question means that doesn't answer a different question I didn't ask yet" doesn't help me, because I need to know if it answers the original question you *did* ask :( 14:38
nadim why would I do that? the second role is defined by someone else, at another time, in another space continum. Apart from travelling in betwen dimension (let time be one), and starting a new timeline where I can know in advance what the end user will do, I have no way to compose them into the class. nor do I have any use for that.
I will keep that in mind though, may be a solution for another problem I don't have yet 14:39
mst then you're intentionally making it impossible for me to help you, and I can only wish you good luck.
nadim OK
14:40 khw joined
mst and note that "I don't understand why you're asking me to clarify my question so I'm going to refuse to answer" is not generally a good way to help people to answer your questions 14:40
nadim mst, thank you for the help you already provided.
psch nadim: what exactly are you trying to do?
or maybe, what are you trying to achieve with what you're trying to do..? :) 14:41
average please take it to #p6drama
nadim override a multi method
average++
mst yes, but why? what would that gain you?
14:42 araujo left
mst average: please remember that larry shouted at you the last time you attempted to troll in here and drop it. 14:42
nadim: I mean, why is the user applying a role to one of your classes and why do they already know there's a multi there and what will they be trying to gain by overriding it? 14:44
understanding the original problem may make it easier for people to suggest approaches, is all
nadim mst: install Data::Dump::Tree, read the oc, read the tests, read the examples, you'll understand it all. Now thank you again for your help but I feel you are going to fuck it up here as you do on other channels, so I am out listening to birds and wind in the grass. 14:45
mst I was just expanding on the 'achieve' part of psch's question that you apparently missed :( 14:46
can somebody tell me what 'read the oc' means? 14:50
... oh, read the odc, probably
right, do next question, where do I look up the repo?
psch mst: panda look
alternatively where it's hosted
mst oh, ecosystem repo -> main repo? 14:51
psch i'd go via modules.perl6.org
mst aha
psch that links directly 14:52
mst sorry, not got the perl6 versions of this stuff in muscle memory yet
psch from ecosystem you have to mangle the raw.githubusercontent.com link
at least afair, maybe there's something that links to the web interface for github, but i don't think so
mst right, so, looking at github.com/nkh/P6-Data-Dump-Tree 14:53
it seems to me that the goal here is to let the user provide customised parts of dumping code 14:54
which totally makes sense
but in that case, it's not really exactly subclassing
subclassing would by default involve overriding, which is why it's doing the wrong thing
which suggests to me that my original thought of composing the two roles, wherein the dumper basics become a role rather than a class, should work 14:55
and basically an API of
14:55 infina left
mst argh, I forget the exact syntax, but 14:55
my $dumper_type = MyRole with DumperRole;
ugexe but Dumper Role; arhaksjdghafa!!!!!!! 14:56
mst and then $d = $dumper|_typew.new() relying on the type punning from role to class
should basically DTRT
14:57 infina joined
mst ugexe: I've found it pretty reliable in Moose/Moo that when I get stuck with role composition, more things need to be in roles rather than classes 14:58
15:02 Actualeyes left
ugexe i try to use roles more and more myself. sometimes having the extra initializer (im not sure what its called... the [ ... ] signature of a role) is nice: MyRoleClass[xxx].new(zzz) 15:02
mst right, stevan and I often said that if we'd had a chance to do everything from scratch, Moose would've been built out of roles first and classes second 15:03
whether or not that would've just been a differently bad idea I've no idea since we never got round to it ;)
ZoffixWin average, don't know about "unanimous decision", but the concurrency docs do say most users would use the higher level APIs instead of Threads and Locks ¯\_(ツ)_/¯
15:03 domidumont joined
ugexe i really want to do `role MyRoleClass[::ANOTHER-ROLE] does ANOTHER-ROLE { }`, but alas it does not work (yet, although jnthn said it was probably possible) 15:05
average ZoffixWin: ah ok, thanks
mst ugexe: I *think* maybe that's because MyRoleClass[::ANOTHER-ROLE] is producing a memoised result and so attaching an extra 'does' to it would be weird (this is certainly how a MooseX::Role::Parameterized would see things) 15:06
maybe you can make 'role does MyRoleClass[::ANOTHER] does ANOTHER {}' ? 15:07
timotimo oh lord :) 15:08
ugexe m: role Foo[::T] does T { }; role Bar { method baz { 1; }; }; Foo[Bar].new.baz # this was the error 15:09
camelia rakudo-moar 868d8b: OUTPUT«Unhandled exception: Method 'item' not found for invocant of class 'T'␤ at <unknown>:1 (/home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm:print_exception)␤ from gen/moar/m-CORE.setting:21361 (/home/camelia/rakudo-m-inst-1/share/…»
mst ugexe: oooh, I see 15:10
ugexe you can add a method BUILDALL(|) { self does T; nextsame; };, but ehhh
mst and then you're applying the role every time, right?
ugexe yeah 15:11
mst which has all of its own possible complications, I'd imagine 15:12
certainly does over in dinosaur country where I love
timotimo role application goes through a cache if i'm not mistaken 15:13
can someone check that?
mst it's more the possible semantic differences between 'role applied directly to class' and 'role applied to object' 15:14
ugexe in my cases i seem to want to express `StorageReader[::Storage] does UnderstandsStorage { }`
mst but the rules here for 'role applied to object' maybe different than I'm used to
15:16 dvinciguerra joined 15:17 sue joined
psch m: role Foo[::T] { method new { self but T } }; role Bar { method baz { 1 } }; say Foo[Bar].new.baz 15:18
camelia rakudo-moar 868d8b: OUTPUT«1␤»
timotimo i think you want to (self but T).callsame or something? 15:19
psch yeah, for actually-useful purposes definitely :)
ugexe m: role Contract { method baz { ... }; }; role Foo[::T] does Contract { method new { self but T } }; role Bar { method baz { 1 } }; say Foo[Bar].new.baz; # but then you have to declare your contract roles in the constructor too
camelia rakudo-moar 868d8b: OUTPUT«Method 'baz' must be implemented by Foo[Bar] because it is required by a role␤ in any compose_method_table at gen/moar/m-Metamodel.nqp line 2810␤ in any apply at gen/moar/m-Metamodel.nqp line 2820␤ in any compose at gen/moar/m-Metamodel.nqp line 2…»
psch oh 15:20
"role MyRoleClass[::ANOTHER-ROLE] does ANOTHER-ROLE { }" <- so those are different ANOTHER-ROLEs? 15:21
ugexe no, but i should have said `role MyRoleClass[::ANOTHER-ROLE] does ANOTHER-ROLE does Contract { }` to be more specific 15:22
where ANOTHER-ROLE is expected to supply a part of Contract
15:23 araujo joined
mst is it possible to make a thing that accepts the parameterisation and builds a non-parameterised role from outside? 15:23
like ... sub foo ($r) { MyRoleClass does $r does Contract { ... } } 15:24
timotimo sounds like building a closure
mst often has 'sub new_with_plugins (@plugins, %new) { Moo::Role->create_class_with_roles($class, @plugins)->new(%new) }' roughly in perl5
arnsholt You can programmatically mix in roles using the MOP 15:25
Gimme a sec and I'll dig up an example
ugexe if you try to role XXX { self.^add_role(..); self.^compose; } it gives the same error
timotimo i'm not sure you can build a pure Role object like that, but you can probably create a new HOW that can do what you mean
mst ugexe: note, totally unsure if my noodling is actually helping you but I'm trying to become less stupid
ugexe i dont even know if what im doing is sound, its just something that feels right so far 15:26
arnsholt my $new_type = Type.^mixin($role) should do the trick
mst ugexe: yeah, I'm leaning increasingly towards "this looks like unimplemented-as-yet rather than wrong" 15:27
arnsholt There's a number of uses in the Rakudo source, if you grep for .^mixin
15:30 Actualeyes joined
ugexe m: role Contract { method baz { ... }; }; role Foo[::T] { .^mixin(T); .^mixin(Contract); }; role Bar { method baz { 1 } }; Foo[Bar].new.baz # Mu+{Contract} ? 15:34
camelia rakudo-moar 868d8b: OUTPUT«Could not instantiate role 'Foo':␤Method 'baz' must be implemented by Mu+{Contract} because it is required by a role␤ in any at gen/moar/m-Metamodel.nqp line 2432␤ in any specialize at gen/moar/m-Metamodel.nqp line 2419␤ in any specialize at ge…»
15:37 Khisanth left
timotimo oh, good idea ugexe 15:37
i always forget that the role body runs at composition time
15:37 average left
timotimo but why is there a mixin of T *and* a mixin of Contract? 15:37
i thought the reason to have this was to be able to put Contract in as Foo[Contract]? 15:38
mst could you .^mixin(Contract but T) ? 15:39
ugexe no, i want Foo[Fulfills-Part2-Of-Contract] does Contract { method contract-p1 { .contract-p2(); }; }; 15:40
timotimo oh, sorry 15:41
ugexe m: role Contract { method baz { ... }; }; role Foo[::T] { .^mixin(Contract but T); }; role Bar { method baz { 1 } }; Foo[Bar].new.baz 15:42
camelia rakudo-moar 868d8b: OUTPUT«Could not instantiate role 'Foo':␤Method 'mixin' not found for invocant of class 'Perl6::Metamodel::ParametricRoleGroupHOW'␤ in any at gen/moar/m-Metamodel.nqp line 2432␤ in any specialize at gen/moar/m-Metamodel.nqp line 2419␤ in any specializ…»
psch m: role R { method foo { "bar" } }; role S[::T] { method baz { T.foo() } }; S[R].new.baz.say
camelia rakudo-moar 868d8b: OUTPUT«bar␤»
psch so Foo[Bar] never implemented any of Bars methods itself 15:43
why explains why it doesn't override the stub 15:44
m: role R { method foo { "bar" } }; role S[::T] { method baz { .foo() } }; S[R].new.baz.say # seeing as this doesn't work
camelia rakudo-moar 868d8b: OUTPUT«Method 'foo' not found for invocant of class 'Any'␤ in method baz at /tmp/KHs9sN7bqp line 1␤ in block <unit> at /tmp/KHs9sN7bqp line 1␤␤»
15:48 sue left
ugexe `my role TypedArray[::TValue] does Positional[TValue] {` is valid anyway 15:48
15:50 Khisanth joined 15:51 cdg left
psch right, and Positional is your Contract in that bit 15:54
15:55 dvinciguerra left 16:01 edjsu left 16:07 edjsu joined 16:10 Khisanth left 16:19 Ven joined
TreyHarris Okay, finally time to learn a NoSQL db for something other than cargo-culting a preexisting application. I've got an enormous JSON file (no, not the one I was discussing Friday) that I need to do searches on subfields of. Interestingly, I _don't_ think I'll be writing any long-running code against this, I just need to do some one-off data mining. Anyone have a suggestion of the one to pick? (Locally run on my 16:24
Mac or in a Heroku instance or Docker container or whatever, I don't care.)
16:24 Khisanth joined 16:27 xinming_ is now known as xinming
RabidGravy I quite like CouchDB, I've got a module coming along in the next few weeks, just got to work up the authentication piece 16:31
TreyHarris RabidGravy: well, I suppose I can use perl 5. I'm still in the stage where I can do the stuff that Perl 6 does really obviously well faster than Perl 5, but random toolkit stuff is still a lot slower. Feels kind of like maybe the second month switching from QWERTY to Dvorak. :) 16:35
16:36 YP-QMUL-W joined
xiaomiao TreyHarris: for json I'd use postgresql 16:39
why use NoSQL when you can have YesSQL :)
16:42 Relsak joined, TreyHarris left 16:43 hankache joined
masak fwiw, the discussion we had the other day about heterogenous data in a postgres column -- I went with JSON for that :) 16:43
16:45 YP-QMUL-W left 16:46 TreyHarris joined 16:52 YP-QMUL-W joined 16:55 hankache left
TreyHarris Wow, there are a lot of CouchDB libs on CPAN. RabidGravy, given that you're writing one for Perl 6, is there a p5 one you like? 16:55
16:55 hankache joined
orbus out of curiousity, how big is an "enormous" JSON files? 16:57
file*
RabidGravy The one I'm writing is higher level than most of the Perl 5 ones, I think if you just want to load up so data, create a few queries and so forth I'd go for Net::CouchDB
mst TreyHarris: recent pg with the full on json support tends to be nice
TreyHarris mst: oh! didn't even know about that 16:58
mst TreyHarris: xiaomiao did try to tell you a minute ago
orbus also, if you only need to get stuff out of it once, setting up a database seems like overkill
unless you just want to for fun
TreyHarris mst: my ISP fell off the net
mst orbus: you might only need to run the *final* queries once
TreyHarris: ooh, sorry, I'd missed the disco/reco, yeah, it was just before you felloff from this end so 16:59
TreyHarris mst++
orbus well true
I don't know how like jq performs on very large files
mst orbus: but for exploratory stuff, jamming it into a scratch monkey^Wtable and then running SELECTs is great
orbus may try to slurp the whole thing into memory
I don't disagree - just that setting up a database is nontrivial 17:00
although postgres isn't too hard to setup really
if you've done it before
mst I can safely assume that TreyHarris has heard of postgresql before now.
xiaomiao 'sane defaults'
TreyHarris not well. I gave it a shot and when it didn't even load up in five minutes I tried a sample of the top ten percent and that didn't load up in five minutes, so... (to be fair, this is a 1.5 million-k/v file)
lol, sorry, "not well" referred to jq, not postgres :) 17:01
RabidGravy well with e.g. CouchDB you just shove the JSON into the thing, there's not much "setting up" if you have a couchdb instance to hand
TreyHarris yes, I am familiar with postgres, very. one might say "too well". :)
RabidGravy I have a thing that loads up the projects.json
and a few queries to get the reverse dependencies and all 17:02
TreyHarris RabidGravy: yeah, that looks very straightforward, it was just that when I searched up "couchdb perl tutorial", the first thing that comes up is a perlmonks page showing what looks like a very simple query using Net::CouchDB with the request, "how do I get any data out of it?" and the responses being "beats me" :)
orbus lol
I setup mongo one time and poked at it a bit - it's json-ish 17:03
probably need to write a script to trawl through your file and put things into the database
I'm unfamiliar with couch
TreyHarris well, since i have to mess with postgres a fair amount for work, and I have it setup already, i should at least give that a try
orbus I haven't messed with postgres json support much 17:04
but they've been expanding it in recent versions
TreyHarris orbus: that was the attractive thing about couch was that you literally just say, "here's a json structure, you figure it out"
orbus neat
TreyHarris like it makes certain... uh... JSON... inferences....
TreyHarris looks at his feet and shuffles a bit
RabidGravy yeah, it understands the JSON, you write a map function in javascript, it indexes, you make queries 17:05
orbus could look at elasticsearch also - I don't have much experience with it, but it's designed for indexing and searching documents
although maybe geared towards many small documents, not one big one
RabidGravy I actually had a play with elasticsearch the other day, so needs a Perl 6 interface, I stuck it on the end of my very long TODO list :) 17:06
17:06 Sgeo left
orbus there's lots of things that still need perl6 interfaces 17:07
the main reason I'm not using perl6 more is we're still primarily a solaris shop
Ulti postgres json stuff is only really useful if you have many small records of JSON with shared keys
TreyHarris I'm getting an VR kit tuesday, so if somebody wanted to whack together a quick sdk for that by then, that'd be great. I'll buy you a pint 17:08
Ulti jsonb you can do proper indexes on though which are surprisingly fast
orbus if you already have postgres up and running (and it's 9.4 or even better 9.5), give that a shot 17:09
TreyHarris i'm using webvr because that's the only way really to do visualizations without dealing with tons of game-oriented frameworks i don't need, but writing stuff directly into a DOM is decidedly unfun. 17:10
dalek c: 66041cc | (Zoffix Znet)++ | doc/Language/nativecall.pod:
Clarify library name usage

Reverts #438
orbus remains unconvinced of the merits of vr 17:11
it's a neat fad though
RabidGravy to be fair the idea has been around for a good twenty years 17:13
orbus tinyurl.com/anarzsv
Ulti remains unconvinced of the merits of 3D graphics or the internet it's a neat fad though
orbus I don't really find those examples comparable
TreyHarris RabidGravy: to be fair, I worked on a system whose architecture is essentially that of the HTC Vive in 1993 at the UNC graphics lab, though we used RF rather than infrared lasers for tracking. 17:14
:)
17:14 ZoffixLappy left
RabidGravy :) 17:14
TreyHarris So, more like 25 years....
Ulti orbus really? I find them both highly relevant to what VR means as a medium 17:15
orbus I'm sure there are specialist applications, but I don't think we're all going to be walking around with vr displays strapped to our heads all the time anytime soon
Ulti not until AR no
TreyHarris I'm astonished I've had to wait that long for something we had stable in the lab to get to consumers, it's definitely the longest leadtime except maybe for 3D printing. Or really high-resolution haptics, maybe
psch yeah, a non-douchy-looking google glass would be amazing
Ulti you could have said the exact same thing about car phones from the 80s too
17:15 Ven left
psch i mean, VR as a technology is about as niche as gaming, plus medical maybe 17:16
orbus I don't even really think it's going to take off for gaming
psch but AR applications are ridiculous
orbus AR I can see
eventually
TreyHarris orbus: I did a POC app where I took performance graphs from all the systems in a cluster around an outage event, and I lined time up on the x axis, the values of various metrics on the z (up-down), and put them in ribbons across the y so you could see all the hosts in the cluster at once. Given that view of the cluster, it became just a matter of visual inspection to do root-cause analysis. 17:17
orbus: I really thing it would be a fantastic thing for something like nagios to support
orbus difficult for me to visualize - is it really that much better than a large monitor?
awwaiid so I guess it would be AR that will let me wear glasses instead of looking at a monitor and it will project my terminal/browsers into the air where my monitor would be?
17:18 Relsak left
Ulti I can see VR desktop being a big deal for mobile applications, I can have a proper desktop from my phone not just a small display or even a laptop display 17:18
17:18 Ven joined
awwaiid all my friends make fun of me for staring at blank walls, but I tell them I'm practicing 17:18
TreyHarris orbus: yes. i'm sure you've used stacked graphs before, or "sparkline stacks", where the x axes, usually time, are the same and lined up vertically, but you repeat the y-axis with the data again and again, to compare the performance of one thing against another? that's unarguably useful 17:19
this is that with hundreds of stacked graphs at once usable and useful
orbus sure, but I guess my question is, are vr goggles necessary to make a useful graph
they don't see to me to add anything to that 17:20
seem*
TreyHarris I know of no other way to look around an arbitrary 3D space where there is occlusion. If you're capable of looking at a topo map and seeing the heatmap in your head, maybe. But most people aren't. 17:21
orbus I should add, I'm one of those people that 3d glasses don't really work for, and on top of that, they make me nauseous
I expect vr goggles would do the same
so that may be coloring my view
masak orbus: same here.
ZoffixWin orbus, are you colorblind? That may be why 3d glasses don't work. 17:22
orbus not that I know of
awwaiid I tried an occulus rift a few years ago, and the head movement detection made it a very very different experience than other 3D things I've tried
ZoffixWin But VR goggles are an entirely different technology. So it'll work. 17:23
orbus I do wear glasses though
ZoffixWin *shrug*
orbus that may be causing problems
TreyHarris Possibly, but you should still give it a try--consumer 3D glasses use a very different technology that requires your eyeballs to focus at one distance while your retina focuses at another one. The two top-end headsets from Oculus and HTC use infinite-focusing fresnel lenses--your eyes should not be able to tell that they aren't focusing at infinity.
timotimo TreyHarris: i'd personally say: stick it into a postgres database, your large JSON blob 17:24
TreyHarris Personally, because I'm biased about the architecture, I'd say try the Vive before dismissing it--the Oculus's architecture has greater chance of motion sickness or vertigo.
timotimo a nosql database won't save you when you have just a single blob that you have to put in there as one single document
TreyHarris timotimo: yep, in progress, we'll see how that goes.
timotimo cool
orbus if these things ever get out of the early adopter niche, I'll give it a try
or if there's a demo someplace 17:25
TreyHarris ZoffixWin: sorry for repeating some of the things you said, I was in the middle of typing and didn't go back to edit out the things you'd mentioned.
timotimo www.learningperl6.com/ - i didn't even know about this! there's a blog on that page now! 17:26
ZoffixWin I'm gonna wait a couple of years before buying a VR set. Let them work out the kinks :)
orbus snow crash :p
TreyHarris ZoffixWin: I've been waiting 25 years :) 17:27
ZoffixWin lol
timotimo did you get the original Virtual Boy? :)
17:27 Ven left
orbus my brother had one 17:27
that thing gave me headaches for sure 17:28
TreyHarris timotimo: oh, god no. I actually did VR research, I know what the baseline req's are to actually result in the feling of presence and the absence of motion sickness or eyestrain.
17:28 Ven joined
timotimo :D 17:28
17:29 pecastro left
TreyHarris timotimo: You need to push about 4 thousand pixels, in two streams, at a absolutely rock-steady 90 frames per second. That was not something consumer technology could come close to doing until about 3-4 years ago. 17:29
timotimo oh, 90 fps?
TreyHarris lol, 4 MILLION pixels
timotimo does that mean 45 fps on each eye, or 90 fps on each eye?
TreyHarris four thousand pixels, that was about the virtual boy :) 17:30
masak you can probably get away with lower. reacting quickly to the user turning her head is the real challenge.
timotimo wasn't the virtual boy vector-based?
TreyHarris timotimo: no, 90 fps on each eye. 180 frames of 1080p every second is a good way to think of the minimal baseline, it's very very close to that.
orbus the graphics were yeah
and it was monochrome
red and black
TreyHarris yes, latency is as big an issue as persistence. an LED definitely couldn't cut it. OLEDs came in at just the right time 17:31
masak Could not locate compile-time value for symbol DBError
timotimo TreyHarris: i don't think anything achieves that right now ... isn't that a bit high? where did you get these numbers?
masak in block at /home/masak/ours/rakudo/install/share/perl6/site/sources/F51B76EA668B2C3E5C8704F71C1F2DD75D6CCF4B line 46
TreyHarris at UNC, we actually strapped two high-definition CRTs to people's heads. CRT's are fast :)
masak wow, that's a whole long line of nothing 17:32
not only are those generated paths not very pretty, they're also quite bad at telling you where the error happened
timotimo masak: huh, aren't we supposed to give the logical name of that?
stmuk_ bugs.debian.org/cgi-bin/bugreport....bug=819703 .. maybe perl 6 should warn :)
masak timotimo: that would help, yes
TreyHarris timotimo: you don't think anything achieves what? i may have made another thousands for millions error there... 17:33
orbus TreyHarris: did their eyeballs melt?
masak This is Rakudo version 2016.02-147-g42fb81d built on MoarVM version 2016.02-32-g79dce11
timotimo gotta go AFK for a bit
TreyHarris orbus: lol, no, the crts were actually behind the cranium and reflected around with mirrors and lenses.
orbus ah, okay 17:34
TreyHarris getting small high-definition CRT displays in 1993, though... i want to say they were $50K each? i may be misremembering
smaller was easier, obviously, so that was a small advantage... 17:35
ah, good times :)
17:35 zacts joined
orbus indeed 17:35
well good luck with your json problem - time to grab food 17:36
17:36 rindolf left
TreyHarris thankee sir 17:36
17:36 araujo left, rindolf joined 17:42 john51 left, john51 joined 17:48 Skarsnik joined 17:57 pmurias joined 18:00 edjsu left, edjsu joined 18:02 wamba left 18:08 wtw left, wtw joined
masak that "Could not locate compile-time value for symbol DBError" error I'm getting seems to be masking the real error, namely that it can't find the database host 18:10
18:11 nadim left
timotimo oh, does it compile-time-evaluate parts of stuff? 18:11
that's weird
18:11 nadim joined
moritz class GLOBAL::X::DBDish::ConnectionFailed is X::DBDish::DBError { 18:15
wtf?
18:15 arcetera left 18:16 arc__ joined, arc__ is now known as arcetera, arcetera left, arcetera joined 18:17 pmurias left 18:27 Vlavv_ left 18:31 Ven left 18:32 vsdfs joined 18:34 Ven joined
masak next fun one: Method 'allrows' not found for invocant of class 'DBDish::Pg::StatementHandle' 18:38
18:38 Vlavv_ joined 18:39 hankache_ joined
masak unless I'm reading things very wrongly, DBDish::Pg::StatementHandle inherits from a role DBDish::StatementHandle that implements such a method 18:40
m: role R { multi method foo() { say "OH HAI" } }; class C does R {}; C.new.foo
camelia rakudo-moar 868d8b: OUTPUT«OH HAI␤»
masak basically that situation, but with more multi methods, more namespaces, and more files
18:41 hankache left
Begi Could I add it in the Perl 6 ecocsystem as a module ? github.com/Emeric54/p6-text-cesar 18:44
it's still a WIP for now
masak Begi: do the tests pass?
oh, 001-load.t :/ 18:45
Begi masak: I've only one test for now :-)
18:45 pecastro joined
Begi I'll add new tests 18:45
masak suggestion: github.com/Emeric54/p6-text-cesar/...ar.pm6#L17 -- prefer 'eq' here, not '~~' 18:46
since we know both sides are Str
better to be specific and convey more intent
the rest of the code looks very nice and clean
Begi: note really sure I see the point of the `prepare` sub... 18:47
RabidGravy yeah, spot more documentation and some tests you're good to go
masak not*
18:48 Actualeyes left
RabidGravy I'm actually eyeing the 600 modules target in the next few days :) 18:48
Begi ok, I'll change that 18:49
masak: the prepare sub removes punctuation and uppercase the text
RabidGravy It has taken some four months to add the 100 modules since the 500 in the first week of January 18:53
MORE!
masak Begi: yes, but the `encrypt` sub works even without the `prepare` step... so why throw away information that the user might have wanted to keep?
RabidGravy so under 1 a day
masak Begi: I happen to like punctuation... :)
huh! the DBIish thing works fine outside of my Bailador app... :/ 18:54
yep -- confirmed 18:55
masak rebuilds his rakudo and panda and everything, Justin Case 18:56
RabidGravy punctuation rendered in the crypted text provides for easier decryption solutions 18:57
masak you do realize that we're talking about Caesar cypher here, right? 18:58
cipher*
it's basically one step up from ROT13
RabidGravy yes
and with a more sophisticated cypher the removal of the punctuation wouldn't be necessary 18:59
Begi or I add an option to keep the punctuation
RabidGravy but in a substitution cypher leaving the punctuation adds an additional pattern with which to attack the encryption 19:01
19:01 jameslenz joined
masak Begi: I think RabidGravy has a point. leave it as it is, I think :) 19:01
Begi yes, it's what I'm gonna to do :) 19:02
RabidGravy :) Of course it's moot, because you could crack it in ten minutes with a reasonably powerful computer but hey why make it easy ;-) 19:03
19:06 vsdfs left
masak yep -- after a full rebuild, still getting "Could not locate compile-time value for symbol DBError" 19:07
also, out of curiosity -- I got "Bailador:ver<*>:auth<>:api<> already installed" from Panda.
19:07 yqt joined
masak apparently panda-installed modules seem to survive a full rakudo rebuild these days. 19:08
how do I clear away and reinstall my panda modules? (just to make sure they're not precompiled wrong or something)
19:09 leont joined 19:13 Relsak joined
timotimo i think if you just re-build from the core setting, you'll force everything to be re-precompiled 19:15
masak I'm getting "Could not locate compile-time value for symbol DBError" 19:16
I think I'm not quite clear why I'm getting that error
timotimo try --optimize=0?
or even =off
or even better: stagestats 19:17
that'll tell us if the optimizer is at fault
masak note that this only happens when I run stuff through Bailador
trying with --optimize=off
yes, same error
19:17 hankache_ left
masak what's "stagestats"? do you mean I should do --optimize=stagestats? 19:18
timotimo huh, ok
nah, just --stagestats
masak ok
yeah, it goes all the way to runtime
timotimo interesting
masak the failure is when I hit the site
19:29 rindolf left 19:33 domidumont left 19:36 skids joined 19:39 geraud joined
masak ugh. I would like to help more with this. submit a bug report or something. 19:48
clearly Bailador and DBIish are having some problem working together right now.
timotimo ;( 19:50
masak ..but the part where I have to go through the GET request seems to be an irreducible part of the problem. (as in, if I don't do that, then it works fine.)
and I simply don't know how to rakudobug that. 19:51
19:51 pomJ joined
masak you hear that, #perl6? after 8 years of bug reporting, you've finally got me stumped. 19:51
timotimo wowza
a major milestone!
DrForr Hold on, I want to write this down.
masak this is a bug SO WEIRD... that I don't even 19:52
lizmat finish your sentences?
mst casts resurrect on masak's toucan 19:53
timotimo lizmat: something i didn't consider when using IO.slurp.lines was suggested was that a gigantic array will cause significant time spent in the GC just going through all those items
19:53 pomJ left
masak mst: is "toucan" a euphemism here? do I want to know? :P 19:54
mst masak: there was a thing of "I don't know how to can" as a step beyond "I don't even" and then "to con" -> toucan -> "my toucan!" 19:55
masak ah.
hold on -- maybe I can inline large parts of Bailador into my script... yeeeees...
timotimo hah :) 19:56
masak it's a one-in-a-million shot... but it just might work...
19:58 pomJ joined
skids lizmat: knowyourmeme.com/memes/what-is-this-i-dont-even 19:58
masak timotimo: oh! after upgrading rakudo, it does tell me what module that grotesque file name corresponds to 19:59
mst masak: quick, blindfold yourself and stand on one leg while you do it 20:00
timotimo masak: nice :)
20:02 wamba joined 20:04 BenGoldberg left 20:05 darutoko left
masak yes, this seems like a viable way forward 20:06
lizmat skids: thanks 20:07
masak I now have the bug reproduced but with most of Bailador.pm in my script
timotimo that's a good way forward
masak too tired to continue now, though
'night, #perl6
Begi ++ masak
lizmat night masak
timotimo gnite masak :) 20:08
20:14 kaare_ left 20:18 BenGoldberg joined, buharin left
ufobat probably a dump question from me again, what's the meaning of a sub inside a class, and whats the difference between sub foo { ... } and our sub bar { ... } 20:18
timotimo subs are scoped "my" by default, so they are only visible to other things between the opening and closing { } that they are contained in 20:19
when you have "our" instead, it'll be registered in the package
ufobat i guess MyClass::foo() is not working but MyClass::bar is, i coundnt find the documentation
timotimo doc.perl6.org/syntax/our - did you find this?
hm, the declaration there is a bit weird 20:20
says "symbol table"; i'd call it "package" instead
ufobat but its only about variables.
after reading that i still felt unsure
timotimo oh, good point. it's not clear that it generalizes to everything else
ufobat thanks timotimo 20:21
awwaiid ufobat: and the other thing is that it acts just like a plain sub rather than a method -- you don't call it as a method and it doesn't get self
20:24 TEttinger joined
ufobat yeah. but at least i was not unsure about that behavior :) 20:26
dalek osystem: 46c520b | Emeric54++ | META.list:
Update META.list

See : github.com/Emeric54/p6-text-cesar
20:29
osystem: 4429945 | azawawi++ | META.list:
Merge pull request #188 from Emeric54/patch-1

Update META.list
20:33 arcetera left, jantore joined 20:35 arc__ joined, arc__ is now known as arcetera, arcetera left, arcetera joined 20:37 jantore left 20:39 jantore joined 20:42 Ven left 20:43 espadrine left 20:50 spanner left, spanner joined 21:07 Begi1 joined 21:08 Begi left, Begi1 is now known as Begi 21:20 Relsak left, sortiz left
Xliff Hrm... here's one for ya! Cannot locate symbol '' in native library '' 21:24
May need to see if I can add a test to NativeCall and see if it works.
Skarsnik weird 21:31
Xliff Yeah,. 21:35
It's a C lib I'm trying to wrap.
That wraps a C++ class. Does so by using a struct of callbacks.
So...
my &func_sig = nativecast(:(XQC_Implementation_s, Pointer, XQC_StaticContext_s, Pointer --> XQC_Error), $!prepare_file); 21:36
Humm... wrong example. That one I know doesn't work. Has a problem with XQC_Error which is an enum.
So I moved to this:
my &func_sig = nativecast(:(XQC_Implementation_s, str, Pointer, Pointer --> int32), $!prepare);
Where $!prepare has the pointer to the callback. 21:37
Skarsnik hm, I think you need to define the native sub somewhere to use a callback
Xliff my $err = &func_sig(self, $expr, 0, $xpr);
Skarsnik and cast with it?
Xliff Yeah. That's the thing.
The struct is set up via ONE C call. 21:38
And then it is supposed to be all setup and usable via the callbacks.
$!prepare is one of those callback values.
Skarsnik without the full code is hard to see
Xliff Hence the use of nativecast() on it.
Skarsnik, I was hoping my small test would work and I would then upload it to GH. 21:39
But it doesn't, and I'm loathe to put non-working crap on GH.
Lemme pastebin it.
dalek c: b359168 | (Wenzel P. P. Peppmeyer)++ | doc/Language/setbagmix.pod:
partial fix for #428
MadcapJake What's the point of putting a bunch of callbacks in a struct?
Skarsnik sqlite3 does that 21:40
MadcapJake Why? What benefit does it bring? Just smaller param lists?
Xliff pastebin.com/jaN7zqg6 21:42
MadcapJake, provides a CPP like interface to C.
21:43 labster joined
MadcapJake Xliff: yeah that's what I'm thinking, they're kind of like JavaScript objects 21:43
Xliff So your structs then look vaguely like classes, with members and methods.
I chose this route because I can't find much on NativeCall and C++ support.
Namely, what I've found says it doesn't.
And I really only need a subset of this library. (XQilla) 21:44
MadcapJake Xliff: as long as an enum starts at 0 and increments by 1, you actually don't need the numbers at all, in fact the easiest way is a quote word construct 21:45
Skarsnik NC with c++ work if there is no template or type like std::string
well it's generated by gptrixie MadcapJake x) 21:48
MadcapJake Skarsnik: ah! that's why :P
Skarsnik: why do you generate the DESTROY submethods? I thought that those don't work on non-GC'd stuff (nativecall stuff)
Skarsnik the whole code is not from gptrixie, the enum are x) 21:49
MadcapJake oh :P
21:52 pomJ left 21:53 Begi left
Skarsnik maybe I could generate code for callback? 21:54
21:58 labster left
Xliff MadcapJake: In that situation (the enums) I didn't think a <> construct would be compatible. 22:01
So I left the enums. 22:02
And you have no idea how long it took me to get gptrixie working.
I'm amazed I am where I am at this point into the project. I started on Wed.... I think.
Maybe Thursday.
Skarsnik what was the issue with gptrixie? 22:04
timotimo it's too awesome 22:05
22:07 wamba left
timotimo why the F does my script here only get 50% cpu usage in "time"? 22:10
arnsholt Multi-CPU? 22:11
timotimo no 22:12
it crashes and writes a core dump
arnsholt Odd
timotimo without telling me, because "time" makes it invisible
arnsholt Ain't UNIX great =)
timotimo it's f-ing fabulous 22:13
22:15 RabidGravy left
arnsholt Although I guess that particular problem occurs on Windows as well 22:18
It's the responsibility of the program that calls exec() to check how the child exited
Juerd I don't know about Windows, but in *nix, the program (process, really) that calls exec() *becomes* the new program, and exec() does not create a fork. 22:20
timotimo when it forks, does it cease to be the same program? :P 22:21
Juerd But you're right if s/exec/fork/ :)
timotimo: Hmmm :) 22:22
Xliff Skarsnik, I will go with what timotimo said. But there also seems to be a problem when running it as root. Took me forever to figure that out. 22:23
22:24 kjk_ joined
timotimo running it as root ?!?! 22:24
Xliff Also to find out that it doesn't work with GCC 5. I had to downgrade to GCC 4-9 to get it to compile.
timo x 2, yeah. Always got a "argument list too large" when running it as root. Running it as normal user solved that problem. I don't know why.
I may have to wait until NativeCall supports C++ and go the long way to do what I want... *sigh* 22:25
Maybe I will try libXML. 22:26
timotimo did you read hoelzro's blog post about how he binds c++ with NC?
Xliff But I just don't think that has the selector support I need to do that.
timotimo, No. I haven't. Can you paste link?
timotimo hoelz.ro/blog/binding-to-cpp-with-nativecall
Xliff Thanks. Maybe I will start a fork of my own project. LOL!
kjk_ p6: sub one(-->1) {}; say one; 22:28
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/tmpfile␤Function "one" may not be called without arguments (please use () or whitespace to denote arguments, or &one to refer to the function as a noun)␤at /tmp/tmpfile:1␤------> 3sub one(-->1) {}; say o…»
kjk_ p6: sub two(-->2) {}; say two;
camelia rakudo-moar 868d8b: OUTPUT«2␤»
kjk_ p6: sub one(-->1) {}; say one();
camelia rakudo-moar 868d8b: OUTPUT«1␤»
kjk_ hi, why can't the sub one can't be called without () while two can? 22:29
timotimo because one's already a built-in sub 22:30
m: say one 1, 2, 3
camelia rakudo-moar 868d8b: OUTPUT«one(1, 2, 3)␤»
timotimo apparently we don't properly notice it's been overriden
kjk_ oh~~ ic..., thanks, was just wondering. 22:31
22:32 hahainternet joined
timotimo m: say 22:33
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5===␤Argument to "say" seems to be malformed␤at /tmp/YHUEkYw4B1:1␤------> 3say7⏏5<EOL>␤Other potential difficulties:␤ Unsupported use of bare "say"; in Perl 6 please use .say if you meant $_, or use an explicit invocant or …»
timotimo m: sub say() {}; say
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5===␤Argument to "say" seems to be malformed␤at /tmp/YuWVDfVTSx:1␤------> 3sub say() {}; say7⏏5<EOL>␤Other potential difficulties:␤ Unsupported use of bare "say"; in Perl 6 please use .say if you meant $_, or use an explici…»
timotimo yeah, we should not give the error message if the user has made their own version 22:34
kjk_ yah i was expecting my version to be called instead. 22:35
timotimo m: sub one(-->1) {}; say one();
camelia rakudo-moar 868d8b: OUTPUT«1␤»
timotimo well, your version is called
it's just not parsed correctly
kjk_ m: sub one(-->1) {}; say one; 22:38
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/bQseyr0lq8␤Function "one" may not be called without arguments (please use () or whitespace to denote arguments, or &one to refer to the function as a noun)␤at /tmp/bQseyr0lq8:1␤------> 3sub one(-->1) {};…»
kjk_ but looks like it tries to call another one sub that expects arguments, not mine.
22:41 ZoffixWin left
timotimo the "SORRY!" tells you it's compile-time 22:41
so no calling happening yet
kjk_ oh hmm, so at compile time it incorrectly assumed that I was going to call the built-in one sub instead of my one sub? 22:44
timotimo i think this check lives in the optimizer
the optimizer is also the piece of code that reports things like "this sub call can never work with these types" 22:45
BenGoldberg m: multi sub one(-->1) {}; say one;
camelia rakudo-moar 868d8b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/tbB07uROrp␤Function "one" may not be called without arguments (please use () or whitespace to denote arguments, or &one to refer to the function as a noun)␤at /tmp/tbB07uROrp:1␤------> 3multi sub one(-->…»
22:46 ZoffixWin joined
kjk_ ic, is this an known issue or should i open a bug report somewhere... 22:48
timotimo not sure; you'd have to look in rt.perl.org if it's already there; submission is done via email via [email@hidden.address] 22:49
is someone with a clue of C around? 22:51
i want to turn an MVMCollectable ** into a char * so i can bytewise advance the pointer with an offset i calculated myself 22:52
is char *rawpointer = (char *)firstitem; the right incantation for that?
22:53 dvinciguerra joined
arnsholt I'm pretty sure you're not going to want to convert a Thing** into a char* 22:53
BenGoldberg m: &one.candidates.say
camelia rakudo-moar 868d8b: OUTPUT«(sub one (+ is raw) { #`(Sub+{<anon|63744640>}|75101424) ... })␤»
timotimo arnsholt: but i am
BenGoldberg m: multi sub one(-->1) {}; &one.candidates.say
camelia rakudo-moar 868d8b: OUTPUT«(sub one ( --> 1) { #`(Sub+{Callable[Int]}|66513144) ... })␤»
timotimo arnsholt: why wouldn't i?
arnsholt Well, because you'd be twiddling the individual bytes of the pointers to your collectables 22:54
Xliff timotimo, your incantation is correct.
BenGoldberg m: multi sub one(-->1) {}; &one.candidates.[0].().say
camelia rakudo-moar 868d8b: OUTPUT«1␤»
BenGoldberg m: multi sub one(-->42) {}; &one.candidates.[0].().say
camelia rakudo-moar 868d8b: OUTPUT«42␤»
timotimo arnsholt: this function is supposed to take a "how far are these pointers apart" argument
arnsholt If you want to offset into the list of collectables "firstitem+1" will be the second item
BenGoldberg m: multi sub one(-->42) {}; &one.candidates.[1].().say
camelia rakudo-moar 868d8b: OUTPUT«Cannot find method 'Nil'␤ in block <unit> at /tmp/hb9LkBa3_o line 1␤␤»
Xliff At least as far as I understand it.
timotimo anyway. i might never actually need to have any offset other than width-of-a-pointer 22:55
BenGoldberg m: multi sub one(-->42) {}; &one.candidates.[1].say
camelia rakudo-moar 868d8b: OUTPUT«Nil␤»
22:55 dvinciguerra_ joined
BenGoldberg m: Nil.say; 22:55
camelia rakudo-moar 868d8b: OUTPUT«Nil␤»
arnsholt timotimo: I highly doubt you'll ever want to offset fractional pointer sizes into a list of things, FWIW
Xliff timotimo, this is also assuming I understood you correctly and that you want to use char math to compute your offsets.
As in "char *rawpointer = (char *)firstitem" and rawpointer+1 puts you at the second-byte (assuming UTF8, here) of the buffer containing your MVMCollectables. 22:57
teatime utf8 doesn't enter into it.
Xliff sizeof(char) then.
arnsholt Yeah, I was about to say the same
BenGoldberg Shirley the C compiler is utf-unaware.
timotimo yeah, because i also calculated ((char *)&slots[1]) - ((char *)&slots[0]) 22:58
teatime sizeof(char) is always 1 byte.
timotimo as the number of bytes to add
but i've thrown the offset thing out now
Xliff OK. Then my qualifier was unnecessary.
22:58 dvinciguerra left 22:59 labster joined
Xliff So is this error: 22:59
Cannot locate symbol '' in native library ''
A result of nativecast not finding the right symbol due to the use of callback pointers?
arnsholt timotimo: If you get two pointers and want to compute the number of bytes between them, I'd do "sizeof(thing_type)*(secondptr-firstptr)" 23:00
timotimo it's part of a union
an anonymous union defined inside a struct 23:01
not sure if i can ask C for the sizeof that thing_type
arnsholt You can use sizeof on attributes as well
timotimo oh, neat.
arnsholt It's uncommon, but perfectly legal. Should work for this case (but I'd make sure it does, FWIW)
Though note that for arrays the semantics for sizeof are slightly different (and escape me ATM) 23:02
23:02 vendethiel- left
arnsholt (sizeof(a_variable), that is) 23:02
timotimo my code no longer crashes, nice
so i did do something wrong
my pointer arithmetic isn't really up to snuff once casts start flying all over the place 23:03
arnsholt Yeah, you need to be really careful when that happens. Thus my advice to avoid them entirely =)
Anyways, bedtime for me 23:04
timotimo i should have adhered to YAGNI
arnsholt & # zzz...
timotimo good night arnsholt, and thanks for the help :)
23:05 firstdayonthejob left 23:06 vendethiel joined, spider-mario left 23:23 Ben_Goldberg joined 23:24 Ben_Goldberg left 23:25 BenGoldberg left, Ben_Goldberg joined 23:28 vendethiel left 23:43 dvinciguerra_ left 23:44 vendethiel joined 23:59 autarch left