Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-04-11

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:01 Xliff ZoffixWin, for this task it's worlds better than gvim.
00:02 Xliff I will go back when I am actually working in P6 instead of gptrixie'd files.
00:02 ZoffixWin :)
00:02 Xliff What took me an hour in gvim I just finished in 5 minutes with Sublime.
00:02 * Xliff ♥s Sublime.
00:02 Xliff gvim is muscle memory.
00:02 khisanth_ joined #perl6
00:02 Xliff skink,  OK. will retest in a sec.
00:04 Xliff Commit f333b99 - Still getting 0xc1 error
00:05 Xliff 38328 bytes - crypt_blowfish.dll
00:05 Xliff Correction 38382 bytes - crypt_blowfish.dll
00:06 Xliff Damned dyslexia!!! o(≧o≦)o
00:06 skink acj
00:06 skink ack*
00:08 Xliff int64_t vs int64
00:09 * Xliff shakes fist at gptrixie.
00:09 Xliff *sigh* -- now to figure out test cases for libogg....
00:16 skink Can anyone familiar with cross-compiling figure out how to make a shared Windows lib out of this?
00:16 skink http://www.openwall.com/cryp​t/crypt_blowfish-1.3.tar.gz
00:17 ilbelkyr joined #perl6
00:17 skink Or if someone trusted just wants to build it and submit a PR
00:31 sortiz joined #perl6
00:42 ParsonsNose joined #perl6
00:43 Xliff Visual Studio is such a cranky piece of shit.
00:45 ugexe Xliff: skink: i think that "cannot find native library" is a rakudo bug. it just so happens i think i addressed it in this open pr: https://github.com/rakudo/rakudo/pull/730/fi​les#diff-f8c7ea504081c5fcb5fd15d772eefc15L56
00:46 ugexe the highlighted line shows the use of .dirname, which as i mentioned earlier would lose the volume if you try to recreate a path with it (which it does)
00:52 orbus I like atom, but it's too slow
00:52 orbus haven't tried sublime
00:52 orbus vi is generally fine anyway
00:56 Xliff orbus: Sublime is a better editor, overall.
00:56 Xliff Nothing wrong with vi. It's a classic.
00:57 Xliff However I can do things 10x faster in Sublime than I can in vi
00:57 orbus hmmm, depends - vi has a ton of shortcuts for things most editors don't
00:57 orbus the downside is, you have to learn and remember them all
00:58 Xliff Exactly.
00:58 orbus but it can do some pretty nifty things
00:58 Xliff ugexe: How can I merge that PR with my rakudo repository?
00:59 orbus my big gripe with atom is, at least one windows it's a big memory hog, and if you leave it open, windows will decide to page it out
00:59 orbus and then it takes foreeeeever to come back
01:07 skink ugexe++ # Making me feel less incompetent
01:09 Xliff ugexe: Rebuilding.
01:09 Xliff I'll then run the test suite
01:09 Xliff then I'll try and install Crypt::Bcrypt again
01:14 Xliff Tests passed/
01:14 ugexe eh it actually worked?
01:15 ugexe oh the tests suite
01:15 Xliff Yeah.
01:15 Xliff Same failure. Same code.
01:16 astj joined #perl6
01:16 ugexe the good news is i feel slightly incompetent now too
01:16 Xliff Nooot reeeeeaallly.
01:31 sortiz \o #perl6
01:34 ryand joined #perl6
01:41 molaf joined #perl6
01:47 ilbot3 joined #perl6
01:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:50 awwaiid Is there a way to #! a specific rakudobrew perl6 version?
01:51 awwaiid as in, I have several installed but want to have a script call a specific one that might not be the current one
01:52 djbkd joined #perl6
01:56 Xliff awwaiid, you'd have to have each p6 binary named properly. Symlink the current one to "perl6" and then #! the specific one you want.
01:56 awwaiid ah. so no current out-of-the-box way then
01:56 Xliff That is if I understand what you are asking, correctly.
01:57 Xliff Please do not assume that my answer is authoritative. =)
01:57 awwaiid good enough for now, I'm just making some slides of examples -- I'll just go with '#!/usr/bin/env perl6' and not worry about it
02:02 _nadim joined #perl6
02:09 _28_ria joined #perl6
02:10 ugexe something like `rakudobrew --with moar-xxxxx <cmd>` (like perlbrew) would be nice
02:12 _28_ria skink: Yes, why do you ask?
02:12 skink You lost connection a lot of times
02:15 noganex joined #perl6
02:16 ggoebel18 joined #perl6
02:16 _28_ria skink: :) I leave on the starting edge of the world. ISPs often forget about us. We have a very flaky internet connection. And our only internet trunk is satellite. We don't have any fiber optic coming here, only within the region (internal fiber, for quicker intranet :), but everything, considering the outside world is very flaky and slow.
02:23 _nadim joined #perl6
02:25 BenGoldberg joined #perl6
02:47 _28_ria joined #perl6
02:54 _28_ria joined #perl6
03:03 kjk_ joined #perl6
03:06 kjk_ how do you split a string from the right, only once. I.e., is there something like  'a,b,c,d'.rsplit(',', 2)   which would give me ('a,b,c', 'd')  ?
03:11 skink m: 'a,b,c,d'.split(',')[*-1]
03:11 camelia rakudo-moar 40a953: ( no output )
03:11 skink m: say 'a,b,c,d'.split(',')[*-1]
03:11 camelia rakudo-moar 40a953: OUTPUT«d␤»
03:11 skink @ kjk_
03:12 skink Not the most efficient but it works
03:12 skids kjk_: What's the "2" supposed to do?
03:13 kjk_ skids: thanks. 2 should limit the split to 2 segments
03:14 kjk_ i'm actaully trying to get 'a,b,c' and 'd' without writing too many steps, but can't think of a shorter way
03:15 * Xliff is learning Test.pm
03:15 Xliff If I do "use-ok" is the module actually loaded?
03:16 kjk_ p6: my ($h, $t) = 'a,b,c,d'.split(',')[^(*-1), *-1]; $h.join(',').say; $t.join(',').say
03:16 camelia rakudo-moar 40a953: OUTPUT«a,b,c␤d␤»
03:17 skids m: say ("a,b,c,d" ~~ /(.*)","(.*)/)[*]
03:17 camelia rakudo-moar 40a953: OUTPUT«(「a,b,c」 「d」)␤»
03:18 astj Xliff: As long as I know, `use-ok` just checks whether loaded, doesn't load
03:18 kjk_ skids: nice, that's what i wanted! thanks
03:19 Xliff astj: Thanks.
03:19 skids kjk_: Just be aware those are Match objects not Str, in case it matters.
03:20 skids m: (.Str for "a,b,c,d" ~~ /(.*)","(.*)/).perl.say # in case it matters
03:20 camelia rakudo-moar 40a953: OUTPUT«("a,b,c", "d")␤»
03:21 kjk_ p6: ('a,b,c,d' ~~ /(.*)','(.*)/)>>.Str
03:21 camelia rakudo-moar 40a953: ( no output )
03:22 kjk_ p6: ('a,b,c,d' ~~ /(.*)','(.*)/)>>.Str.say
03:22 camelia rakudo-moar 40a953: OUTPUT«(a,b,c d)␤»
03:22 kjk_ got it, thanks, skids
03:22 skids Yeah, you could do >>. too.  Actually I think that is now optimized not to prematurely thread, even.   I just got into the habit of avoiding it ack when it was slow.
03:23 skink skids, Completely random: do you know much about building dynamic libs on Windows?
03:23 skink er, shared libs
03:24 skids No, I only use Windows at work, and only for dealing with apps that only run there.
03:27 skink mk nvm
03:30 Xliff Argh! Here's a thought. How do you not leak char * pointers returned by a nativelib?
03:31 skids Well, brute force, copy them to a buf and free them in a wrapper function
03:31 TEttinger joined #perl6
03:31 skids But I hope we can do better than that :-)
03:36 Xliff skids: Yeek! I guess I can do "native_free() is native('c') is symbol('free') is export {}" ?
03:36 Xliff Er...
03:37 skids I think "is native" may default to libc.
03:37 skids Or, any library already loaded maybe, which libc will be.
03:37 skids Also, why export it?
03:37 Xliff skids: Yeek! I guess I can do "sub native_free() is native is symbol('free') {}" ?
03:37 Xliff LOL. I'm lazy.
03:37 skink is native(Str) is what you want
03:38 skink for stdlib stuff
03:38 Xliff *sigh*
03:38 Xliff skink: "sub native_free() is native(Str) is symbol('free') {}" ?
03:38 skink { ... } or { * }
03:39 Xliff kk
03:39 skink not actually sure of the difference of those two
03:39 Xliff Can I make a conditional check to see if it already exists before redefining it?
03:39 skink also you'll want to pass it {C}Pointer for its argument
03:39 skids ... is stub code.  You'd want *.
03:40 skink if defined symbol or something like that
03:45 skids m: use NativeCall; sub malloc(int64) is native is symbol("malloc") returns Pointer { * }; sub free(Pointer) is native is symbol("free") { * }; free(malloc(32))
03:45 camelia rakudo-moar 40a953: ( no output )
03:46 skink is symbol is redundant if your sub name and the symbol name are the same
03:47 skids oh cool.
03:51 skink I _think_ just 'is native' will do C stdlib, and 'is native(Str)' will be any C lib currently loaded, including stdlib
03:51 skink Docs aren't fully clear
03:52 skink m: use NativeCall; sub malloc(uint64) returns Pointer is native { * }; say malloc(32);
03:52 camelia rakudo-moar 40a953: OUTPUT«NativeCall::Types::Pointer<0x5c55220>␤»
03:53 sortiz skink, is native; and is native(Str) do the same thing. Search the symbol in any already loaded lib.
03:53 skink That's what I first thought
03:55 sortiz In linux dlopen(3) and dlsym(3) are used.
03:57 skink Yay you can double-free and segfault your script :)
03:58 sortiz yep
03:59 skink Xliff, Docs have what is basically a CPointer class with a free() method
03:59 skink http://doc.perl6.org/language/n​ativecall#Basic_use_of_Pointers
03:59 Xliff Thanks.
04:02 sortiz Btw, for unversiones libs a 'is native(('foo', False))' or 'is native(('foo', Version)) do the trick, the warning was removed in 2016.02
04:05 sortiz So now an 'is native("foo")' suffice.
04:13 liztormato joined #perl6
04:16 geekosaur joined #perl6
04:22 Cabanossi joined #perl6
04:32 lizmat joined #perl6
04:33 * lizmat waves from the Irish Sea
04:34 sortiz \o lizmat
04:34 lizmat sortiz o/
04:36 lizmat commute further&
04:42 khw joined #perl6
04:46 matiaslina joined #perl6
04:55 matiaslina joined #perl6
05:05 _28_ria joined #perl6
05:10 dysfun left #perl6
05:12 Xliff Hrm,
05:12 Xliff How do I handle a situation where a nativelib wants to pass a pointer to a buffer and have Perl6 properly interract with that buffer?
05:13 Xliff I know there is Buf, but the nativelib is expecting char *.
05:15 djbkd joined #perl6
05:19 Xliff And I'm getting this weird error on and off, even if I haven't changed the script.
05:19 Xliff Malformed UTF-8 at line 1 col 4
05:19 Xliff in method CALL-ME at sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 301
05:22 CIAvash joined #perl6
05:24 djbkd joined #perl6
05:30 rindolf joined #perl6
05:32 Xliff m: my @a = <a b c>; for @a.kv -> $k, $v { say "$k/$v"; }
05:32 camelia rakudo-moar 40a953: OUTPUT«0/a␤1/b␤2/c␤»
05:46 perlawhirl joined #perl6
05:56 geekosaur joined #perl6
06:03 psch m: say so Same
06:03 camelia rakudo-moar 40a953: OUTPUT«False␤»
06:04 psch m: say so $_ cmp 1 for ^3;
06:04 camelia rakudo-moar 40a953: OUTPUT«True␤False␤True␤»
06:05 psch that did surprise me, but Order being an enum with the values -1, 0, 1 as is customary for comparisons does explain it easily
06:08 psch Xliff: "passing a pointer to a buffer"?  as in, your native function takes a char * and you want to do other things to that after the function returns?
06:10 Xliff psch: as in the native function returns a pointer to a buffer and I want to write into it, rather than reassigning it.
06:10 psch ah, i see
06:11 Xliff if $b is the buffer, I can't lose that. Other subsequent functions will try to write to it and fail.
06:12 Xliff I think I've solved it by changing the return type from Str to CArray[uint8]. However I'm still getting failures in my tests.
06:12 Xliff I'll probably gist it, tomorrow. Getting a little tired, now.
06:12 psch t/04-nativecall/15-rw-args.{t,c} seem related
06:12 psch i don't really know NC particularly well... :)
06:13 Xliff Yeah. I'll look into that. Probably similar to what I'm doing now:
06:13 Xliff my $data = $fh.read(4096);
06:13 Xliff for $data.subbuf(0).kv -> $i, $c {
06:13 Xliff $b[$i] = $c;
06:13 Xliff }
06:13 Xliff Still wish there were a cleaner way to do it.
06:16 sjoshi joined #perl6
06:23 psch m: sub prefix:<C>(Int $x?) { 0 + $x * 12 }; sub foo(:$root) { say "got $root" }; foo C4; foo C
06:23 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/djtD2Xa5kU␤Prefix C requires an argument, but no valid term found␤at /tmp/djtD2Xa5kU:1␤------> 3root) { say "got $root" }; foo C4; foo C7⏏5<EOL>␤    expecting any of:␤        prefix␤»
06:24 psch heh, optional arguments on prefixes probably isn't a great idea anyway :S
06:25 psch m: enum <C D E>; sub prefix:<C>(Int $x) { 0 + $x * 12 }; say C4
06:25 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/3nJXQrRqxs␤Undeclared name:␤    C4 used at line 1␤␤»
06:25 psch m: enum <C D E>; sub prefix:<C>(Int $x) { 0 + $x * 12 }; say C 4
06:25 camelia rakudo-moar 40a953: OUTPUT«48␤»
06:25 psch m: sub prefix:<C>(Int $x) { 0 + $x * 12 }; say C4
06:25 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/ypyRcn2hop␤Undeclared name:␤    C4 used at line 1␤␤»
06:26 psch right, <ident>
06:30 nakiro joined #perl6
06:31 psch needing the space definitely is somewhat inconvenient
06:31 psch 'cause i don't really want an enum with 88 members
06:31 psch although between those options i'd probably pick that because it's faster too
06:38 _mg_ joined #perl6
06:47 psch m: my %m = a => 1, b => 2; subset MStr of Str where * eq any %m.keys; say 'a' ~~ MStr # works
06:47 camelia rakudo-moar 40a953: OUTPUT«True␤»
06:47 psch m: class C { my %m = a => 1, b => 2; subset MStr of Str where * eq any %m.keys; method m(MStr $x) { say "ok" } }; C.m('a') # doesn't?
06:47 camelia rakudo-moar 40a953: OUTPUT«Constraint type check failed for parameter '$x'␤  in method m at /tmp/sjyEAAwMyE line 1␤  in block <unit> at /tmp/sjyEAAwMyE line 1␤␤»
06:50 espadrine joined #perl6
06:52 zoofood joined #perl6
07:05 MadcapJake what's this error mean: "Bytecode validation error at offset 158, instruction 25: operand type 32 does not match register type 24"
07:05 MadcapJake in NativeCall code
07:09 psch m: class A { has uint8 $.x; submethod BUILD(uint8 :$!x) { } }; A.new(:x(5)).perl.say
07:09 camelia rakudo-moar 40a953: OUTPUT«Bytecode validation error at offset 102, instruction 16:␤operand type 160 does not match register type 136␤  in block <unit> at /tmp/lnnvsI6cVQ line 1␤␤»
07:09 psch hm, similar but not the same
07:09 psch MadcapJake: well, it is a type mismatch
07:09 * psch checks which types
07:09 wamba joined #perl6
07:11 Jonis joined #perl6
07:12 psch hmm, i'm not seeing a register typ 24
07:12 psch +e
07:13 psch MadcapJake: i'd guess it got an int64 but expected int32
07:13 psch MadcapJake: that's at least what MoarVM/src/core/interp.h leads me to believe :)
07:13 MadcapJake ok, thanks!
07:14 psch MadcapJake: i'm not completely sure that's somewhere in your control, though, because the byte code validation happens after p6-level type checks afaik
07:15 psch MadcapJake: in any case, checking for an existing ticket on the moarvm github or bugging jnthn about it might be a good idea
07:15 zakharyas joined #perl6
07:21 sortiz MadcapJake,  RT#127813
07:21 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=127813
07:22 masak good morning, #perl6
07:22 psch sortiz++
07:22 sortiz \o masak
07:22 MadcapJake sortiz, psch: thanks! I was just fiddling with the types and hit that one, I've since corrected my mistake :D
07:22 psch seems related to #127845
07:22 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=127845
07:22 psch o/ masak
07:23 domidumont joined #perl6
07:28 sortiz psch, Yep, a simple native type as a named argument in *any* method trigger the problem.
07:28 domidumont joined #perl6
07:29 fireartist joined #perl6
07:31 abraxxa joined #perl6
07:34 cpage_ joined #perl6
07:37 masak I had some more time to develop that heroku web app this weekend
07:38 masak I was struck by not just how wide apart the database world is from the server backend world, but also how wide apart the server frontend world is from the server backend world
07:38 masak it's like you're writing three separate things, and making them interoperate
07:38 masak I almost feel like writing a blog post about that
07:39 masak s/it's like //
07:41 abraxxa joined #perl6
07:44 psch m: my &x = -> uint8 $x { }
07:44 camelia rakudo-moar 40a953: ( no output )
07:44 psch m: my &x = -> uint8 $x { }; &x(4)
07:44 camelia rakudo-moar 40a953: ( no output )
07:44 psch m: my &x = -> uint8 $x { say $x.WHAT }; &x(4)
07:44 camelia rakudo-moar 40a953: OUTPUT«(Int)␤»
07:45 moritz masak: re blog, please do :-)
07:45 psch m: my &x = -> uint8 $x { say $x.WHAT }; &x("foo")
07:45 camelia rakudo-moar 40a953: OUTPUT«This type cannot unbox to a native integer␤  in block <unit> at /tmp/ueVk8OhwqC line 1␤␤»
07:45 psch *that* is interesting...
07:45 psch so native types work for pointy block but nothing deeper in the Code hierarchy..?
07:46 moritz psch: they don't work as named arguments
07:47 psch oh of course, duh
07:47 moritz psch: they seem to work fine as positionals for every possible type
07:47 psch moritz: yeah, thanks for the hint.  i apparently wasn't paying enough attention once again :)
07:47 masak moritz: the architect/developer in me wants to "unify" those three domains, but at the same time, the three things I'm writing are related but very different; not copies of each other
07:48 psch m: my &x = -> uint8 :$x { say $x.WHAT }; &x(:2x) # yeah...
07:48 camelia rakudo-moar 40a953: OUTPUT«Bytecode validation error at offset 40, instruction 6:␤operand type 160 does not match register type 136␤  in block <unit> at /tmp/w7jpbpoVC8 line 1␤␤»
07:48 masak moritz: learning from 007, what I probably should aim for is really good consistency tests establishing constraints across the three domains
07:49 vendethiel joined #perl6
07:54 polyfloyd joined #perl6
08:06 labster left #perl6
08:10 dakkar joined #perl6
08:12 ocbtec joined #perl6
08:14 darutoko joined #perl6
08:19 RabidGravy joined #perl6
08:24 pRiVi joined #perl6
08:26 [particle] joined #perl6
08:33 g4 joined #perl6
08:33 g4 joined #perl6
08:37 RabidGravy boom
08:37 masak shaka laka
08:38 Xliff Fucking christ, why do I plague myself with NativeCall?!
08:38 Xliff psch: Fixed it. Using wrong var! :P
08:41 * masak ponders whether to ask for more civil language, or at least language proportional to the occasion
08:42 * Xliff is properly chagrined.
08:42 Xliff masak: If you've spent the last 6 hours trying to fix a single bug, what language would you use?
08:43 masak COBOL.
08:43 ufobat morning perl6 :)
08:43 masak Xliff: you may not know me very well, but I do spend 6 consecutive hours fixing a single bug quite frequently... :)
08:44 masak Xliff: be that as it may. "we're all adults here", and I'm trying hard not to police people. just reminding kindly that we're trying to be inclusive enough that people should feel fine to send 8-year-olds in here if they want.
08:47 Hotkeys Mornin
08:48 RabidGravy yeah, anyone who knows me would confirm that I use language appropriate to a rather outraged docker most of the time and even *I* tone it down here
08:49 * masak .oO( using docker is another reason to use extreme language )
08:51 RabidGravy speaking of which https://www.youtube.com/watch?v=PivpCKEiQOQ - which is definitely not safe for work, minors or the sensitive
08:51 Xliff Ah. I avoided docker, today!
08:51 Xliff \o/
08:51 _mg_ joined #perl6
08:51 masak RabidGravy: watched that one this morning :) probably was at the back of my mind when I thought the above :P
08:53 bjz joined #perl6
08:54 RabidGravy :)
08:55 _mg__ joined #perl6
08:57 bjz_ joined #perl6
08:59 sue_ joined #perl6
09:00 Xliff YESS!!!
09:01 Xliff \(◦'⌣'◦)/
09:02 Xliff Finally got a proper ogg read loop that fills the ogg_page.
09:02 RabidGravy cool
09:02 araujo joined #perl6
09:04 Xliff All this to test the ogg container functions.
09:04 Xliff I may test stream read functions, but this is a good stopping point for the night.
09:04 Xliff Now I feel better. :p
09:05 Xliff 'night #perl6
09:05 Xliff o7
09:06 masak 'night, Xliff_Zzzzz
09:30 araujo joined #perl6
09:34 vendethiel joined #perl6
09:35 * RabidGravy wonders idly how many shift register parts he has in the house
09:39 RabidGravy that is those that are not already in something, I had a quite amusing idea involving an ATTiny85 and a shift register last night
09:40 RabidGravy I mean all this making drum beats with software is fine but, well, it's just not hardware
09:47 diakopter joined #perl6
09:51 sue joined #perl6
09:59 espadrine joined #perl6
09:59 nolaan joined #perl6
10:05 bjz joined #perl6
10:06 perlawhirl joined #perl6
10:07 kaare_ joined #perl6
10:12 kid51 joined #perl6
10:19 shadowpaste0 "nolaan" at 217.168.150.38 pasted "no output" (1 line) at http://fpaste.scsys.co.uk/510089
10:20 zakharyas joined #perl6
10:22 nolaan left #perl6
10:31 vendethiel joined #perl6
10:51 smls joined #perl6
10:51 sue joined #perl6
10:52 smls Has anyone else experience on creating a Grammar for an INI-like format where the allowed keys and values should be hard-coded and validated directly in the grammar?
10:53 smls I tried to abstract the key-value lines using a parameterized token
10:53 smls multi token field ($key, $value)
10:54 smls And it parses fine, but then I can't get at the AST that was .made by the $value sub-regex
10:54 smls (full golfed code: https://gist.github.com/smls/55​1c805ea1e85fb37ac63a96e81e012f)
10:54 smls (This is also the context of RT 127872 which I reported yesterday.)
10:56 dvinciguerra_ joined #perl6
10:57 vendethiel joined #perl6
10:57 smls Is there a completely different approach to this kind of problem that I should try?
10:58 s_kilk joined #perl6
11:00 psch m: my token foo($x) { <$x> }
11:00 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/MacO6H3SBb␤Variable '$x' is not declared␤at /tmp/MacO6H3SBb:1␤------> 3my token foo($x) { <7⏏5$x> }␤»
11:00 psch m: grammar G { token foo($x) { <$x> } }
11:00 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/V7PFfdhhmM␤Variable '$x' is not declared␤at /tmp/V7PFfdhhmM:1␤------> 3grammar G { token foo($x) { <7⏏5$x> } }␤»
11:04 smls Yeah I tried those too ;)
11:04 smls m: my token foo($value) { $<value>=$value }
11:04 camelia rakudo-moar 40a953: OUTPUT«===SORRY!===␤Cannot find method 'rxtype'␤»
11:04 smls And that one
11:04 psch i think we do something like that in Perl6::Grammar or HLL::Grammar
11:05 psch ah, but as methods
11:08 psch not sure what exactly you have to do inside the method to let it match or not
11:12 psch m: grammar G { method foo($x) { my $srule = /<$x>/; self.CALL_SUBRULE($srule) } }; say G.parse("foo", rule => 'foo', args => "foo")
11:12 camelia rakudo-moar 40a953: ( no output )
11:12 psch hrm
11:12 psch $ ./perl6-m -e'grammar G { method foo($x) { my $srule = /<$x>/; self.CALL_SUBRULE($srule) } }; say G.parse("foo", rule => "foo", args => \("foo"))'
11:12 psch 「foo」
11:12 psch smls: ^^^ that might help
11:13 psch the various Grammar.nqp throught rakudo and nqp probably have more extensive examples
11:13 smls neat, I'll have a look
11:17 psch ...i do suspect there's a less internals-heavy way, though
11:17 psch and maybe if what you have/had parses but just lost a .made somewhere that should be ticketed
11:19 adhoc joined #perl6
11:20 smls Well it's not that it 'looses' the .made, but that when you call a subregex with the   $foo   syntax it does not become a capture of the current regex like it would for  <&foo>.
11:20 s_kilk joined #perl6
11:21 jnthn It woudln't for <&foo>
11:22 smls Why not?
11:22 psch ah, that's the rxtype error above
11:22 jnthn You have to write <foo=&foo>
11:22 smls Ah, right
11:22 jnthn smls: Nothing that is < followed by some non-alpha captures.
11:22 jnthn Seen another way, <foo> is really cute for <foo=.foo> :)
11:24 jnthn (Didn't read the whole discussion fwiw, just spotted this last bit while on my way to lunch :))
11:24 smls np
11:25 psch hm, but normal args to a rule is apparently broken
11:25 * RabidGravy downloads some frankly scary mellotron samples (which is kind of meta as the mellotron itself was a primordial "sampler")
11:25 psch i wasn't sure that was allowed, but i did write code that uses it somewhat over a year ago
11:26 psch which suggests we don't test that sufficiently, if at all
11:26 psch well, or it got tossed :)
11:31 psch hm, no, there is a test
11:31 psch oh
11:31 psch isn't it just the way < > do lookup inside a grammar
11:31 psch m: my token foo($x) { $x };
11:31 camelia rakudo-moar 40a953: ( no output )
11:32 smls m: my token foo { :my &a = /a/; <&a> }
11:32 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/CJBNMdW8Y7␤Undeclared routine:␤    a used at line 1␤␤»
11:32 smls psh: It's not just with args; lexicals defined inside the regex don;t work either. ^^
11:34 smls m: my &a = /a/;  my token foo { <&a> }
11:34 camelia rakudo-moar 40a953: ( no output )
11:34 smls ^^ It seems the  <&foo>  syntax only likes lexicals that were declared *outside* of the regex.
11:35 psch it's something like that, afair
11:38 psch $ ./perl6-m -e'grammar G { constant $x = "foo"; token TOP($x) { $x <$x> } }; G.parse("barfoo", args => \("bar")).say'
11:38 psch Nil
11:38 psch this feels like it should match
11:38 psch (i don't trust camelia at the moment :P )
11:39 psch mind, there's probably something i'm misunderstanding, so there :)
11:40 psch smls: it makes sense though, considering that inside a Grammar when you write <foo> (which means <foo=.foo>, as jnthn++ pointed out) you don't want $current-rule.foo, but $grammar.foo
11:40 smls psch: It does match if you say  &x  and  <&x>
11:40 psch ah, interesting
11:41 smls psch: Yeah, but that's for <foo>. Isn't <&foo> specifically meant to look up foo from the lexical scope.
11:41 psch smls: the one that the current rule lives in, is my understanding.  not the one inside the current rule
11:42 smls Why not though?
11:42 smls (Also, <$foo>  does EVAL-interpolation, I think, so that's why it needs to be <&foo> in you last example.)
11:43 psch ...i'm not the right person to talk about any of the whys behind the design :)
11:58 telex joined #perl6
12:09 Actualeyes joined #perl6
12:11 _mg_ joined #perl6
12:15 pmurias joined #perl6
12:18 nine .uni download
12:18 nine .u download
12:18 yoleaux No characters found
12:19 nine .u print
12:19 yoleaux U+2399 PRINT SCREEN SYMBOL [So] (⎙)
12:19 yoleaux U+329E CIRCLED IDEOGRAPH PRINT [So] (㊞)
12:19 yoleaux U+1F43E PAW PRINTS [So] (🐾)
12:24 [Coke] masak: http://irclog.perlgeek.de/p​erl6/2016-04-11#i_12316661 - this reads like you discovered a 3-tier web app.
12:24 adhoc left #perl6
12:25 masak [Coke]: you mean http://irclog.perlgeek.de/p​erl6/2016-04-11#i_12316609 ? yes, I suppose it does.
12:26 masak I mean, I've been aware of the UI/business/DB separation for a long time
12:26 masak but I don't think I've felt it as strongly as I do in this case, when what I have is a really small thing and I just want it to work as one unit
12:27 * masak reads up on the Three-tier Application Model
12:28 masak maybe my feeling can be expressed as an urge to make my application one-tier, even when I know that's Wrong and/or Impossible
12:30 [Coke] I'm so used to working on something that doesn't have full control over all the tiers; Or does, but doesn't have the freedom to make them all work together. It's just a cost of doing business, usually.
12:30 zakharyas joined #perl6
12:30 moritz it's also often the cost of a big(ger) business
12:32 moritz especially if things become so big that separate teams are responsible for the separate layers
12:34 jnthn Splitting layers over teams is probably a great SRP violation at the human level :)
12:34 [Coke] Here's its that we don't have a clean separation of concerns. So we have 100 apps that may interaction with each other; but some do it at the DB level, some do it at a REST API level... might have 2 front ends to the same DB backend, some of the apps are 10+ years old, don't always have time to do things right, rarely have time to redo them right. Your standard mess.
12:34 [Coke] *may have some interaction…
12:36 moritz [Coke]: ugh. Interaction at the DB level are the worst, usually.
12:37 * [Coke] checks his mail and finds that someone was working on RT this weekend!
12:37 dvinciguerra joined #perl6
12:37 [Coke] moritz: esp. if it's "oh, just let me see this table" instead of "give me a stored proc I can call and get a result set from"
12:37 jnthn Yeah, I've seen my share of DB-level integration. And it's nearly always against tables directly, not SPs.
12:37 jnthn Though time and time again I see teams utterly fail to think about namespaces and loose coupling in databases.
12:38 jnthn Leading to 1000-table monsters all tightly coupled together with primary keys.
12:38 jnthn uh
12:38 jnthn *foregin* keys
12:39 jnthn That combined with the thing being used for integration is an utter "oh crap..."
12:39 moritz well, if you don't use foreign keys, you can put it into a different database to start with :-)
12:40 jnthn I'm not saying "don't use foreign keys", more "don't have 1000 tables in the same database" ;)
12:41 masak I make this point in many of our courses
12:41 jnthn Finding boundaries in the domain though (bounded contexts, in DDD lingo) is pretty hard though.
12:41 jnthn You have to undertand the business. And think. Lots.
12:42 masak we've have the Structured Programming revolution in programming-land, followed on by even nicer things like OOP and FP
12:42 masak all there to help you modularize and "contain the damage" of code sprawl
12:42 jnthn Micro-services may help but only if people do the thinking part. :)
12:42 masak but we've never really had something like that for database-land
12:42 masak not on the same scale, at least. microservices might be the closest we've had to it
12:43 masak but I think DDD's "bounded contexts" are a much closer match
12:43 masak and that's definitely not common knowledge in the industry
12:43 jnthn Aye
12:43 masak people simply don't view "lots of foreign keys" as a cost/load
12:44 * jnthn remembers a recent discussion with some folks who were thinking of doing microservices but not doing the bit where you have independent persistence per service
12:44 jnthn Arghh. :P
12:46 jnthn So yeah, in a few years we'll be talking about how microservices "didn't help" and be on to the next thing that'll save the world.
12:46 jnthn :P
12:46 vendethiel joined #perl6
12:47 masak "programming is pop culture" -- Alan Kay
12:48 moritz jnthn: well, if you do that (microservices without bounded contexts), you're basically just adding RPC inside a single application. Fun.
12:48 masak that's one way to view it, yes
12:48 nine But what about consistency and transactions when your database is split?
12:48 jnthn moritz: Yup
12:48 masak nine: well, there's 2PC and 3PC... :(
12:49 jnthn nine: That's why you have to look at the problem domain. To figure out where the *business* is non-transaction and eventually consistent.
12:49 jnthn (Any large organization will have a bunch of those places, because you can't scale n-to-n communication with people.)
12:50 moritz nine: often you want to heavily denormalize anyway. For example if a customer orders something, copy the shipping address and prices over to the order
12:50 masak jnthn: are you telling me I cannot simply apply cookie-cutter solutions to every new problem domain I encounter? I have to think every time? :P
12:50 timotimo ⅠPC, ⅡPC, and ⅢPC? :)
12:50 moritz nine: so that when a product price changes between order and shipment, the customer still pays what he ordered
12:51 moritz nine: or that the shipment goes out the address it was meant to, not re-changed etc.
12:51 perlawhirl hi perlers
12:51 jnthn masak: Just get a "Think really hard"-shaped cookie cutter :)
12:51 nine moritz: that's not even denormalization if you think about it. Because in one place you're storing the customers current business address while in the other you're storing the shipping address for an order. They may read the same but are semantically different.
12:51 moritz nine: so there's no need to have transactions that span orders and products, for example :-)
12:51 masak moritz: yeah, thinking in terms of aggregates told me to value copying in many places where I had previously valued live-linking
12:52 perlawhirl i was asking about this gotcha with sort last night, i put it up in a gist: https://gist.github.com/0racle/1​34921795a6d91168f31cd554492d824
12:52 nine moritz: and even for the product price it's the "current product price" vs. "the product price at the time of order" which are close but not the same.
12:52 masak this is not really a concession to bounded contexts -- more like, the bounded contexts are already there, and you're discovering that you shouldn't couple them
12:53 perlawhirl jnthn: ^^ just wanted your opinion on whether this is something that needs to be addressed and if so, the best way to solve it... then maybe i could start working on a PR
12:53 pmurias re separate things, with rakudo-js targeting the frontend part, rakudo-moar the backend part, the interesting question is will we have anything targeting the db part
12:54 moritz nine: but if you implement it with copying, you can get rid of a transaction spanning all those things
12:54 masak perlawhirl: we might be able to accept both a positional and a named :&by parameter
12:54 masak perlawhirl: but it's an API change, so we have to be cautious about it
12:54 moritz pmurias: maybe rakudo-pg, which implements Perl 6 in Postgres?
12:54 moritz pmurias: not compilation to postgres, but offers Perl 6 stored procedures :-)
12:54 perlawhirl yeah i know... don't wanna break sort(*.chars) so can't just change it to :&by... so what's the answer?
12:55 masak perlawhirl: I can see two possible fixes
12:56 masak perlawhirl: (a) make :&by work just like the positional
12:56 masak perlawhirl: (b) accept :&by, but die at runtime with an error saying to use the positional
12:56 jnthn Not b, because we as a rule don't complain about unknown names passed to methods
12:56 jnthn (Interface consistency)
12:57 jnthn Doing (a) could perhaps be reasonable
12:57 masak ISTR we already have a :&by for the sub form, is that correct?
12:57 jnthn I don't know how it'd cause a bug to "sneak it". It'd just have never worked in the first place
12:57 masak that would suggest that (a) is even more desirable
12:58 masak jnthn: yeah, it seems fairly risk-free when I think about it
12:58 masak basically a non-invasive API addition
12:58 nine moritz: ah, just write those stored procedures with Inline::Perl6 ;) PostgreSQL doesn't need to know about it...
12:58 moritz nine: :-)
12:58 perlawhirl jnthn: if the data happens to sort alphabetically in the same order as the :by would have sorted it, then it may go unnoticed... until it doesn't
12:58 masak maybe if someone has subclassed Positional somewhere and added their own :&by to .sort in the ecosystem -- but I think we can safely rule that out
12:58 masak not even in the darkpan
12:59 jnthn perlawhirl: Time to write more tests! ;)
13:04 cdg joined #perl6
13:05 michel_mno joined #perl6
13:11 michel_mno Hi there, I do not know anything about nqp, hope this is the correct channel.  There is a test error while make check is done on nqp on PowerPC ppc64 bigendian archi as per https://build.opensuse.org/package/live_build_l​og/openSUSE:Factory:PowerPC/nqp/standard/ppc64  it is about t/nqp/59-nqpop.t reported failure,  Is is a known problem ? and if not what is suggestion for investigation ?
13:12 timotimo can you manually run t/nqp/59-nqpop.t with nqp-m and see what the exact output is?
13:13 masak that is, `nqp-m t/nqp/59-nqpop.t`
13:14 wamba joined #perl6
13:14 timotimo yeah
13:15 nine Intriguing...it's the sha1 test
13:16 timotimo huh? but we use third-party code for that!
13:16 timotimo and third-party code is always correct, isn't it?
13:19 _nadim joined #perl6
13:24 masak m: macro swap($a, $b) { quasi { ({{{$a}}}, {{{$b}}}) = {{{$b}}}, {{{$a}}} } }; my $w = 5; my $z = 10; swap $w, $z; say [$w, $z].perl
13:24 camelia rakudo-moar 40a953: OUTPUT«5===SORRY!5=== Error while compiling /tmp/CD2CZgHkAk␤Use of macros is experimental; please 'use experimental :macros'␤at /tmp/CD2CZgHkAk:1␤------> 3macro7⏏5 swap($a, $b) { quasi { ({{{$a}}}, {{{$b»
13:24 cschwenz joined #perl6
13:24 masak m: use experimental :macros; macro swap($a, $b) { quasi { ({{{$a}}}, {{{$b}}}) = {{{$b}}}, {{{$a}}} } }; my $w = 5; my $z = 10; swap $w, $z; say [$w, $z].perl
13:24 camelia rakudo-moar 40a953: ( no output )
13:24 masak hruh.
13:24 timotimo is camelia's output module still acting strange?
13:24 timotimo m: say "hello, i'm fine"
13:24 camelia rakudo-moar 40a953: ( no output )
13:24 masak it only outputs errors? :(
13:24 timotimo perhaps :(
13:25 nine m: say "hello"
13:25 camelia rakudo-moar 40a953: OUTPUT«hello␤»
13:26 nine It still likes me
13:26 cschwenz (backstory: i found $foo.chars() which returns the number of graphemes in string $foo.)  and now for what i'm really looking for:  how do i go about finding the byte length of string $foo?
13:27 nine cschwenz: strings do not have a byte length. Byte buffers that contain string data in some encoding do. So you really want to ask "what's the byte count of this UTF-8 encoded string data?"
13:27 cschwenz yes, exactly that :-)
13:27 nine cschwenz: So you just need to translate this more precise question to Perl 6 ;)
13:28 cschwenz nine: would i create a Buf object for that?
13:30 timotimo you don't have to do it manually, perl6 can do it for you
13:31 cschwenz how so?
13:31 timotimo try the "encode" method on a Str object
13:32 cschwenz i've been spelunking through doc.perl6.org and it's entirely non-obvious how to go about getting the byte length of an UTF-8 encoded string.  :-(
13:32 Juerd If it's utf-8 encoded, it's a blob or a buf, and the number of elements is the number of bytes.
13:33 Juerd If it's a str, it's not encoded (conceptually).
13:33 timotimo that's right
13:35 cschwenz m: my $foo = "asdf→zxcv"; $foo.encode("raw"); say $foo.chars();
13:35 camelia rakudo-moar 40a953: OUTPUT«Unknown string encoding: 'raw'␤  in block <unit> at /tmp/cxgph8nELy line 1␤␤»
13:35 timotimo "raw"?
13:35 cschwenz m: my $foo = "asdf→zxcv"; $foo.encode("ascii"); say $foo.chars();
13:35 camelia rakudo-moar 40a953: ( no output )
13:35 smls m: say "äâá".encode("UTF-8").bytes
13:35 camelia rakudo-moar 40a953: ( no output )
13:35 timotimo well, camelia is currently broken when it comes to outputting stuff
13:35 smls ^ prints 6 locally
13:36 Juerd cschwenz: Note that .encode *returns* the encoded string
13:36 cschwenz i tried "raw" as there is an overwhelming abundance of documentation around what constitutes a valid encoding
13:36 g4 joined #perl6
13:36 Juerd cschwenz: It doesn't change the type from str (unencoded) to buf or bool (encoded) on the original object
13:37 cschwenz m: my $foo = "asdf→zxcv"; say $foo.encode("ascii").chars();
13:37 camelia rakudo-moar 40a953: OUTPUT«Error encoding ASCII string: could not encode codepoint 8594␤  in block <unit> at /tmp/ylOekpX82T line 1␤␤»
13:37 Juerd cschwenz: $encoded = $unencoded.encode(...);  or  $foo.=encode(...);
13:37 Juerd ASCII doesn't support →
13:38 cschwenz okay, back to the original question:  how do i get perl6 to tell me how many bytes long a string is?
13:38 cschwenz m: my $foo = "asdf→zxcv"; say $foo.encode("utf-8").chars();
13:38 camelia rakudo-moar 40a953: OUTPUT«Cannot use a Buf as a string, but you called the chars method on it␤  in block <unit> at /tmp/GZptMtEiPa line 1␤␤»
13:38 jnthn m: my $foo = "asdf→zxcv"; say $foo.encode("utf-8").bytes
13:38 camelia rakudo-moar 40a953: OUTPUT«11␤»
13:38 smls cschwenz: Use the .bytes method on the encoded buf, not .chars
13:38 cschwenz aha! thanks! :-)
13:39 timotimo .chars will turn the buffer into its string representation and give you the number of characters it takes for that
13:39 yoleaux No characters found
13:39 cschwenz ah, enlightenment++
13:39 timotimo oh, interesting
13:40 timotimo the .Str on a utf8 object actually spits out the utf8-encoded result directly
13:40 timotimo and .chars will helpfully tell you "Cannot use a Buf as a string, but you called the chars method on it"
13:41 nine m: my $foo = "asdf→zxcv"; say $foo.encode.bytes # even shorter
13:41 camelia rakudo-moar 40a953: OUTPUT«11␤»
13:50 RabidGravy joined #perl6
13:54 teatime timotimo: 'long double' perhaps
13:56 mcsnolte joined #perl6
13:57 skids joined #perl6
13:57 ptolemarch joined #perl6
14:02 cschwenz left #perl6
14:06 chrisdotcode left #perl6
14:08 sue joined #perl6
14:18 tharkun joined #perl6
14:22 RabidGravy boom
14:22 hoelzro o/ #perl6
14:25 khisanth_ joined #perl6
14:42 telex joined #perl6
14:59 Begi joined #perl6
14:59 khw joined #perl6
15:16 hoelzro so it seems that &EXPORT can't override behavior for tags; is that something that could change in 6.d?
15:16 tharkun joined #perl6
15:17 hoelzro I ask because I was working on a Fcntl module on Saturday, and I would really like for users of that module to be able to specify which spec or non-portable extensions they need (ex. `use Fcntl :posix`, `use Fcntl :linux<4.0.0>`)
15:18 kurahaupo joined #perl6
15:19 RabidGravy hoelzro++ # Fcntl
15:21 jnthn hoelzro: And you can't just export the stuff you want to under those tags?
15:21 jnthn (With is export...)
15:21 hoelzro jnthn: well, I was hoping to offer some more intelligent feedback to the user if their request isn't possible
15:22 hoelzro ex. if `use Fcntl :linux` is used on OS X
15:22 jnthn Maybe something like EXPORT.WHO does { method AT-KEY($key) { ...error detection...; nextsame() }
15:23 hoelzro ah, good suggestion! thanks!
15:52 pmurias_ joined #perl6
15:57 dogbert2 Hi #perl6
15:57 Begi dogbert2: hi !
15:57 smls_ joined #perl6
15:57 dogbert2 What do you do if you've found an error in the Perl6 documentation, report it here?
15:57 timotimo either here or file an issue in the repository; the bottom of the documentation has a link to the right repository
15:58 dogbert2 I guess that entails creating a github account?
15:58 timotimo yeah, if you don't have one, just report it here in the chat
15:59 dogbert2 with a pastebin?
15:59 Begi and someone will report in GH
15:59 Begi dogbert2: what's the error ?
15:59 dogbert2 cool, one sec
15:59 timotimo any pastebin you like will be fine
16:01 * teatime reads the topic, thinks 'UTF-8 is our Ýäfriend' or something would be funnier.
16:01 teatime also apparently the postal system comprehends mojibake?
16:02 dogbert2 https://gist.github.com/anonymous​/f50b01c0932fcf00a2af3e372bf8f75c
16:02 dogbert2 Not the biggest error ever :)
16:04 vendethiel joined #perl6
16:08 Begi dogbert2: you're right, thanks !
16:09 Begi and to correct it : https://github.com/perl6/doc/pull/447
16:09 dogbert2 Thx, Begi++
16:11 dalek doc: ba48ee7 | Emeric54++ | doc/Type/Cool.pod:
16:11 dalek doc: Update Cool.pod (#447)
16:11 dalek doc: review: https://github.com/perl6/doc/commit/ba48ee714b
16:12 Begi nice, dalek if faster than the GH's mails
16:13 timotimo probably only a matter of "github invokes the http hooks earlier than sending out emails"
16:13 dogbert2 Impressive
16:17 timotimo or maybe because the http hook that invokes dalek hangs off of the repository itself, whereas you getting the mail depends on "who is the owner of this issue?"
16:34 dogbert2 so, what to do with the profiler bug which I failed to report to rakudobug@perl.org (it never showed up) a few days ago?
16:35 dogbert2 golf ([Coke]++) perl6 --profile -e 'my @m[5]'
16:36 Azry joined #perl6
16:42 hoelzro jnthn: hmm...it seems that idea won't work; nqp::existskey is used to check for the tag, and that doesn't seem to call EXISTS-KEY (not in my experiment, at least)
17:03 domidumont joined #perl6
17:04 dha joined #perl6
17:08 CIAvash joined #perl6
17:08 timotimo yeah, nqp::existskey directly involves the underlying repr
17:09 timotimo we might want to fall back to the EXISTS-KEY method for a second opinion
17:09 psch i'd almost say do it the other way around
17:09 timotimo depends on if it's on a hot path or not
17:09 psch as in, do EXISTS-KEY first if it exists on EXPORT.WHO
17:10 psch well, but if the key exists on EXPORT and we find it with nqp::existskey we don't know if we need to go via EXISTS-KEY
17:10 psch whereas when it doesn't exist we only waste a look into the method cache
17:11 psch of course this is local to the importing code
17:16 dbohdan joined #perl6
17:16 psch timotimo: maybe i misunderstand, but finding the key with nqp::existskey and then asking EXISTS-KEY if it exists (and running it in case it does extra magic like hoelzro needs) seems always slower than checking if EXISTS-KEY exists, running it if does and falling back to nqp::existskey if it doesn't
17:17 psch i mean, from a purely "what gets called" perspective.  i didn't measure, obviously... :)
17:22 spider-mario joined #perl6
17:23 dbohdan joined #perl6
17:29 dbohdan joined #perl6
17:30 timotimo running the exists key method is an invocation, whereas nqp::existskey is just a c function being executed
17:30 timotimo the difference in speed is gigantic
17:32 psch oh, Stash is Hash
17:32 psch yeah, that's what i was missing
17:32 psch EXPORT is a Stash, which means it always has an EXISTS-KEY
17:33 vendethiel joined #perl6
17:34 psch so yeah, i agree :)
17:34 hankache joined #perl6
17:35 erdic joined #perl6
17:37 mephinet joined #perl6
17:38 hankache hello *
17:41 psch i guess that means EXISTS-KEY is not really the right tool there...
17:46 bjz joined #perl6
17:49 mephinet joined #perl6
17:52 psch m: use Test; Test::EXPORT::.WHAT.say
17:52 camelia rakudo-moar 40a953: OUTPUT«===SORRY!===␤Could not map file '/home/camelia/.perl6/precomp/A1D20F7149E8A9​7341C8BBB59F89F128BA0382C8.1460121023.85513/​C7/C712FE6969F786C9380D643DF17E85D06868219E' into memory: FIXME␤»
17:52 psch ...neat?
17:53 firstdayonthejob joined #perl6
17:53 molaf joined #perl6
17:55 sortiz joined #perl6
17:55 sortiz \o #perl6
17:56 timotimo hello sortiz
17:58 hankache yo
18:06 hankache_ joined #perl6
18:16 nige1 joined #perl6
18:23 nige1 hi - just wanted to pop in to make a little announcement
18:23 _mg_ joined #perl6
18:23 nige1 a while back - I mooted the idea of "SixFix" - a dose of Perl 6 over email
18:24 nige1 i've finished the first series and it goes for 7 weeks
18:24 Xliff joined #perl6
18:24 nige1 you get one SixFix per week (provided you answer the question each week)
18:25 perlpilot nige1: where do I get my SixFix?  ;)
18:25 nige1 :-)
18:25 nige1 you can sign up here: http://sixfix.nigelhamilton.com
18:25 Xliff \o #perl6
18:26 Xliff What is a SixFix?
18:26 perlpilot Visit the URL
18:26 nige1 a week Perl 6 question and small coding challenge
18:26 nige1 weekly
18:26 perlpilot nige1: Are you going to advertise heavily?
18:26 Xliff Hmm.... signed up.
18:26 nige1 was hoping people could share the link -
18:26 nige1 cool :-)
18:27 dha Eep. building rakudo from the git repo, and I'm getting a failing test. who should I yell at? :-)
18:27 Xliff Now if I get spammed, I know where to redirect them to.
18:27 Xliff Eh, nige1?
18:27 Xliff ^_^
18:28 perlpilot nige1: I don't know if it's a good idea to start off with an easter egg though.  :)
18:29 nige1 yes - it's tricky - just wanted them to do something to install rakudo
18:29 nige1 and get something up and running
18:31 dha WTF? I just ran the tests again and now they're passing. :-/ I think I will give up trying to make sense of anything now.
18:32 timotimo some times are "flappy" sometimes ;(
18:32 perlpilot dha: some of the async tests are known to be flappy.  Was it one of those?
18:33 dha it was t/04-nativecall/13-union.t  - said it declared 28 tests but only ran 26. But now, for some reason, it's happy. *shrug*
18:36 RabidGravy cosmic rays
18:38 perlpilot nige1: the more I think about it, the more of a mistake it seems to start of with an easter egg.   Yes, we should have a sense of humor, but no, it's not the best way to introduce people to the language.   SixFix could be a great way to get people started, but it could also alienate people if done poorly.
18:41 nige1 ok - I'm hearing you - it might help to see it in the context of the rest of the questions/challenges
18:42 nige1 the first week is really to get people up and running with rakudo
18:49 RabidGravy oh github, are you playing up again
18:53 dha So, if I'm panda installing Task::Star, is there a known reason why DBIish would be failing?
18:54 stmuk dha: I think it's a recent change which broke DBIish
18:55 dha Aha. So, is there a recommended way around that? (for installing Task::Star, not fixing DBIish, which I assume is a more complicated problem)
18:55 Sqirrel joined #perl6
18:55 stmuk DBIish @ 09835a3 should work
18:56 stmuk checkout that version from github and install and then reinstall Task::Star
18:59 dha I will now figure out how to do that. :-) Thanks.
19:12 Xliff nige1, FWIW I agree with perlpilot. You might want to play that first question straight and offer up the easter egg as a "try this cool thing, next".
19:13 nige1 ok - any suggestions for a play it straight question?
19:17 ZoffixW joined #perl6
19:17 ZoffixW is it at all correct to call "is export" a *role* rather than a trait? sub foo is export {...}
19:18 hoelzro ZoffixW: traits are roles applied at compile time
19:18 ZoffixW Ah
19:18 ZoffixW Thanks.
19:21 hankache joined #perl6
19:23 masak I've now read slightly too many documents about three-tier systems.
19:23 masak they're all quite boring, and they agree on too many things :)
19:24 vendethiel :P
19:24 masak mostly they go on about how the separation of the three tiers is so good -- bla bla, re-use, scalability, flexibility
19:24 yqt joined #perl6
19:24 vendethiel wrong documents then
19:24 masak that separation is what made me wake up and want something better in the first place
19:25 pdcawley joined #perl6
19:25 masak the three tiers, at least in my case, run in not just three different languages but three different environments/runloops
19:26 masak who designed this and then sat back and said "mm, nice"?
19:26 masak :P
19:27 hankache what's wrong with monoliths
19:27 hankache ?
19:27 hankache ;)
19:28 Woodi hankache: usually nothing is 100% perfect :)
19:28 masak Woodi: except regular dodecahedra. they're perfect.
19:29 masak hankache: from the perspective of my code being consistent across all the three tiers forced on me, a monolith is what I would like to have.
19:30 lucasb joined #perl6
19:30 masak I'm gradually coming to the realization that achieving this consists of writing thorough tests for the interfaces between the tiers.
19:34 lucasb in the REPL, if I type 'sub f { 42 }; f', it outputs 42
19:34 lucasb but if I type 'sub f { say 'hi'; 42 }; f'; it only says 'hi', omitting the 42
19:35 lucasb did this behaviour changed?
19:36 lucasb (damn, I need to leave now. I'll come back later :)
19:36 hankache m: sub f { say 'hi'; 42 }; f
19:36 camelia rakudo-moar 40a953: OUTPUT«hi␤»
19:36 hankache m: sub f { say 'hi'; 42 }; say f
19:36 camelia rakudo-moar 40a953: OUTPUT«hi␤42␤»
19:36 hankache lucasb ^^
19:37 sortiz dha, What is the problem you see with DBIish?
19:39 dha Damn good question. Not sure if I can find it now that I've installed the earlier version.
19:41 Woodi I want to scream when I see what *micro*-services become. probably becouse I initially imagined them as business entity, a micro-*service*, not an architecture... eg. buying tickets via SMS on the bus or buying/selling mp3 (temporary ownership (EVIL thing!)). or textures in Steam :)  a "modern" internet - something more granular then monthly subscriptions...
19:42 Xliff nige1, Hmmm.... good question! =)
19:42 dha sortiz - attempting to recreate the issue now. Let me see if can make it spit at me.
19:43 sortiz dha Thank you. The latest DBIish should work with latest Rakudo Star, otherwise I would like to know.
19:43 dha sortiz - FWIW, I'm using the rakudo from github, not star.
19:43 nige1 ideally something that shows something interesting about Perl6 - but not too complex as it's the first thing they may type into it
19:44 Xliff nige1, What does «perl6 -e "say 'This is a dog'.WHAT"» output?
19:44 sortiz dha, well, better then.
19:44 Xliff A variationof what you already had, except the straight answer is "(Any)"
19:44 dha Do we have a paste application for this channel?
19:44 Xliff Then on the answer page you can say your original question and mention that perl6 has a sense of humor.
19:44 Xliff Play the easter egg off of the straight question.
19:45 Xliff That way you still get to reuse content.
19:45 nige1 yes - that's a good suggestion
19:45 Xliff m: say 42.WHY
19:45 camelia rakudo-moar 40a953: OUTPUT«(Any)␤»
19:45 Xliff m: say 42.WHAT
19:45 camelia rakudo-moar 40a953: OUTPUT«(Int)␤»
19:46 Xliff It would be nice if the easter egg worked in both directions, but I digress.
19:46 _nadim joined #perl6
19:47 shadowpaste0 "dha" at 217.168.150.38 pasted "DBIish Failure Summary" (127 lines) at http://fpaste.scsys.co.uk/510157
19:47 dha sortiz - there's the output from panda.
19:48 Xliff Ooh! fpaste?
19:49 dha apparently, yes. :-)
19:50 RabidGravy I'm guessing that it's not deealling very well with the inability to find the mysql client libraries
19:50 Kroc joined #perl6
19:51 Kroc Good day. Would there be anybody to answer some noob questions please?
19:52 dha And possibly others.
19:53 hankache hi Kroc
19:53 masak hello Kroc -- fire away :)
19:54 Kroc Goo day. I am a competant enough programmer, but the Perl6 documentation is thin, and even googling draws a blank -- how do I read binary files in Perl6? I.e. extract Longs, Ints, Doubles &c.
19:54 masak oh, we should have a good go-to example of that, agreed.
19:55 masak Kroc: so, you have a binary file in some specified binary format, and you want to turn all those bytes into a data structure?
19:55 Kroc I have a binary file open -- `my $ioHandle = open( $ioPath, :bin );` but from that point I can't find any examples.
19:55 Kroc Yes, that's a good way to put it masak.
19:56 sortiz dha, Seems that somehow the recently added automatic library version detection for mysql is broken in you machine.
19:56 dha If you say so :-)
19:57 dha FWIW, OS X 10.10.5
19:58 sortiz In fact that was added for OS X, that uses a more recent version of mysql :-)
19:59 masak Kroc: perl6 -e 'my $fh = open("README.md", :bin); say $fh.read(1000)'
19:59 masak Kroc: that will read the first 1000 bytes into a so-called Buf.
20:00 masak Kroc: maybe there is a module to further process that Buf into your longs, ints, doubles, etc. but if so, I'm not aware of it. maybe others know.
20:00 masak but at worst, you'll be able to do that parsing yourself.
20:01 Kroc @masak Oh, so there's not a way to cast some bytes into other types?
20:01 RabidGravy the Buf has .unpack method
20:01 masak oh, right
20:01 masak what RabidGravy said.
20:01 Kroc I checked unpack -- but it seems incomplete. I don't see any signed, or floating point support.
20:01 masak it's incomplete, yes
20:01 RabidGravy http://doc.perl6.org/routine/unpack#role_Blob
20:02 dha sortiz - haven't really done much database stuff recently, so I don't know what to tell you. :-) At the moment, my main goal in getting DBIsh installed was to get Task::Star to complete installing. :-)
20:02 ugexe also https://github.com/lizmat/PackUnpack
20:02 dha Nevertheless, I suppose someone may come across this problem who might actually car.
20:02 dha care, even.
20:03 ugexe dha: maybe you can just --force install DBIish, then retry install Task::Star
20:03 RabidGravy Kroc, it is of course possible to recombine the bytes in the Buf anyway you choose
20:03 sortiz dha, thanks. The paste is useful.
20:03 dha ugexe -  an earlier commit was suggested, and that managed to work. So, (my) problem solved. :-)
20:03 dha sortiz -  glad to be of help.
20:03 ugexe or you can --notests like it does for its CI testing...
20:04 dha ugexe -  indeed, those are probably both reasonable solutions. If I run into similar problems again, I may try one of them.
20:06 Kroc @ugexe That appears not to provide single/double floats
20:07 Kroc So, am I to understand that it's not currently possible to read floats from binary files in Perl6? :'(
20:07 dogbert2 This description of the 'ord' method feels a bit strange
20:07 dogbert2 Coerces the invocant (or in sub form, its argument) to Str, and returns the Unicode code point number of the code point.
20:08 dogbert2 It seems to return the code point of the first character in the string
20:08 Kroc I selected Perl6 because it looked best suited to writing a Z80 assembler; though to begin with I want to be able to convert binary object files from another assembler (WLA DX) into my own linker format.
20:10 dogbert2 The code example is incorrect as well ..
20:10 dha dogbert2 -  hm. I guess one doesn't usually think of someone using ord on more than a single character. Which document are you getting that from?
20:10 dogbert2 Cool.pod
20:11 RabidGravy Kroc, as I said before you are entirely free to handle the bytes in the Buf as you wish, it's just a matter of picking the bytes you want and shifting and oring them as required
20:11 RabidGravy examples abound
20:12 Kroc @RabidGravy It's this I don't understand. How to convert Buf bytes into a native type.
20:12 dha Damn. must have confused 'a' with 'A'
20:12 dha Thanks for catching that.
20:13 dogbert2 glad to be able to help out a little bit
20:13 RabidGravy Kroc, how would you convert 4 bytes into a 32 bit integer in, say C or Assembler?
20:15 Kroc Pointer abuse. However in other languages, one doesn't need to and can just read a native type from the file.
20:15 dalek doc: 91226c1 | (David H. Adler)++ | doc/Type/Cool.pod:
20:15 dalek doc: Fixed example for ord, so that 'a'.ord is shown to be 97, not 65.
20:15 dalek doc: review: https://github.com/perl6/doc/commit/91226c19ac
20:18 cdg joined #perl6
20:19 cdg joined #perl6
20:20 RabidGravy Kroc, if it helps unpack is made in Perl 6 https://github.com/rakudo/rakud​o/blob/nom/src/core/Buf.pm#L211 examine and use as an example to unpack any types you wish
20:21 dha So, before I put in a pull request to change the documentation of C<ord> in Cool.pod, is it *supposed* to produce a result for the first character of its invocant/argument, or is it supposed to only work on single characters?
20:21 Kroc @RabidGravy I don't see the ability to use Single/Double floats in there, unless I'm missing some understanding
20:21 dha I. e. AmIBugOrNot?
20:23 jnthn dha: ord actually gives the number of the first *codepoint*
20:24 jnthn dha: And a character may consist of multiple codepoints
20:25 jnthn (Though of course, when you're in the boring old ASCII range, nothing like that ever happens :))
20:25 jnthn dha: Anyway, not a bug that it operators on many-char strings
20:25 dha Ah. so, perhaps all that needs to be done is to add the word "first" to the doc.
20:25 [Coke] dha: https://rt.perl.org/rt3/Tic​ket/Display.html?id=127750
20:25 dha i. e. "Coerces the invocant (or in sub form, its argument) to Str, and returns the Unicode code point, number of the first code point.
20:26 jnthn That's accurate
20:26 jnthn Though stray , after point
20:26 dha [Coke] -  *nod*
20:26 RabidGravy Kroc, they aren't in there, but that shows how say an long is unpacked, you use your knowledge of how the bytes are laid out in your data to unpack to any type you want
20:27 dha jnthn -  yes, comma out as well.
20:27 * dha rewrites
20:28 Kroc @RabidGravy ah, okay, I see. Thank you, it's some direction at least, but dissapointing that Perl6 lacks this out of the box. Thanks kindly for the help
20:28 RabidGravy of course a patch to implement would be gratefully received
20:29 RabidGravy or indeed release as a module
20:29 [Coke] .tell lucasb the REPL prints the return value if and only if you didn't print anything.
20:29 yoleaux [Coke]: I'll pass your message to lucasb.
20:31 Kroc RabidGravy Do you know what this strange opperator sequence is? `>>%>>`
20:32 RabidGravy never seen it before :-O
20:32 dha ok, pull request submitted.
20:32 dha Yay! I changed a word in the docs!
20:32 dha :-)
20:33 Kroc Ah, I think it means modulo 255 for all elements
20:33 RabidGravy it does modulus for the elements on the LHS yes
20:34 RabidGravy m: say <1 2 3 4> >>%>> 2
20:34 camelia rakudo-moar 40a953: OUTPUT«(1 0 1 0)␤»
20:34 RabidGravy I kind of guessed
20:35 Kroc Cool
20:37 dogbert2 Thx for the quick fix, dha++
20:38 RabidGravy It's actually, sort of three operators a 'hyper' a modulus, and another hyper
20:38 timotimo i wouldn't really call it three
20:39 timotimo since any two of them won't be able to stand on their own
20:40 Kroc gtg, thanks
20:40 dha joined #perl6
20:41 b2gills joined #perl6
20:41 RabidGravy timotimo, no, but it "looks" like that, which makes it easy to guess what it does
20:43 timotimo like [+]? :P
20:46 masak weak references and finalization proposed for JS: https://ponyfoo.com/articles/weakref
20:47 wilcov joined #perl6
20:47 timotimo FWIW, i'd like to see weak references in moar, too ... :(
20:47 masak when reading that article, it's not clear to me that those finalizers would be any more useful than in other languages (that is, not very useful/reliable at all)
20:50 sue joined #perl6
20:57 timotimo dha: you still around?
20:57 dha yep
20:57 timotimo dha: your pull request seems to contain a bunch of commits that have nothing to do with what the pull request was supposed to do
20:57 timotimo like multiple merges of master into your local repository
20:57 * dha looks
20:57 timotimo i suppose you had some commits unpushed locally and "git pull"'d multiple times
20:58 timotimo personally, i'd note down the sha1 of the commit you want to push upstream, git checkout -b my_fancy_patch, git reset --hard origin/master (this will discard any local changes that "git diff" would report, so be careful, of course), git cherry-pick the_sha1_you_noted_down
20:59 timotimo and then you can push that to your fork overwriting the branch you've pull-requested from
20:59 pmurias joined #perl6
20:59 pmurias masak: weak references are useful
20:59 timotimo github will then automatically update the pull request accordingly
20:59 dha yeah... weird. I just used the web interface on github to create a pull request, and it seems to have taken everything I've done in my repo lately and dumped them in.
20:59 timotimo oh, that's annoying
21:00 dha It's possible I do not understand the pull request function on the website fully. Or it may just suck.
21:00 timotimo i'd say it's probably bugged :)
21:00 dha Sorry about that.
21:01 timotimo no worries :)
21:01 RabidGravy I think it just creates a patch with the commits not in the target repo
21:02 RabidGravy which is dumb but probably not bugged
21:02 timotimo huh. even when you just edit a file in the original repo with the "edit this file" button?
21:02 timotimo i suppose it's at least counter-intuitive
21:03 dha It's software. Ergo, it sucks.
21:05 espadrine joined #perl6
21:13 dalek DBIish: aa5252e | (Salvador Ortiz)++ | / (5 files):
21:13 dalek DBIish: Oracle: Add DATE and TIMESTAMP support
21:13 dalek DBIish:
21:13 dalek DBIish: Closes #41
21:13 dalek DBIish: review: https://github.com/perl6/DBIish/commit/aa5252e91c
21:16 TEttinger joined #perl6
21:17 lizmat joined #perl6
21:18 * lizmat waves from the beautiful County Clare
21:18 lizmat will now start on finishing this week's P6W....  let me know if you have something to tell!
21:20 timotimo lizmat: skarsnik had a blog post that he wanted to have mentioned in the weekly last week
21:20 Xliff How do I get fpaste to link into here?
21:21 TEttinger joined #perl6
21:22 lizmat timotimo: found it, adding it...
21:22 timotimo excellent
21:24 masak 'night, #perl6
21:24 jnthn lizmat: Sadly, lacked energy to finish my blog post in time for this week...though I did one last week :)
21:25 Xliff Heads up, #perl6
21:25 Xliff https://gist.github.com/Xliff/9​f451357e87542162b4b1a32cd30bc9f
21:25 Xliff Let me know if more information is needed, or if this is just a result of bad library bindings.
21:25 Xliff Thanks.
21:25 teatime don't be mad at me, but I just ran across this:  http://classicprogrammerpaintings.tumblr.c​om/post/142548884409/larry-wall-presents-p​erl-6-1632-rembrandt-van?is_related_post=1
21:25 tadzik oh gods
21:26 dha That doesn't really look like Larry.
21:26 teatime would it be more accurate if it was a painting of lazarus or mary magdalene at jesus' tomb? :)
21:27 timotimo that'd be more appropriate for something about emacs
21:28 tadzik Xliff: from the looks of it it's probably an internal moarvm bug
21:29 tadzik steps to achieve a similar crash would definitely help a lot :)
21:29 Xliff tadzik: It's intermittent, but I will keep updating the gist as I find out more.
21:29 Xliff And is anyone bothered that the "perl6" in question is a corpse?
21:30 ZoffixWin corpse?
21:30 tadzik it's an ex-parrot
21:30 * tadzik hides
21:30 ZoffixWin ah
21:30 teatime Xliff: I beleive that was the joke :(
21:30 Xliff (ha ha) @GClaramunt
21:30 Xliff teatime: It's a bad thing when the so-called joke does not illicit any laughs.
21:31 teatime bah, it's healthy to be able to laugh at yourself.
21:31 ZoffixWin lizmat, for P6W: Perl 6 is now available on http://glot.io/ so users can run some code in browser.
21:31 Xliff teatime: But of course! If it's funny.
21:31 timotimo i can't laugh at myself when i'm dead
21:31 lizmat ZoffixWin: already meantioned  :-)
21:31 Xliff Now if the corpse was in fact a dead parrot. Then it would be funny!
21:31 ZoffixWin \o/
21:31 * Xliff hides behind tadzik
21:32 lizmat jnthn: yeah, already mentioned...  keep up the good work!  There'll be another weekly  :-)
21:34 jnthn Xliff: The reason for "sometimes fails, sometimes not" is almost certainly ASLR (your OS randomizing the details of memory layout from run to run)
21:34 jnthn Xliff: I think the best bit is to run it with valgrind
21:35 jnthn Xliff: There's even a perl6-valigrind-m that you can run it with
21:35 jnthn Xliff: It's very possibly a bindings bug; valgrind will give some insight
21:35 Begi joined #perl6
21:36 Xliff jnthn, Thanks for the suggestion! I will try that.
21:37 Xliff Running now.
21:37 jnthn Yeah. Valgrind pro tip: be patient. ;)
21:38 jnthn (It's great but...slow :))
21:38 timotimo yes. even when you already expect it to be dog slow, it ends up being about 3x slower than you anticipated
21:39 jnthn Yeah. But it's fine. 'cus the correct thing to measure it against is often "how long would it take me to find this bug without valgrind", and then it comes out like 10x faster :P
21:39 Xliff LOL
21:39 Xliff jnthn++
21:39 Xliff Updating gist with perl6-valgrind-m output.
21:40 Xliff Updated.
21:41 jnthn Nice
21:41 jnthn ==1861== Invalid write of size 4
21:41 jnthn ==1861==    at 0x7F487D7: ogg_stream_init (in /usr/lib/i386-linux-gnu/libogg.so.0.8.2)
21:41 jnthn There's where it gets interesting
21:41 Xliff Yeah.
21:41 jnthn So, very likely something with the binding
21:41 Xliff It's probably in the struct signature. I will have to look at that.
21:42 Xliff Thanks again for the suggestion, jnthn!!
21:42 jnthn Yeah, it'll be somewhere downstream of ogg_stream_state.new I guess
21:43 Xliff Most likely something in class ogg_stream_state()
21:44 Xliff Or could be something with the serial number passed to ogg_stream_init.
21:44 Xliff I will need to work with my C test harness for comparison.
21:44 Xliff Of course... that is later... Must. Leave. House!
21:48 adrusi left #perl6
21:51 jnthn :)
21:51 jnthn And rest time for me
21:51 jnthn 'night, #perl6
21:51 Sgeo joined #perl6
21:51 timotimo gnite jnthn!
21:59 ZoffixWin lizmat++ good weekly
21:59 lizmat https://p6weekly.wordpress.com​/2016/04/11/2016-15-wow-blogs/
22:00 lizmat gnight jnthn
22:01 * lizmat is also tired, so wishes #perl6 a good night
22:01 timotimo gnite lizmat
22:03 dvinciguerra_ joined #perl6
22:15 dalek ecosystem: daf02b4 | (Martin Barth)++ | META.list:
22:15 dalek ecosystem: Update META.list
22:15 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/daf02b45f7
22:15 dalek ecosystem: 9d6a7c6 | (Zoffix Znet)++ | META.list:
22:15 dalek ecosystem: Merge pull request #193 from ufobat/patch-1
22:15 dalek ecosystem:
22:15 dalek ecosystem: taking project ownership of bailador
22:15 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/9d6a7c6c76
22:17 * ZoffixWin tries to spot the "Squash and merge" button GitHub advertized recently.
22:17 kid51 joined #perl6
22:20 timotimo the "accept pull request" button has a little downward arrow button next to it
22:20 skids joined #perl6
22:25 * ZoffixWin tries to spot the "accept pull request" button :)
22:26 ZoffixWin It appears there may be a problem with this PR, so I'll leave it and try to find the elusive button later :)
22:28 BenGoldberg joined #perl6
22:45 dwarring joined #perl6
22:45 Actualeyes joined #perl6
22:49 Xliff unsigned char    header[282]; <- How would I convert that to NativeCall rep?
22:49 BenGoldberg joined #perl6
22:51 timotimo is that part of a struct?
22:53 Xliff Yeah
22:54 timotimo i'm not sure we actually support that yet ... finally :\
22:54 timotimo however, you can do pointer magic manually :(
22:54 Xliff Oh?
22:54 timotimo like, build a CArray[uint8].new and resize it to how big it has to be for the whole struct
22:54 Xliff Ooo...
22:54 Xliff However!
22:55 Xliff And this is what I am worried about....that will affect the overall size of the struct.
22:55 timotimo and by casting it to a CPointer, add the 282 and nativecast that to a CStruct of the rest you're interested in
22:55 timotimo that's basically the worst thing ever.
22:55 timotimo yeha, that's why you'd have to do manual memory management :|
22:55 Xliff timotimo, Aaiee! How would that look? Is there an example somewhere I can look at?
22:56 Xliff Coz that part of the struct looks like this:
22:56 Xliff unsigned char    header[282];      /* working space for header encode */
22:56 Xliff int              header_fill;
22:56 timotimo not aware of one, but it'd basically be how i described it up there :P
22:56 Xliff So header_fill is 282 bites out from "header" char pointer.
22:57 timotimo can you nopaste the rest of the whole struct? or give a link otherwise?
22:57 Xliff And THAT is probably why I am getting "==1861== Invalid write of size 4" when I am using it.
22:57 Xliff timotimo: Yeah.I will pastebin. Or would you prefer fpaste?
22:57 timotimo don't care either way :)
22:58 Xliff http://pastebin.com/jS13fHRA
22:59 timotimo hum. CArray doesn't actually have the methods for creating one with a given size
22:59 timotimo ugh, there's lots of interesting stuff after it, too :\
22:59 timotimo do you need access to all those fields?
23:00 timotimo m: say 282 / 64
23:00 camelia rakudo-moar 40a953: OUTPUT«4.40625␤»
23:00 timotimo m: say 282 - 4 * 64
23:00 camelia rakudo-moar 40a953: OUTPUT«26␤»
23:00 timotimo m: say 26 - 16 - 8
23:00 camelia rakudo-moar 40a953: OUTPUT«2␤»
23:00 timotimo what you can do is give your struct these fields:
23:01 timotimo wait, i made a mistake
23:01 Xliff I don't, but I'm pretty sure the C libs are expecting something of the proper size.
23:01 timotimo m: say 282 / 8
23:01 camelia rakudo-moar 40a953: OUTPUT«35.25␤»
23:02 timotimo you just need 35 int64 fields and one int8 field
23:02 Xliff LOL!
23:02 Xliff I was wondering if that's where you were going with that.
23:02 timotimo :)
23:02 Xliff It would be an interesting experiment! That's for sure.
23:02 timotimo m: use NativeCall; my $right_sized_thing = CArray[uint8].new(0 xx 400);
23:02 camelia rakudo-moar 40a953: ( no output )
23:02 timotimo this is how you can get a carray of the right size
23:03 Xliff Maybe I could have a specialized new() for that class to do the proper thing with CArray?
23:03 timotimo then you can nativecast(TheRightTypeOfThing, $right_sized_thing)
23:03 Xliff And not spam my class with numerous attributes.
23:04 sortiz Xliff, You need to pass an allocated pointer or receiving one for that struct?
23:04 Xliff So $.header = CArray[uint8].new(0 xx 282);
23:05 Xliff sortiz: No. Need to define struct as I will be passing it to C routines via nativelib.
23:05 timotimo sorry, that won't work
23:05 Xliff Eh. KNEW it wouldn't be that simple.
23:05 timotimo you'll have to have the right number of bytes for the whole thing
23:05 Xliff OOOOO!
23:05 timotimo then you have an opaque blob of memory that is the right size for anything that expects an ogg_stream_state
23:06 Xliff Gotcha.
23:06 timotimo you can have a CStruct for everything before that header field and nativecast to that to get the fields accessed properly if you want
23:08 timotimo if you want the fields after that header piece, you can nativecast the CArray to a CPointer[uint8], add the offset to header_fill (or maybe e_o_s?) and nativecast that to a CStruct that represents everything in the tail of the ogg_stream_state struct
23:09 Xliff my $ss = CArray[uint8].new(0 xx 360); $ss = nativecast(ogg_stream_state, $ss);
23:09 timotimo i think recently someone worked on making it possible to have a CArray inside a CStruct with a number of slots, but i don't think it got finished
23:09 Xliff Rather than do that, I could do that in class ogg_stream_state { sub new () { } }
23:10 Xliff Lemme try that and see if it makes valgrind happy.
23:10 timotimo hm, may need to be a bit more careful
23:10 Xliff Howso?
23:10 timotimo as the class ogg_stream_state must still be the right kind of repr for the nativecast to work
23:10 timotimo OpaquePointer would be enough for your purposes, i believe
23:10 Xliff yeah.
23:10 Xliff repr('CStruct')
23:11 Xliff Crap. It needs to be OpaquePointer? I still haven't wrapped my head around that one, yet.
23:11 timotimo doesn't have to be
23:11 timotimo CStruct would be fine, since you're not relying on the .bless function you've got for free from NativeCall
23:12 timotimo if someone ends up trying to .bless or go via the derived constructor, it'll end up being too small and libogg would asplode when using it
23:14 Xliff Yeah. I don't expect that and will make a note in the docs... 'Don't. Do. Dat!"
23:14 Xliff Good stuff!
23:15 timotimo you can then build some methods that'll do the nativecast into CStruct and allow access to the attributes dance
23:15 timotimo that might be a bit wordy, though
23:15 timotimo we really just want to have sized CArray support inside CStruct
23:18 * sortiz And mutable Pointer inside CStruct, btw
23:19 Xliff timotimo: Wait. So you are saying I need a separate class that has the attributes?
23:19 * Xliff patiently waits for valgrind.
23:20 Xliff Still reporting "==2196== Invalid write of size 4" in valgrind.
23:21 * Xliff makes note to try a wrapper class with repr('OpaquePointer') and an access class defined as normal.
23:22 Xliff I'm thinking I might just have to have that wordy struct for $.header.
23:23 Xliff And just have a method using pack() to get at it.
23:23 Xliff (Or is it unpack().... I can never get those right)
23:25 sortiz Xliff, OpaquePointer isn't a REPR.
23:26 dalek DBIish: 376663c | (Salvador Ortiz)++ | / (5 files):
23:26 dalek DBIish: Workaround for "Cannot invoke this object"
23:26 dalek DBIish:
23:26 dalek DBIish: Somehow we can't die inside our closure so let the caller die for us.
23:26 dalek DBIish: dha++ for report.
23:26 dalek DBIish: + Tests for missing libraries
23:26 dalek DBIish: review: https://github.com/perl6/DBIish/commit/376663c248
23:28 timotimo oh, it used to be called OpaquePointer, but now it's just called CPointer, is it?
23:28 BenGoldberg That's horribly biased.  What if I got a pointer from, say, fortran?
23:29 Xliff sortiz: Not a REPR, but just a NativeCall type, then?
23:30 Xliff Well, next step is to go the specialized struct of 282 bytes.
23:31 timotimo if you do build that struct with the 35-and-a-quarter int64 objects, you can just include it with "HAS" instead of "has"
23:32 Xliff Right
23:42 dalek ecosystem: 6df5770 | RabidGravy++ | META.list:
23:42 dalek ecosystem: Add Lumberjack::Application
23:42 dalek ecosystem:
23:42 dalek ecosystem: See https://github.com/jonathans​towe/Lumberjack-Application
23:42 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/6df57707e2
23:47 jack_rabbit joined #perl6
23:48 RabidGravy Now I can get back to finishing Sofa
23:49 Actualeyes joined #perl6
23:51 RabidGravy anyway now to bed. Toodles
23:54 ZoffixWin night
23:59 Azry_ joined #perl6

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

Perl 6 | Reference Documentation | Rakudo