Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-04-03

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:19 tphilipp joined #perl6
00:50 tphilipp joined #perl6
00:58 cpage_ joined #perl6
01:08 telex joined #perl6
01:32 cdg joined #perl6
01:46 kurahaupo joined #perl6
01:48 AlexDaniel we have s/a/b/ and S/a/b/, but what is the S-like equivalent for tr/a/b/ ?
01:49 AlexDaniel 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␤»
01:50 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 #perl6
01:50 Hotkeys I tried it when you first mentioned it
01:51 molaf joined #perl6
01:51 AlexDaniel Hotkeys: then where's your bug report? :)
01:51 Hotkeys I didn't realize it was a bug
01:51 AlexDaniel well, not a bug, but in my opinion it is a sad inconsistency
02:05 aindilis joined #perl6
02:06 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:10 AlexDaniel haha, due to mass renaming of tickets in RT the main page is now full of SEGVs :D
02:14 kurahaupo joined #perl6
02:16 aindilis joined #perl6
02:18 tphilipp left #perl6
02:18 Xliff Hello.
02:19 Xliff My class definition starts with the following:
02:19 Xliff class XQC_Implementation_s is repr('CStruct') is export
02:19 Xliff Why is there no self reference in this class?
02:20 Xliff 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()␤»
02:20 Xliff m: class A { method b { say self; } }; my $a = A.new.b()
02:20 camelia rakudo-moar b3b24b: OUTPUT«A.new␤»
02:24 _nadim joined #perl6
02:33 sortiz joined #perl6
02:34 sortiz \o #perl6
02:35 Xliff Sortiz.... how do you specify destructor for class that has access to self?
02:35 Xliff method DESTROY {}
02:35 Xliff ?
02:35 Xliff sortiz, (Oh, and good evening... sorry...focused)
02:36 sortiz Use 'submethod DESTROY() { ... }'
02:36 Xliff Thanks. Will "say" produce any output if used within that method?
02:37 sortiz Yes, but don't expect that destruction happen in an deterministic time!
02:38 Xliff Ah. So expecting it to happen in -e one-liner is probably too much to hope for?
02:38 sortiz Yep.
02:38 Xliff kk. Thanks.
02:40 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 Herby_ joined #perl6
02:41 Herby_ Evening, everyone!
02:41 sortiz \o Herby_
02:41 Herby_ o/
02:42 noganex_ joined #perl6
02:42 nchambers o
02:42 nchambers o/
02:42 Herby_ \o/
02:43 nchambers whats everyone up to tonight?
02:44 Herby_ trying to find an interesting project to tackle with perl 6
02:44 Herby_ coming up empty so far
02:44 Herby_ yourself?
02:45 * sortiz Converting Oracle::Native to OO :)
02:46 BenGoldberg Herby_, how about this: create a perl6 irc plugin for </insert favorite irc client here> ! ;)
02:47 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?
02:48 BenGoldberg Well, what's your irc client?
02:48 * BenGoldberg is a hexchat user.
02:49 * 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
02:49 Herby_ webchat.freenode.net :(
02:49 nchambers lame
02:49 skids joined #perl6
02:49 nchambers at least use kiwiirc
02:50 Herby_ BenGoldberg: reading up on the hexchat plugin interface now
02:51 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?
02:52 BenGoldberg How's your C skills?
02:52 Herby_ I can spell it
02:52 Herby_ i've dabbled some :)
02:55 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 nadim joined #perl6
02:57 Xliff \o Herby
02:57 Herby_ Xliff!
02:58 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:59 Xliff Ouch.
02:59 Xliff OK. I have a NativeCall implementation that passes back a C struct with callback pointers.
02:59 Xliff How can I execute the callbacks?
03:00 telex joined #perl6
03:01 Xliff I'm getting the following error when I try to use the callbacks as a method call
03:01 Xliff » Too many positionals passed; expected 1 argument but got 5
03:03 sortiz Xliff, If you have a pointer to a C func, you need to attach to it a signature first.
03:03 Xliff OK
03:03 sortiz See https://github.com/rakudo/rakudo/blob/no​m/t/04-nativecall/19-function-pointers.t for an example.
03:04 Xliff Thanks much!
03:04 sortiz For attach the signature you need 'nativecast'
03:05 sortiz yw
03:07 Xliff Hrm. Where are actual docs on nativecast()?
03:08 Skarsnik there is none ^^
03:08 Xliff Yikes!
03:16 Xliff So...if I understand this right....
03:16 sortiz Add more NC docs is a task that I have queued.
03:17 Xliff my $func_ptr_w_sig = nativecast(:(type, type[, ...type] --> return_type, $func_ptr)
03:17 Xliff Or...
03:17 Xliff my $func_ptr_w_sig = nativecast(:(type, type[, ...type] --> return_type), $func_ptr)
03:17 sortiz Yep.
03:17 Xliff ok.
03:18 Xliff 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.
03:19 Xliff OK. So no clean way to do it without defining methods and making the call.
03:20 Xliff So.
03:20 teatime you gotta know the arguments to call a function, if all you have is its address :)
03:20 sortiz Can't be a way for NC to infer that, you only have a pointer.
03:20 Xliff m: class A { has Pointer $!meth1; method meth1(Int) { say "Hi!" } }; say A.new.meth1(1)
03:20 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 #perl6
03:21 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␤»
03:21 Xliff Oh, good!
03:22 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)
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…»
03:22 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)
03:22 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…»
03:22 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);
03:22 camelia rakudo-moar b3b24b: OUTPUT«Hi!␤True␤»
03:23 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…»
03:23 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«Hi!␤AAA␤»
03:32 Xliff OK. So if a function is expecting a pointer to a struct (or class), can I just pass that class instance?
03:33 Xliff my $i = ClassName.new; func_expects_class_ptr($i); <- ???
03:46 nadim joined #perl6
03:54 diakopter maybe of interest - KestrelInstitute open-sourced Specware (language name MetaSlang) on github
03:56 diakopter http://www.specware.org/documentation/4.2/​language-manual/SpecwareLanguageManual.pdf
03:58 Ben_Goldberg joined #perl6
04:14 geekosaur joined #perl6
04:15 Vlavv_ joined #perl6
04:17 _nadim joined #perl6
04:25 nadim joined #perl6
04:25 Xliff Does anyone know if NativeCall can handle C's FILE* ?
04:25 Xliff And how that could be passed to a NativeCall routine?
04:27 teatime if you already have the FILE* returned from something else native, then you can pass to something native like any other pointer.
04:29 Sgeo joined #perl6
04:33 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:35 labster joined #perl6
04:37 BenGoldberg Well, one thing you can do is write: class FILE is repr('CPointer') { }, to make C FILE* pointers easier to deal with...
04:38 teatime I've seen that example before; how does it help over just using OpaquePointer or Pointer ?
04:38 teatime just that you can call it FILE fp in your code?
04:39 skids Maybe because you can add methods?
04:40 teatime ah, that makes sense.
04:40 teatime but you cannot add attributes, or did I mis-understand that?
04:41 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 #perl6
04:42 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.
04:43 skids methods are per-class.
04:43 Cabanossi joined #perl6
04:43 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.
04:45 BenGoldberg 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:46 BenGoldberg 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:48 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:49 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 #perl6
04:56 Ben_Goldberg joined #perl6
04:56 _nadim joined #perl6
04:59 Xliff <teatime> you can get a FILE* from a Perl IO::Handle by passing .native-descriptor to native fdopen()
04:59 Xliff Wow... OK.
04:59 Xliff Working with NativeCall is more .... interesting... than I thought.
05:01 Xliff I hope to avoid making a true class, but it's looking like that might not be in the cards.
05:01 Xliff Mainly because the C API is a wrapper to C++ classes and methods.
05:01 teatime At least, I assume that's true; I haven't tried it.
05:01 Xliff So the C API I am trying to wrap is a struct filled with function pointers.
05:02 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
05:03 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
05:03 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.
05:04 Xliff It's a great learning opportunity, but one that I'm probably not ready for at this moment.
05:10 Xliff Soo....
05:10 Xliff sub fdopen(int, char)
05:10 Xliff is nativelib('libc')
05:10 Xliff returns Pointer { * };
05:11 teatime heh, it appears you're testing my theory :)
05:12 Xliff Yeah.
05:12 nadim joined #perl6
05:12 Xliff I'll let you know if it blows up in my face. It's a good idea, though.
05:12 Xliff Oh.
05:13 Xliff my $a = "/path/to/file"; die "BZZZT!" unless $a.IO.e;  <-- this is valid, right?
05:13 Xliff m: my $a = "/path/to/file"; die "BZZZT!" unless $a.IO.e;
05:13 camelia rakudo-moar b3b24b: OUTPUT«BZZZT!␤  in block <unit> at /tmp/S7_wiTRnjw line 1␤␤»
05:13 Xliff HAH! At least it compiles.
05:13 Xliff I hope the evalbot is protected against IO hacks like that.
05:13 teatime works here.
05:14 Xliff Thanks.
05:14 teatime m: say my $a = "/etc/passwd"; die "BZZZT!" unless $a.IO.e;
05:14 camelia rakudo-moar b3b24b: OUTPUT«/etc/passwd␤»
05:15 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:18 Xliff Ahh crap. Would I need native free() to handle the FILE* once I'm done with it?
05:18 nadim joined #perl6
05:23 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:24 nadim joined #perl6
05:24 teatime and not fclose()'ing would be a mem leak, I beleive.
05:27 awwaiid To read a single line from stdin, should I do $*IN.lines(1).first ?
05:29 awwaiid oh, 'get'
05:44 nadim joined #perl6
05:51 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:56 buharin joined #perl6
05:56 Xliff Oh crap. Using "perl" instead of "perl6" again.
05:57 Xliff Definite sign of sleep deficiency.
06:03 saaki :)
06:05 Xliff It's either that or NativeCall is eating my brain!
06:05 Xliff Probably both.
06:08 CIAvash joined #perl6
06:08 sortiz Xliff, yep  Start learning NC produces these symptoms at first :-)
06:17 rindolf joined #perl6
06:21 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:23 Xliff awwaiid, thanks!
06:23 Xliff OK. How can I specify Unsigned Integer in NativeCall where I do not have to worry about word size of the processor?
06:23 Xliff Will "Int" work regardless of 32-bit or 64-bit processor?
06:25 teatime I imagine Int would map to a signed int?
06:26 teatime if you want a specific size you need to use the uint64_t -style types.
06:27 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'?
06:27 Xliff Shit.
06:27 Xliff Because I can't assume that "unsigned int" is uint64 on a 32 bit lib, right?
06:27 teatime what is it for?
06:28 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 BenGoldberg joined #perl6
06:28 Xliff read(void *, unsigned int) <- I need to convert that to something suitable to nativecall()
06:29 Khisanth joined #perl6
06:29 Xliff nativecall(:(Pointer, uint32)....) would be dangerous on a 64 bit machine.
06:29 Xliff See my problem?
06:29 _nadim joined #perl6
06:29 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
06:30 Xliff It's XQilla's XQC_Input_Stream's method but I am trying to simplify so as to not confuse ppl.
06:31 teatime I see.
06:31 Xliff However, if you really want the confusion....
06:32 Xliff http://xqilla.sourceforge.net/docs/x​qc-api/structXQC__InputStream__s.htm​l#a9dd7b49bdfaf09c4070c43aa5a0e0c66
06:32 sortiz Right now NC don't do that magic, your code should test for that.
06:32 Xliff sortiz: OK. How can I test for word size in P6?
06:32 sortiz You can use, nativesizeof(Pointer) for example.
06:32 Ben_Goldberg joined #perl6
06:32 teatime I don't think that's the question you need to ask.
06:33 Xliff (was worried about that)
06:33 sortiz m: use NativeCall; say nativesizeof(Pointer);
06:33 camelia rakudo-moar b3b24b: OUTPUT«8␤»
06:34 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/sou​rces/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 399…»
06:34 Xliff m: use NativeCall; say nativesizeof(P6Int)
06:34 camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Q4HeewSnmz␤Undeclared name:␤    P6Int used at line 1␤␤»
06:34 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␤␤»
06:34 Xliff m: use NativeCall; say nativesizeof(CPointer)
06:34 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 Xliff m: use NativeCall; say nativesizeof(int)
06:35 camelia rakudo-moar b3b24b: OUTPUT«8␤»
06:35 sortiz And you can only use nativesizeof with native types.
06:35 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 #perl6
06:36 Xliff teatime: Short answer-"Use uint32"
06:36 djbkd joined #perl6
06:37 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:38 teatime I realize that's a rambling and open-ended question, but what would I look up to learn more about these issues?
06:39 teatime Xliff: rather, must be *at least* 2 bytes.
06:39 BenGoldberg Are you cross compileing?
06:40 Xliff BenGoldberg, no.
06:40 Xliff NativeCall module
06:41 Xliff 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
06:41 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.
06:41 Xliff That's the safest route I see.
06:41 teatime yeah, I was just thinking, what I need to read more about probably is shared libraries.
06:41 sortiz Yep, is a difficult question. I recommend to look the code of some projects to see some working solutions.
06:42 BenGoldberg Even in the C world, "int" is only the same both places if the compilers are configured the same.
06:42 teatime yes.
06:42 Xliff sortiz, Yeah. However I don't have time to search *all* of the projects for useful answers.
06:42 Xliff I'm lazy that way.
06:43 Xliff I'd need more detailed directions! =)
06:43 Xliff However, I think I have progressed far enough, today.
06:43 Xliff Much in part due to the help I have found here.
06:43 Xliff Thank you!
06:44 sortiz Te best advice I can give you is to use the *.h file and define and use compatible types. For example see https://github.com/perl6/DBIish/blob/m​aster/lib/DBDish/Oracle/Native.pm6#L11
06:44 Xliff Now to poke at King's Road for a few minutes.
06:44 labster joined #perl6
06:44 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:45 * BenGoldberg just realized it's waaay past his bedtime, g'night folks.
06:45 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 Xliff Well....LOL.
06:46 stmuk_ ugexe: ok thanks
06:47 cpage__ joined #perl6
06:55 kurahaupo joined #perl6
06:57 djbkd_ joined #perl6
06:59 djbkd 3
07:00 djbkd left #perl6
07:13 djbkd_ joined #perl6
07:27 RabidGravy joined #perl6
07:34 firstdayonthejob joined #perl6
07:38 wamba joined #perl6
07:47 domidumont joined #perl6
07:52 domidumont joined #perl6
08:14 darutoko joined #perl6
08:25 RabidGravy Boom
08:25 yoleaux 2 Apr 2016 23:21Z <AlexDaniel> RabidGravy: just in case: if some website is not accepting your myname+spammywebsite@gmail.com email, then use my.n....a...me@gmail.com, because 100% websites accept dots in emails and gmail ignores them all.
08:27 teatime I thought the gmail addr w/o dots was unique from the addr w/ one or more dots
08:27 teatime but all of the one-or-more dots addrs were equiv
08:27 Actualeyes joined #perl6
08:33 pecastro joined #perl6
08:34 keix joined #perl6
08:43 RabidGravy no, I think in the case of gmail the reverse is true
08:45 RabidGravy at least it was
08:47 RabidGravy 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:50 RabidGravy .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 #perl6
08:53 RabidGravy going to have a tinker with Template6 later, looks like he is merging PRs at any rate
08:55 _nadim joined #perl6
08:55 _nadim joined #perl6
09:18 buharin joined #perl6
09:19 geekosaur joined #perl6
09:20 frithnanth joined #perl6
09:24 buharin joined #perl6
09:25 Actualeyes joined #perl6
09:28 dalek star: 377eb1f | (Naoum Hankache)++ | README:
09:28 dalek star: fix typo
09:28 dalek star: review: https://github.com/rakudo/star/commit/377eb1fd2b
09:28 dalek star: 4a0028d | (Steve Mynott)++ | README:
09:28 dalek star: Merge pull request #67 from hankache/patch-1
09:28 dalek star:
09:28 dalek star: fix typo
09:28 dalek star: review: https://github.com/rakudo/star/commit/4a0028d3f4
09:29 buharin joined #perl6
09:29 spider-mario joined #perl6
09:30 buharin_ joined #perl6
09:31 wamba joined #perl6
09:43 cyberviking joined #perl6
09:44 buharin joined #perl6
09:48 cyberviking joined #perl6
09:50 pecastro joined #perl6
09:51 TimToady joined #perl6
09:55 Khisanth joined #perl6
09:58 TreyHarris joined #perl6
10:04 Actualeyes joined #perl6
10:13 buharin joined #perl6
10:13 _nadim Good morning.  Here is something that I find very surprising when using roles and multis http://nopaste.linux-dev.org/?1041278
10:14 _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:16 _nadim what's even more surprising is that I ave another example where the error message is not displayed at all
10:17 _nadim And it doesn't do what I xpect it to either (but that is more open to debate)
10:21 pecastro joined #perl6
10:21 sortiz m: say Array ~~ List; # At first remember that Array is List.
10:21 camelia rakudo-moar b3b24b: OUTPUT«True␤»
10:21 _nadim I certainly do
10:22 _nadim 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.
10:23 _nadim but apart from that expectation, I have another example, larger unfortunately, where the error message is not displayed
10:23 _nadim 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.
10:29 _nadim 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
10:29 psch _nadim: the paste behaves exactly as i'd expect
10:30 psch ...i think
10:30 psch i'll grab another cup of coffee and get back to you... :)
10:33 _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:34 _nadim 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:35 _nadim #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:36 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:38 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␤»
10:39 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])
10:39 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␤␤»
10:39 psch timotimo++
10:40 psch 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);
10:40 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␤␤»
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);
10:40 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␤␤»
10:40 Xliff How would I limit parameter argument to a Str array?
10:40 psch Xliff: depends on how much you want your users to suffer
10:41 psch choices are "not at all" and "a little maybe"
10:41 Xliff psch: It's gotta link to a NativeCall.
10:41 Xliff I think I will have to check manually, then. Thanks.
10:41 timotimo in that case it'll have to be a CArray anyway
10:41 Xliff Yeah.
10:41 psch Xliff: if it's for NativeCall bindings i'd probably expose a wrapper instead of the actual is-native traited sub
10:42 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
10:42 timotimo so you can actually do proper checking there
10:42 buharin joined #perl6
10:42 Xliff Yeah.
10:42 Xliff Figured.
10:42 Xliff It's what I had started doing, then thought "Hey... maybe a better way exists?"
10:43 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␤»
10:43 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.
10:43 psch okay, i think something is weird there
10:43 timotimo hah
10:43 psch .^add_multi + .^compose don't dispatch the same way as directly declaring both multis
10:44 timotimo yeah, you'll end up having composed twice
10:44 psch timotimo: right, but why does adding the multi make it ambiguous?
10:44 timotimo maybe there's some caches or something that keeps data around
10:44 timotimo it could be adding a multi method is about adding a proto rather than just a candidate? not sure.
10:45 timotimo calling .^compose twice may just be a contract validation
10:46 Xliff m: my $a = [1, 2, 3]; for ($a) { .print }
10:46 camelia rakudo-moar b3b24b: OUTPUT«1 2 3»
10:48 Xliff m: my $v = "This"; say $v ~~ Str;
10:48 camelia rakudo-moar b3b24b: OUTPUT«True␤»
10:56 dalek star: 2f64d94 | (Steve Mynott)++ | README.star:
10:56 dalek star: no longer for early adopters
10:56 dalek star: review: https://github.com/rakudo/star/commit/2f64d94440
10:56 rindolf joined #perl6
10:58 Xliff m: say 2^16 - 1
10:58 camelia rakudo-moar b3b24b: OUTPUT«one(2, 15)␤»
10:59 Xliff m: say 2 ** 16 - 1
10:59 camelia rakudo-moar b3b24b: OUTPUT«65535␤»
10:59 Xliff *sob*
11:00 psch m: say 2¹⁶ - 1
11:00 camelia rakudo-moar b3b24b: OUTPUT«65535␤»
11:01 Xliff \o/
11:01 Xliff How did you get superscript!?!??
11:01 lizmat .u superscript
11:01 yoleaux U+00B2 SUPERSCRIPT TWO [No] (²)
11:01 yoleaux U+00B3 SUPERSCRIPT THREE [No] (³)
11:01 yoleaux U+00B9 SUPERSCRIPT ONE [No] (¹)
11:01 Xliff o
11:02 Xliff 2⁴
11:02 Xliff ^_^
11:02 Xliff wincompose++
11:02 moritz welcome to the wonderful world of Unicode :-)
11:05 _nadim Xliff:  if you want to superscribe longer strings, there's a Superscribe role in the Data::Dump::Tree module
11:08 Xliff moritz: Been visiting for a couple of weeks now. Thinking of moving here. :p
11:09 Xliff _nadim, I will have to look into that at some point. Thanks!
11:09 Xliff m: Say 3.1415962.WHAT
11:09 camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/h9iJxqUrvj␤Undeclared name:␤    Say used at line 1␤␤»
11:09 Xliff m: Say (3.1415962).WHAT
11:09 camelia rakudo-moar b3b24b: OUTPUT«5===SORRY!5=== Error while compiling /tmp/P57AOZr4QM␤Undeclared name:␤    Say used at line 1␤␤»
11:09 Xliff m: say 3.1415962.WHAT
11:09 camelia rakudo-moar b3b24b: OUTPUT«(Rat)␤»
11:10 espadrine joined #perl6
11:12 nadim joined #perl6
11:18 cyberviking joined #perl6
11:25 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␤       …»
11:25 Xliff Hrm.
11:26 pierrot joined #perl6
11:26 sortiz m: say 3.1415 ~~ Real;
11:27 camelia rakudo-moar b3b24b: OUTPUT«True␤»
11:27 psch m: use Test; 3.14156 [&isnt] Real
11:27 camelia rakudo-moar b3b24b: OUTPUT«ok 1 - ␤»
11:27 psch ... :S
11:28 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␤      …»
11:29 Xliff m: say 3.14156 ~~ Real
11:29 camelia rakudo-moar b3b24b: OUTPUT«True␤»
11:29 Xliff Oh good.
11:29 psch m: say 3.14156.does(Real)
11:29 camelia rakudo-moar b3b24b: OUTPUT«True␤»
11:30 sortiz m: say 3.1415 ~~ Num; # Num is float
11:30 camelia rakudo-moar b3b24b: OUTPUT«False␤»
11:33 Xliff So is .does() preferred over ~~?
11:34 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.
11:34 psch nadim: fwiw, i think there is something weird somewhere in MMD
11:35 psch nadim: consider the add_multi_method + compose vs declaring both multis in the class body i showed
11:36 psch nadim: seeing as composing a role into a class uses .^add_multi_method it seems related
11:39 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 nadim I also wonder if one can add a multi to an object, like does, rather than a class
11:39 nadim or even add it to a role that is already played by an object (or more)
11:40 psch m: my $x = 42 but role { method foo { "bar" } }; say $x.foo
11:40 camelia rakudo-moar fd29b2: OUTPUT«bar␤»
11:40 psch m: my $x = 42 but role { method foo { "bar" } }; say $x.foo; say 42.foo
11:40 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:52 nadim joined #perl6
12:02 pochi joined #perl6
12:02 dalek DBIish: aab9b69 | (Kaare Rasmussen)++ | / (3 files):
12:02 dalek DBIish: Add pg-socket (interface to Pg's PQsocket).
12:02 dalek DBIish: review: https://github.com/perl6/DBIish/commit/aab9b690e9
12:02 dalek DBIish: 75e53b0 | (Kaare Rasmussen)++ | / (2 files):
12:02 dalek DBIish: Forgot dox
12:02 dalek DBIish:
12:02 dalek DBIish: ... and it probably returns int32.
12:02 dalek DBIish: review: https://github.com/perl6/DBIish/commit/75e53b0a6a
12:02 dalek DBIish: 60d9b0f | (Kaare Rasmussen)++ | README.pod:
12:02 dalek DBIish: ... and change the README to reflect the new pg-notifies name
12:02 dalek DBIish: review: https://github.com/perl6/DBIish/commit/60d9b0fe0b
12:02 dalek DBIish: e92bfde | (Salvador Ortiz)++ | / (4 files):
12:02 dalek DBIish: Merge pull request #61 from kaare/master
12:02 dalek DBIish:
12:02 dalek DBIish: Add pg-socket (interface to Pg's PQsocket).
12:02 dalek DBIish: review: https://github.com/perl6/DBIish/commit/e92bfde89b
12:06 djbkd joined #perl6
12:07 zakharyas joined #perl6
12:11 cpage__ joined #perl6
12:14 edjsu joined #perl6
12:16 BenGoldberg joined #perl6
12:18 dalek DBIish: 306291e | (Salvador Ortiz)++ | lib/DBDish/Pg (2 files):
12:18 dalek DBIish: Pg: Minor cleanup for speed
12:18 dalek DBIish:
12:18 dalek DBIish: Increment driver version reflecting added APIs
12:18 dalek DBIish: review: https://github.com/perl6/DBIish/commit/306291e3c1
12:24 Ben_Goldberg joined #perl6
12:27 edjsu joined #perl6
12:29 hankache joined #perl6
12:29 dalek doc: 23dd053 | (Tom Browder)++ | doc/Language/nativecall.pod:
12:29 dalek doc: change example lib name to agree with the explanatory text
12:29 dalek doc: review: https://github.com/perl6/doc/commit/23dd053c0c
12:29 dalek doc: 16ff534 | (Tom Browder)++ | doc/Language/nativecall.pod:
12:29 dalek doc: Merge pull request #438 from tbrowder/master
12:29 dalek doc:
12:29 dalek doc: change example lib name to agree with the explanatory text
12:29 dalek doc: review: https://github.com/perl6/doc/commit/16ff53422d
12:29 hankache hello #perl6
12:30 hankache anyone using Perl 6 on windows?
12:30 hankache m: my $name = 'Neo'; run 'echo', "hello $name";
12:30 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 #perl6
12:31 hankache this ^^ runs ok on linux but not on windows
12:31 hankache any ideas why?
12:32 timotimo is echo actually a program on windows?
12:33 hankache isn't it the same as linux?
12:34 timotimo i haven't a clue
12:34 hankache me neither :D
12:36 cyberviking joined #perl6
12:36 masak I think `echo` is an internal command in Windows
12:36 masak not an executable
12:37 masak but I would still kind of expect it to work
12:38 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␤␤»
12:38 timotimo you probably have to use shell instead
12:47 hankache shell will not interpolate the variable
12:49 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 '
12:50 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 masak especially relevant with Heroku, I guess, since deployment happens via pushes...
12:50 timotimo have it in your environment? :P
12:50 hankache :)
12:50 teatime on linux, standard shell built-ins usually have executable fallbacks in $PATH
12:51 teatime not so much on windows, I think.
12:51 teatime on *nix, rather.
12:52 sortiz masak, PostgreSQL in particular accepts all connection parameters via environment vars. Can be what you need.
12:52 hankache aha
12:53 cpage__ joined #perl6
12:55 kid51 joined #perl6
12:56 timotimo FWIW, "texas unicode" is still much better than trigraphs ...
12:59 Yary joined #perl6
13:00 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:01 masak sortiz: thank you. yes, I just found the same after some searching.
13:03 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:07 timotimo Yary: i think it's nqp/MoarVM/
13:07 timotimo in there, there's a Configure.pl of its own, just like in nqp/
13:08 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 Yary just didn't want to clone Moar a 3rd time!!
13:08 timotimo moar is - i think - the smallest of the three repositories :)
13:09 Yary I'm at a 5k while my wife runs a 5k, and using cellphone net
13:09 Yary sorry I';m at a cafe
13:10 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 timotimo i run a public access point in my home with sensible throughput limits
13:12 timotimo part of the "freifunk" projectin germany
13:23 Yary_ joined #perl6
13:23 pecastro joined #perl6
13:26 Yary /msg NickServ identify unsecure
13:26 psch ...autopun? :)
13:29 masak self-referential, yes. not sure about autopun.
13:29 masak it's hard to tell sometimes.
13:29 masak 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 #perl6
13:38 masak or if the password was "oops-i-did-it-again"
13:38 Yary everyone can be me
13:39 masak Yary is more of a concept than an actual individual
13:39 masak a way of life
13:39 timotimo a state of mind
13:39 masak a port of call
13:40 timotimo like ships meeting in the middle of the ocean
13:40 cdg joined #perl6
13:43 BenGoldberg Is the middle of the ocean really the best place for ships to be meeting?
13:43 BenGoldberg . o O (The Greay Pacific garbage patch)
13:43 timotimo clearly i'm refering only to the surface between the ocean and the atmosphere
13:44 timotimo "in the middle of the ocean", usually only submarines would meet
13:47 ZoffixLappy joined #perl6
13:49 wtw joined #perl6
13:51 Begi joined #perl6
13:52 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 nadim then I tried to do a ^compose on the object
13:52 psch nadim: .^add_multi_method exists
13:52 nadim psch: thnaks doing that right now
13:53 Yary_ joined #perl6
13:54 nadim and that also eliminated the weird error message I got.
13:56 nadim Well, both lines ^add_multi_method and ^compose compiled but the output is af nothing was done
13:56 BenGoldberg joined #perl6
13:58 nadim I noticed that there was an "is also ..." but that seems t work in the compilation scope only
14:00 psch m: unit class Foo; also is Int;
14:00 camelia rakudo-moar 868d8b: ( no output )
14:00 psch that's just an alternative to 'class Foo is Int { ... }'
14:01 timotimo http://richpreview.com/?url=http://perl6.org/  -  interesting.
14:07 nadim this "oldish" document shows an example where the class can be "re-opened", i just got a re-definition error though.
14:08 timotimo you have to "use MONKEY-TYPING" for that
14:09 nadim is MONKEY-TYPING also necessary for ^add_method and ^compose?
14:09 timotimo no
14:10 timotimo but maybe it should be :)
14:10 nadim that would be more consistent
14:10 nadim but âdd_method and ĉompose did not work for me. Must be doing something wrong
14:11 timotimo haha
14:11 timotimo i don't think we support grabbing the combining ^ out of the method name :)
14:11 timotimo m: class Test { method ârgh { say "argh" } }; Test.ârgh()
14:11 camelia rakudo-moar 868d8b: OUTPUT«argh␤»
14:11 nadim lol, I meant ^compose, ...
14:12 ZoffixWin Would someone smarter than me review this commit? I don't think the "lib" prefix is needed, as it's added automatically: https://github.com/perl6/doc/pull/438
14:12 average joined #perl6
14:12 average the writer lock: http://i.imgur.com/9TNI5zT.jpg ; the reader lock: http://i.imgur.com/zORWzNw.jpg ;
14:12 average does Perl6 have concurrency features in place ?
14:12 average like locks ^^
14:13 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: http://docs.perl6.org/language/concurrency
14:14 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 :)
14:15 average ZoffixWin: is there some unanimous decision that promises/supplies/channels are better than classic locks/threads/mutexes/sema​phores/barriers/spinlocks ?
14:15 timotimo as in: if you use that stuff, it's on you if things break
14:17 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
14:18 timotimo at least i think that's the case
14:18 timotimo the normal workflow is .new_type, .add_method, .compose
14:18 average can Perl6 have a distributed job queue implementation ?
14:19 average like celery or sidekiq ?
14:20 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 timotimo sounds like something for the ecosystem
14:24 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:25 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
14:25 mst I don't see anything about that above, just about your finding that add_method wasn't helpful
14:25 timotimo that's from earlier (today?)
14:26 timotimo http://irclog.perlgeek.de/p​erl6/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
14:27 timotimo i didn't actually evaluate that paste, because ... engh. so i don't know what the results were
14:27 timotimo 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
14:27 timotimo in the case of a supported paste site, i find it helpful to directly have camelia evaluate it on-channel
14:28 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 mst where by 'that' I mean http://nopaste.linux-dev.org/?1041278
14:28 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 ;
14:28 camelia rakudo-moar 868d8b: ( no output )
14:28 timotimo darn, got a newline in there
14:29 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; $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␤␤»
14:29 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.
14:30 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 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'} ; } ; 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]);
14:30 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␤»
14:30 timotimo like that
14:31 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
14:31 camelia rakudo-moar 868d8b: OUTPUT«list␤array␤»
14:31 nadim that's the error I talked about earlier
14:31 timotimo oh, i know
14:31 timotimo 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
14:32 psch m: class A { multi method m(List $) { }; multi method m(List $) { } }
14:32 camelia rakudo-moar 868d8b: ( no output )
14:32 timotimo roles getting applied to a class are allowed to completely overwrite/override a multi method candidate
14:32 timotimo m: say List.^mro; say Array.^mro # checking something
14:32 camelia rakudo-moar 868d8b: OUTPUT«((List) (Cool) (Any) (Mu))␤((Array) (List) (Cool) (Any) (Mu))␤»
14:32 mst nadim: ok, so, that doesn't answer my question
14:33 mst nadim: I am asking that, if you try what I propose, do you then get the behaviour you want?
14:33 mst nadim: external restrictions on your design that you haven't mentioned before are separate, since you hadn't mentioned them before.
14:33 * timotimo AFK for a bit
14:33 mst nadim: so, please, does what I propose work for you?
14:36 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.
14:36 mst nadim: what happens if you compose the two roles and *then* compose them into the class?
14:38 mst 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.
14:39 nadim 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.
14:39 nadim OK
14:40 khw joined #perl6
14:40 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.
14:40 psch nadim: what exactly are you trying to do?
14:41 psch or maybe, what are you trying to achieve with what you're trying to do..? :)
14:41 average please take it to #p6drama
14:41 nadim override a multi method
14:41 nadim average++
14:41 mst yes, but why? what would that gain you?
14:42 mst average: please remember that larry shouted at you the last time you attempted to troll in here and drop it.
14:44 mst 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 mst understanding the original problem may make it easier for people to suggest approaches, is all
14:45 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:46 mst I was just expanding on the 'achieve' part of psch's question that you apparently missed :(
14:50 mst can somebody tell me what 'read the oc' means?
14:50 mst ... oh, read the odc, probably
14:50 mst right, do next question, where do I look up the repo?
14:50 psch mst: panda look
14:50 psch alternatively where it's hosted
14:51 mst oh, ecosystem repo -> main repo?
14:51 psch i'd go via http://modules.perl6.org
14:51 mst aha
14:52 psch that links directly
14:52 mst sorry, not got the perl6 versions of this stuff in muscle memory yet
14:52 psch from ecosystem you have to mangle the raw.githubusercontent.com link
14:52 psch at least afair, maybe there's something that links to the web interface for github, but i don't think so
14:53 mst right, so, looking at https://github.com/nkh/P6-Data-Dump-Tree
14:54 mst it seems to me that the goal here is to let the user provide customised parts of dumping code
14:54 mst which totally makes sense
14:54 mst but in that case, it's not really exactly subclassing
14:54 mst subclassing would by default involve overriding, which is why it's doing the wrong thing
14:55 mst 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 mst and basically an API of
14:55 mst argh, I forget the exact syntax, but
14:55 mst my $dumper_type = MyRole with DumperRole;
14:55 ugexe but Dumper Role; arhaksjdghafa!!!!!!!
14:56 mst and then $d = $dumper|_typew.new() relying on the type punning from role to class
14:56 mst should basically DTRT
14:57 infina joined #perl6
14:58 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
15:02 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:03 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 mst whether or not that would've just been a differently bad idea I've no idea since we never got round to it ;)
15:03 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 #perl6
15:05 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
15:06 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:07 mst maybe you can make 'role does MyRoleClass[::ANOTHER] does ANOTHER {}' ?
15:08 timotimo oh lord :)
15:09 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/r​untime/CORE.setting.moarvm:print_exception)␤ from gen/moar/m-CORE.setting:21361  (/home/camelia/rakudo-m-inst-1/share/…»
15:10 mst ugexe: oooh, I see
15:10 ugexe you can add a method BUILDALL(|) { self does T; nextsame; };, but ehhh
15:10 mst and then you're applying the role every time, right?
15:11 ugexe yeah
15:12 mst which has all of its own possible complications, I'd imagine
15:12 mst certainly does over in dinosaur country where I love
15:13 timotimo role application goes through a cache if i'm not mistaken
15:13 timotimo can someone check that?
15:14 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 { }`
15:14 mst but the rules here for 'role applied to object' maybe different than I'm used to
15:16 dvinciguerra joined #perl6
15:17 sue joined #perl6
15:18 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␤»
15:19 timotimo i think you want to (self but T).callsame or something?
15:19 psch yeah, for actually-useful purposes definitely :)
15:19 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
15:19 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…»
15:20 psch oh
15:21 psch "role MyRoleClass[::ANOTHER-ROLE] does ANOTHER-ROLE { }" <- so those are different ANOTHER-ROLEs?
15:22 ugexe no, but i should have said `role MyRoleClass[::ANOTHER-ROLE] does ANOTHER-ROLE does Contract { }` to be more specific
15:22 ugexe where ANOTHER-ROLE is expected to supply a part of Contract
15:23 araujo joined #perl6
15:23 mst is it possible to make a thing that accepts the parameterisation and builds a non-parameterised role from outside?
15:24 mst like ... sub foo ($r) { MyRoleClass does $r does Contract { ... } }
15:24 timotimo sounds like building a closure
15:24 * mst often has 'sub new_with_plugins (@plugins, %new) { Moo::Role->create_class_with_roles($class, @plugins)->new(%new) }' roughly in perl5
15:25 arnsholt You can programmatically mix in roles using the MOP
15:25 arnsholt Gimme a sec and I'll dig up an example
15:25 ugexe if you try to role XXX { self.^add_role(..); self.^compose; } it gives the same error
15:25 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
15:25 mst ugexe: note, totally unsure if my noodling is actually helping you but I'm trying to become less stupid
15:26 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
15:27 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 #perl6
15:34 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 timotimo oh, good idea ugexe
15:37 timotimo i always forget that the role body runs at composition time
15:37 average left #perl6
15:37 timotimo but why is there a mixin of T *and* a mixin of Contract?
15:38 timotimo i thought the reason to have this was to be able to put Contract in as Foo[Contract]?
15:39 mst could you .^mixin(Contract but T) ?
15:40 ugexe no, i want Foo[Fulfills-Part2-Of-Contract] does Contract { method contract-p1 { .contract-p2(); }; };
15:41 timotimo oh, sorry
15:42 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…»
15:42 psch m: role R { method foo { "bar" } }; role S[::T] { method baz { T.foo() } }; S[R].new.baz.say
15:42 camelia rakudo-moar 868d8b: OUTPUT«bar␤»
15:43 psch so Foo[Bar] never implemented any of Bars methods itself
15:44 psch why explains why it doesn't override the stub
15:44 psch m: role R { method foo { "bar" } }; role S[::T] { method baz { .foo() } }; S[R].new.baz.say # seeing as this doesn't work
15:44 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 #perl6
15:48 ugexe `my role TypedArray[::TValue] does Positional[TValue] {` is valid anyway
15:50 Khisanth joined #perl6
15:54 psch right, and Positional is your Contract in that bit
16:07 edjsu joined #perl6
16:19 Ven joined #perl6
16:24 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 TreyHarris Mac or in a Heroku instance or Docker container or whatever, I don't care.)
16:24 Khisanth joined #perl6
16:31 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:35 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:36 YP-QMUL-W joined #perl6
16:39 xiaomiao TreyHarris: for json I'd use postgresql
16:39 xiaomiao why use NoSQL when you can have YesSQL :)
16:42 Relsak joined #perl6
16:43 hankache joined #perl6
16:43 masak fwiw, the discussion we had the other day about heterogenous data in a postgres column -- I went with JSON for that :)
16:46 TreyHarris joined #perl6
16:52 YP-QMUL-W joined #perl6
16:55 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 hankache joined #perl6
16:57 orbus out of curiousity, how big is an "enormous" JSON files?
16:57 orbus file*
16:57 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
16:57 mst TreyHarris: recent pg with the full on json support tends to be nice
16:58 TreyHarris mst: oh! didn't even know about that
16:58 mst TreyHarris: xiaomiao did try to tell you a minute ago
16:58 orbus also, if you only need to get stuff out of it once, setting up a database seems like overkill
16:58 orbus unless you just want to for fun
16:58 TreyHarris mst: my ISP fell off the net
16:58 mst orbus: you might only need to run the *final* queries once
16:59 mst TreyHarris: ooh, sorry, I'd missed the disco/reco, yeah, it was just before you felloff from this end so
16:59 TreyHarris mst++
16:59 orbus well true
16:59 orbus I don't know how like jq performs on very large files
16:59 mst orbus: but for exploratory stuff, jamming it into a scratch monkey^Wtable and then running SELECTs is great
16:59 orbus may try to slurp the whole thing into memory
17:00 orbus I don't disagree - just that setting up a database is nontrivial
17:00 orbus although postgres isn't too hard to setup really
17:00 orbus if you've done it before
17:00 mst I can safely assume that TreyHarris has heard of postgresql before now.
17:00 xiaomiao 'sane defaults'
17:00 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)
17:01 TreyHarris 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
17:01 TreyHarris yes, I am familiar with postgres, very. one might say "too well". :)
17:01 RabidGravy I have a thing that loads up the projects.json
17:02 RabidGravy 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" :)
17:02 orbus lol
17:03 orbus I setup mongo one time and poked at it a bit - it's json-ish
17:03 orbus probably need to write a script to trawl through your file and put things into the database
17:03 orbus I'm unfamiliar with couch
17:03 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
17:04 orbus I haven't messed with postgres json support much
17:04 orbus but they've been expanding it in recent versions
17:04 TreyHarris orbus: that was the attractive thing about couch was that you literally just say, "here's a json structure, you figure it out"
17:04 orbus neat
17:04 TreyHarris like it makes certain... uh... JSON... inferences....
17:04 * TreyHarris looks at his feet and shuffles a bit
17:05 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
17:05 orbus although maybe geared towards many small documents, not one big one
17:06 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:07 orbus there's lots of things that still need perl6 interfaces
17:07 orbus the main reason I'm not using perl6 more is we're still primarily a solaris shop
17:07 Ulti postgres json stuff is only really useful if you have many small records of JSON with shared keys
17:08 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
17:09 orbus if you already have postgres up and running (and it's 9.4 or even better 9.5), give that a shot
17:10 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 doc: 66041cc | (Zoffix Znet)++ | doc/Language/nativecall.pod:
17:10 dalek doc: Clarify library name usage
17:10 dalek doc:
17:10 dalek doc: Reverts #438
17:10 dalek doc: review: https://github.com/perl6/doc/commit/66041cc228
17:11 * orbus remains unconvinced of the merits of vr
17:11 orbus it's a neat fad though
17:13 RabidGravy to be fair the idea has been around for a good twenty years
17:13 orbus http://tinyurl.com/anarzsv
17:13 * Ulti remains unconvinced of the merits of 3D graphics or the internet it's a neat fad though
17:13 orbus I don't really find those examples comparable
17:14 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 TreyHarris :)
17:14 RabidGravy :)
17:14 TreyHarris So, more like 25 years....
17:15 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
17:15 Ulti not until AR no
17:15 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
17:15 psch yeah, a non-douchy-looking google glass would be amazing
17:15 Ulti you could have said the exact same thing about car phones from the 80s too
17:16 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
17:16 psch but AR applications are ridiculous
17:16 orbus AR I can see
17:16 orbus eventually
17:17 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 TreyHarris orbus: I really thing it would be a fantastic thing for something like nagios to support
17:17 orbus difficult for me to visualize - is it really that much better than a large monitor?
17:17 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 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 Ven joined #perl6
17:18 awwaiid all my friends make fun of me for staring at blank walls, but I tell them I'm practicing
17:19 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 TreyHarris this is that with hundreds of stacked graphs at once usable and useful
17:19 orbus sure, but I guess my question is, are vr goggles necessary to make a useful graph
17:20 orbus they don't see to me to add anything to that
17:20 orbus seem*
17:21 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
17:21 orbus I expect vr goggles would do the same
17:21 orbus so that may be coloring my view
17:21 masak orbus: same here.
17:22 ZoffixWin orbus, are you colorblind? That may be why 3d glasses don't work.
17:22 orbus not that I know of
17:22 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
17:22 ZoffixWin But VR goggles are an entirely different technology. So it'll work.
17:23 orbus I do wear glasses though
17:23 ZoffixWin *shrug*
17:23 orbus that may be causing problems
17:23 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.
17:24 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.
17:24 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
17:24 TreyHarris timotimo: yep, in progress, we'll see how that goes.
17:24 timotimo cool
17:24 orbus if these things ever get out of the early adopter niche, I'll give it a try
17:25 orbus 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.
17:26 timotimo http://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 :)
17:26 orbus snow crash :p
17:27 TreyHarris ZoffixWin: I've been waiting 25 years :)
17:27 ZoffixWin lol
17:27 timotimo did you get the original Virtual Boy? :)
17:27 orbus my brother had one
17:28 orbus 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 #perl6
17:28 timotimo :D
17:29 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?
17:29 TreyHarris lol, 4 MILLION pixels
17:29 timotimo does that mean 45 fps on each eye, or 90 fps on each eye?
17:30 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.
17:30 timotimo wasn't the virtual boy vector-based?
17:30 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.
17:30 orbus the graphics were yeah
17:30 orbus and it was monochrome
17:30 orbus red and black
17:31 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
17:31 timotimo TreyHarris: i don't think anything achieves that right now ... isn't that a bit high? where did you get these numbers?
17:31 masak in block  at /home/masak/ours/rakudo/install/share/perl6/site/​sources/F51B76EA668B2C3E5C8704F71C1F2DD75D6CCF4B line 46
17:31 TreyHarris at UNC, we actually strapped two high-definition CRTs to people's heads. CRT's are fast :)
17:32 masak wow, that's a whole long line of nothing
17:32 masak not only are those generated paths not very pretty, they're also quite bad at telling you where the error happened
17:32 timotimo masak: huh, aren't we supposed to give the logical name of that?
17:32 stmuk_ https://bugs.debian.org/cgi-​bin/bugreport.cgi?bug=819703 .. maybe perl 6 should warn :)
17:32 masak timotimo: that would help, yes
17:33 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?
17:33 masak This is Rakudo version 2016.02-147-g42fb81d built on MoarVM version 2016.02-32-g79dce11
17:33 timotimo gotta go AFK for a bit
17:33 TreyHarris orbus: lol, no, the crts were actually behind the cranium and reflected around with mirrors and lenses.
17:34 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
17:35 TreyHarris smaller was easier, obviously, so that was a small advantage...
17:35 TreyHarris ah, good times :)
17:35 zacts joined #perl6
17:35 orbus indeed
17:36 orbus well good luck with your json problem - time to grab food
17:36 TreyHarris thankee sir
17:36 rindolf joined #perl6
17:42 john51 joined #perl6
17:48 Skarsnik joined #perl6
17:57 pmurias joined #perl6
18:00 edjsu joined #perl6
18:08 wtw joined #perl6
18:10 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:11 timotimo oh, does it compile-time-evaluate parts of stuff?
18:11 timotimo that's weird
18:11 nadim joined #perl6
18:15 moritz class GLOBAL::X::DBDish::ConnectionFailed is X::DBDish::DBError {
18:15 moritz wtf?
18:16 arc__ joined #perl6
18:16 arcetera joined #perl6
18:32 vsdfs joined #perl6
18:34 Ven joined #perl6
18:38 masak next fun one: Method 'allrows' not found for invocant of class 'DBDish::Pg::StatementHandle'
18:38 Vlavv_ joined #perl6
18:39 hankache_ joined #perl6
18:40 masak unless I'm reading things very wrongly, DBDish::Pg::StatementHandle inherits from a role DBDish::StatementHandle that implements such a method
18:40 masak m: role R { multi method foo() { say "OH HAI" } }; class C does R {}; C.new.foo
18:40 camelia rakudo-moar 868d8b: OUTPUT«OH HAI␤»
18:40 masak basically that situation, but with more multi methods, more namespaces, and more files
18:44 Begi Could I add it in the Perl 6 ecocsystem as a module ? https://github.com/Emeric54/p6-text-cesar
18:44 Begi it's still a WIP for now
18:44 masak Begi: do the tests pass?
18:45 masak oh, 001-load.t :/
18:45 Begi masak: I've only one test for now :-)
18:45 pecastro joined #perl6
18:45 Begi I'll add new tests
18:46 masak suggestion: https://github.com/Emeric54/p6-text-ce​sar/blob/master/lib/Text/Cesar.pm6#L17 -- prefer 'eq' here, not '~~'
18:46 masak since we know both sides are Str
18:46 masak better to be specific and convey more intent
18:46 masak the rest of the code looks very nice and clean
18:47 masak 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
18:47 masak not*
18:48 RabidGravy I'm actually eyeing the 600 modules target in the next few days :)
18:49 Begi ok, I'll change that
18:49 Begi masak: the prepare sub removes punctuation and uppercase the text
18:53 RabidGravy It has taken some four months to add the 100 modules since the 500 in the first week of January
18:53 RabidGravy MORE!
18:53 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?
18:53 RabidGravy so under 1 a day
18:53 masak Begi: I happen to like punctuation... :)
18:54 masak huh! the DBIish thing works fine outside of my Bailador app... :/
18:55 masak yep -- confirmed
18:56 * masak rebuilds his rakudo and panda and everything, Justin Case
18:57 RabidGravy punctuation rendered in the crypted text provides for easier decryption solutions
18:58 masak you do realize that we're talking about Caesar cypher here, right?
18:58 masak cipher*
18:58 masak it's basically one step up from ROT13
18:58 RabidGravy yes
18:59 RabidGravy 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
19:01 RabidGravy but in a substitution cypher leaving the punctuation adds an additional pattern with which to attack the encryption
19:01 jameslenz joined #perl6
19:01 masak Begi: I think RabidGravy has a point. leave it as it is, I think :)
19:02 Begi yes, it's what I'm gonna to do :)
19:03 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:07 masak yep -- after a full rebuild, still getting "Could not locate compile-time value for symbol DBError"
19:07 masak also, out of curiosity -- I got "Bailador:ver<*>:auth<>:api<> already installed" from Panda.
19:07 yqt joined #perl6
19:08 masak apparently panda-installed modules seem to survive a full rakudo rebuild these days.
19:08 masak 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 #perl6
19:13 Relsak joined #perl6
19:15 timotimo i think if you just re-build from the core setting, you'll force everything to be re-precompiled
19:16 masak I'm getting "Could not locate compile-time value for symbol DBError"
19:16 masak I think I'm not quite clear why I'm getting that error
19:16 timotimo try --optimize=0?
19:16 timotimo or even =off
19:17 timotimo or even better: stagestats
19:17 timotimo that'll tell us if the optimizer is at fault
19:17 masak note that this only happens when I run stuff through Bailador
19:17 masak trying with --optimize=off
19:17 masak yes, same error
19:18 masak what's "stagestats"? do you mean I should do --optimize=stagestats?
19:18 timotimo huh, ok
19:18 timotimo nah, just --stagestats
19:18 masak ok
19:18 masak yeah, it goes all the way to runtime
19:18 timotimo interesting
19:18 masak the failure is when I hit the site
19:36 skids joined #perl6
19:39 geraud joined #perl6
19:48 masak ugh. I would like to help more with this. submit a bug report or something.
19:48 masak clearly Bailador and DBIish are having some problem working together right now.
19:50 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.)
19:51 masak and I simply don't know how to rakudobug that.
19:51 pomJ joined #perl6
19:51 masak you hear that, #perl6? after 8 years of bug reporting, you've finally got me stumped.
19:51 timotimo wowza
19:51 timotimo a major milestone!
19:51 DrForr Hold on, I want to write this down.
19:52 masak this is a bug SO WEIRD... that I don't even
19:52 lizmat finish your sentences?
19:53 * 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:54 masak mst: is "toucan" a euphemism here? do I want to know? :P
19:55 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.
19:55 masak hold on -- maybe I can inline large parts of Bailador into my script... yeeeees...
19:56 timotimo hah :)
19:56 masak it's a one-in-a-million shot... but it just might work...
19:58 pomJ joined #perl6
19:58 skids lizmat: http://knowyourmeme.com/mem​es/what-is-this-i-dont-even
19:59 masak timotimo: oh! after upgrading rakudo, it does tell me what module that grotesque file name corresponds to
20:00 mst masak: quick, blindfold yourself and stand on one leg while you do it
20:00 timotimo masak: nice :)
20:02 wamba joined #perl6
20:06 masak yes, this seems like a viable way forward
20:07 lizmat skids: thanks
20:07 masak I now have the bug reproduced but with most of Bailador.pm in my script
20:07 timotimo that's a good way forward
20:07 masak too tired to continue now, though
20:07 masak 'night, #perl6
20:07 Begi ++ masak
20:07 lizmat night masak
20:08 timotimo gnite masak :)
20:18 BenGoldberg joined #perl6
20:18 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:19 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 timotimo when you have "our" instead, it'll be registered in the package
20:19 ufobat i guess MyClass::foo() is not working but MyClass::bar is, i coundnt find the documentation
20:19 timotimo http://doc.perl6.org/syntax/our - did you find this?
20:20 timotimo hm, the declaration there is a bit weird
20:20 timotimo says "symbol table"; i'd call it "package" instead
20:20 ufobat but its only about variables.
20:20 ufobat after reading that i still felt unsure
20:20 timotimo oh, good point. it's not clear that it generalizes to everything else
20:21 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 #perl6
20:26 ufobat yeah. but at least i was not unsure about that behavior :)
20:29 dalek ecosystem: 46c520b | Emeric54++ | META.list:
20:29 dalek ecosystem: Update META.list
20:29 dalek ecosystem:
20:29 dalek ecosystem: See : https://github.com/Emeric54/p6-text-cesar
20:29 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/46c520b961
20:29 dalek ecosystem: 4429945 | azawawi++ | META.list:
20:29 dalek ecosystem: Merge pull request #188 from Emeric54/patch-1
20:29 dalek ecosystem:
20:29 dalek ecosystem: Update META.list
20:29 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/44299453f2
20:33 jantore joined #perl6
20:35 arc__ joined #perl6
20:35 arcetera joined #perl6
20:39 jantore joined #perl6
20:50 spanner joined #perl6
21:07 Begi1 joined #perl6
21:24 Xliff Hrm... here's one for ya!  Cannot locate symbol '' in native library ''
21:24 Xliff May need to see if I can add a test to NativeCall and see if it works.
21:31 Skarsnik weird
21:35 Xliff Yeah,.
21:35 Xliff It's a C lib I'm trying to wrap.
21:35 Xliff That wraps a C++ class. Does so by using a struct of callbacks.
21:35 Xliff So...
21:36 Xliff my &func_sig = nativecast(:(XQC_Implementation_s, Pointer, XQC_StaticContext_s, Pointer --> XQC_Error), $!prepare_file);
21:36 Xliff Humm... wrong example. That one I know doesn't work. Has a problem with XQC_Error which is an enum.
21:36 Xliff So I moved to this:
21:36 Xliff my &func_sig = nativecast(:(XQC_Implementation_s, str, Pointer, Pointer --> int32), $!prepare);
21:37 Xliff 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
21:37 Xliff my $err = &func_sig(self, $expr, 0, $xpr);
21:37 Skarsnik and cast with it?
21:37 Xliff Yeah. That's the thing.
21:38 Xliff The struct is set up via ONE C call.
21:38 Xliff And then it is supposed to be all setup and usable via the callbacks.
21:38 Xliff $!prepare is one of those callback values.
21:38 Skarsnik without the full code is hard to see
21:38 Xliff Hence the use of nativecast() on it.
21:39 Xliff Skarsnik, I was hoping my small test would work and I would then upload it to GH.
21:39 Xliff But it doesn't, and I'm loathe to put non-working crap on GH.
21:39 Xliff Lemme pastebin it.
21:39 dalek doc: b359168 | (Wenzel P. P. Peppmeyer)++ | doc/Language/setbagmix.pod:
21:39 dalek doc: partial fix for #428
21:39 dalek doc: review: https://github.com/perl6/doc/commit/b359168750
21:39 MadcapJake What's the point of putting a bunch of callbacks in a struct?
21:40 Skarsnik sqlite3 does that
21:40 MadcapJake Why? What benefit does it bring? Just smaller param lists?
21:42 Xliff http://pastebin.com/jaN7zqg6
21:42 Xliff MadcapJake, provides a CPP like interface to C.
21:43 labster joined #perl6
21:43 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.
21:43 Xliff I chose this route because I can't find much on NativeCall and C++ support.
21:43 Xliff Namely, what I've found says it doesn't.
21:44 Xliff And I really only need a subset of this library. (XQilla)
21:45 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
21:48 Skarsnik well it's generated by gptrixie MadcapJake x)
21:48 MadcapJake Skarsnik: ah! that's why :P
21:48 MadcapJake Skarsnik: why do you generate the DESTROY submethods? I thought that those don't work on non-GC'd stuff (nativecall stuff)
21:49 Skarsnik the whole code is not from gptrixie, the enum are x)
21:49 MadcapJake oh :P
21:54 Skarsnik maybe I could generate code for callback?
22:01 Xliff MadcapJake: In that situation (the enums) I didn't think a <> construct would be compatible.
22:02 Xliff So I left the enums.
22:02 Xliff And you have no idea how long it took me to get gptrixie working.
22:02 Xliff I'm amazed I am where I am at this point into the project. I started on Wed.... I think.
22:02 Xliff Maybe Thursday.
22:04 Skarsnik what was the issue with gptrixie?
22:05 timotimo it's too awesome
22:10 timotimo why the F does my script here only get 50% cpu usage in "time"?
22:11 arnsholt Multi-CPU?
22:12 timotimo no
22:12 timotimo it crashes and writes a core dump
22:12 arnsholt Odd
22:12 timotimo without telling me, because "time" makes it invisible
22:12 arnsholt Ain't UNIX great =)
22:13 timotimo it's f-ing fabulous
22:18 arnsholt Although I guess that particular problem occurs on Windows as well
22:18 arnsholt It's the responsibility of the program that calls exec() to check how the child exited
22:20 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:21 timotimo when it forks, does it cease to be the same program? :P
22:21 Juerd But you're right if s/exec/fork/ :)
22:22 Juerd timotimo: Hmmm :)
22:23 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:24 kjk_ joined #perl6
22:24 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.
22:24 Xliff 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.
22:25 Xliff I may have to wait until NativeCall supports C++ and go the long way to do what I want... *sigh*
22:26 Xliff Maybe I will try libXML.
22:26 timotimo did you read hoelzro's blog post about how he binds c++ with NC?
22:26 Xliff But I just don't think that has the selector support I need to do that.
22:26 Xliff timotimo, No. I haven't. Can you paste link?
22:26 timotimo http://hoelz.ro/blog/bindi​ng-to-cpp-with-nativecall
22:26 Xliff Thanks. Maybe I will start a fork of my own project. LOL!
22:28 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…»
22:28 kjk_ p6: sub two(-->2) {}; say two;
22:28 camelia rakudo-moar 868d8b: OUTPUT«2␤»
22:28 kjk_ p6: sub one(-->1) {}; say one();
22:28 camelia rakudo-moar 868d8b: OUTPUT«1␤»
22:29 kjk_ hi, why can't the sub one can't be called without () while two can?
22:30 timotimo because one's already a built-in sub
22:30 timotimo m: say one 1, 2, 3
22:30 camelia rakudo-moar 868d8b: OUTPUT«one(1, 2, 3)␤»
22:30 timotimo apparently we don't properly notice it's been overriden
22:31 kjk_ oh~~ ic..., thanks, was just wondering.
22:32 hahainternet joined #perl6
22:33 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 …»
22:33 timotimo m: sub say() {}; say
22:33 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…»
22:34 timotimo yeah, we should not give the error message if the user has made their own version
22:35 kjk_ yah i was expecting my version to be called instead.
22:35 timotimo m: sub one(-->1) {}; say one();
22:35 camelia rakudo-moar 868d8b: OUTPUT«1␤»
22:35 timotimo well, your version is called
22:35 timotimo it's just not parsed correctly
22:38 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) {};…»
22:38 kjk_ but looks like it tries to call another one sub that expects arguments, not mine.
22:41 timotimo the "SORRY!" tells you it's compile-time
22:41 timotimo so no calling happening yet
22:44 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
22:45 timotimo 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;
22:45 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 #perl6
22:48 kjk_ ic, is this an known issue or should i open a bug report somewhere...
22:49 timotimo not sure; you'd have to look in rt.perl.org if it's already there; submission is done via email via rakudobug@perl.org
22:51 timotimo is someone with a clue of C around?
22:52 timotimo i want to turn an MVMCollectable ** into a char * so i can bytewise advance the pointer with an offset i calculated myself
22:52 timotimo is char *rawpointer = (char *)firstitem; the right incantation for that?
22:53 dvinciguerra joined #perl6
22:53 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
22:53 camelia rakudo-moar 868d8b: OUTPUT«(sub one (+ is raw) { #`(Sub+{<anon|63744640>}|75101424) ... })␤»
22:53 timotimo arnsholt: but i am
22:53 BenGoldberg m: multi sub one(-->1) {}; &one.candidates.say
22:53 camelia rakudo-moar 868d8b: OUTPUT«(sub one ( --> 1) { #`(Sub+{Callable[Int]}|66513144) ... })␤»
22:53 timotimo arnsholt: why wouldn't i?
22:54 arnsholt Well, because you'd be twiddling the individual bytes of the pointers to your collectables
22:54 Xliff timotimo, your incantation is correct.
22:54 BenGoldberg m: multi sub one(-->1) {}; &one.candidates.[0].().say
22:54 camelia rakudo-moar 868d8b: OUTPUT«1␤»
22:54 BenGoldberg m: multi sub one(-->42) {}; &one.candidates.[0].().say
22:54 camelia rakudo-moar 868d8b: OUTPUT«42␤»
22:54 timotimo arnsholt: this function is supposed to take a "how far are these pointers apart" argument
22:54 arnsholt If you want to offset into the list of collectables "firstitem+1" will be the second item
22:54 BenGoldberg m: multi sub one(-->42) {}; &one.candidates.[1].().say
22:54 camelia rakudo-moar 868d8b: OUTPUT«Cannot find method 'Nil'␤  in block <unit> at /tmp/hb9LkBa3_o line 1␤␤»
22:54 Xliff At least as far as I understand it.
22:55 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
22:55 camelia rakudo-moar 868d8b: OUTPUT«Nil␤»
22:55 dvinciguerra_ joined #perl6
22:55 BenGoldberg m: Nil.say;
22:55 camelia rakudo-moar 868d8b: OUTPUT«Nil␤»
22:55 arnsholt timotimo: I highly doubt you'll ever want to offset fractional pointer sizes into a list of things, FWIW
22:55 Xliff timotimo, this is also assuming I understood you correctly and that you want to use char math to compute your offsets.
22:57 Xliff 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.
22:57 Xliff sizeof(char) then.
22:57 arnsholt Yeah, I was about to say the same
22:57 BenGoldberg Shirley the C compiler is utf-unaware.
22:58 timotimo yeah, because i also calculated ((char *)&slots[1]) - ((char *)&slots[0])
22:58 teatime sizeof(char) is always 1 byte.
22:58 timotimo as the number of bytes to add
22:58 timotimo but i've thrown the offset thing out now
22:58 Xliff OK. Then my qualifier was unnecessary.
22:59 labster joined #perl6
22:59 Xliff So is this error:
22:59 Xliff Cannot locate symbol '' in native library ''
22:59 Xliff A result of nativecast not finding the right symbol due to the use of callback pointers?
23:00 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
23:01 timotimo an anonymous union defined inside a struct
23:01 timotimo not sure if i can ask C for the sizeof that thing_type
23:01 arnsholt You can use sizeof on attributes as well
23:01 timotimo oh, neat.
23:01 arnsholt It's uncommon, but perfectly legal. Should work for this case (but I'd make sure it does, FWIW)
23:02 arnsholt Though note that for arrays the semantics for sizeof are slightly different (and escape me ATM)
23:02 arnsholt (sizeof(a_variable), that is)
23:02 timotimo my code no longer crashes, nice
23:02 timotimo so i did do something wrong
23:03 timotimo 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 =)
23:04 arnsholt Anyways, bedtime for me
23:04 timotimo i should have adhered to YAGNI
23:04 * arnsholt & # zzz...
23:04 timotimo good night arnsholt, and thanks for the help :)
23:06 vendethiel joined #perl6
23:23 Ben_Goldberg joined #perl6
23:25 Ben_Goldberg joined #perl6
23:44 vendethiel joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo