Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-11-13

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:20 garu timotimo: interesting, thanks! If I may bug you just a bit further, do you know why this was decided like so? I think it might have something to do with allowing signatures to spot Pair objects, but I'm not sure
00:21 kyclark_ joined #perl6
00:21 garu I'd love to hear more about the design process behind the language :)
00:22 grondilu there are the apocalypses
00:23 garu also, is there any way to pass named arguments with spaces in them?
00:23 garu grondilu: yeah, but I gather they have changed a lot over the years, haven't they?
00:24 timotimo sorry
00:27 grondilu WIP of a NativeCall interface to Binaryen:  http://paste.debian.net/895092/
00:27 grondilu It seems to be working but literals will likely be an issue.
00:28 timotimo i have no idea what bynaryen is
00:29 garu joined #perl6
00:29 grondilu wasm C API
00:29 timotimo web asm?
00:30 garu (sorry, got disconnected)
00:30 timotimo garu: named arguments are 100% static syntax, in addition there's hash flattening which makes things behave a whole lot different
00:31 garu timotimo: interesting! I think I'm bumping into this more often than I hoped for :/
00:31 grondilu timotimo: webassembly
00:31 timotimo right
00:34 garu so if I want a method x to accept x(foo => 42, bar => 21) and x('foo' => 42, 'bar' => 21) and my %h = (foo => 42, bar => 21); x(%h), what should the signature be?
00:34 AlexDaniel garu: fwiw, this was a nice post: https://perl6advent.wordpress.com/20​14/12/24/day-24-seeing-wrong-right/
00:35 garu (assuming I'd want to handle them all as a hash, say %foo)
00:36 timotimo you have to pass |%h
00:36 timotimo the signature would accept a foo and a bar named argument
00:37 timotimo if you want to accept the positional pair objects, too, just accept positionals
00:37 bjz joined #perl6
00:38 AlexDaniel m: sub x(+%z) { say %z.perl }; x(‘foo’ => 42, ‘bar’ => 42); my %h = (foo => 42, bar => 21); x(%h)
00:38 camelia rakudo-moar aa86b9: OUTPUT«[:foo(42), :bar(42)]␤[:bar(21), :foo(42)]␤»
00:39 AlexDaniel timotimo: ?
00:39 AlexDaniel am I missing anything?
00:39 timotimo huh? +%z? that's news to me
00:39 timotimo cool.
00:40 AlexDaniel to be honest I don't really remember the difference between * and +
00:40 timotimo well, + gives you "one arg" semantics
00:40 timotimo that's probably what makes %h work
00:41 timotimo i mean passing %h
00:41 garu hmm
00:41 timotimo if it's just one argument, it'll be iterated over
00:41 garu AlexDaniel: the only difference between your example and mine is your signature was (+%z) and mine was (*%z)
00:41 AlexDaniel m: sub x(**%z) { say %z.perl }; x(‘foo’ => 42, ‘bar’ => 42); my %h = (foo => 42, bar => 21); x(%h)
00:41 camelia rakudo-moar aa86b9: OUTPUT«Too many positionals passed; expected 1 argument but got 2␤  in sub x at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
00:41 garu I definitely need to understand this better :/
00:42 garu AlexDaniel++
00:42 garu timotimo++
00:42 garu thanks!
00:42 AlexDaniel see https://docs.perl6.org/type/Signature#Slurpy_%28A.K.A._Variadic%29_Parameters and https://docs.perl6.org/languag​e/functions#Slurpy_Conventions
00:43 garu ok, while we're at it, I also have a question regarding return values :)
00:43 AlexDaniel commit: 6c sub x(*%z) { say %z.perl }; x(‘foo’ => 42, ‘bar’ => 42); my %h = (foo => 42, bar => 21); x(%h)
00:43 committable6 AlexDaniel, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016​.06,2016.07.1,2016.08.1,2016.09,2016.10,HEAD»: Too many positionals passed; expected 0 arguments but got 2␤  in sub x at /tmp/7tg9aqOrbv line 1␤  in block <unit> at /tmp/7tg9aqOrbv line 1␤ «exit code = 1»
00:43 AlexDaniel hmm, and just for fun
00:43 AlexDaniel commit: all sub x(*%z) { say %z.perl }; x(‘foo’ => 42, ‘bar’ => 42); my %h = (foo => 42, bar => 21); x(%h)
00:44 garu sub x { my $a = 42, my @b = (3,2,1); return $a,@b }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
00:44 committable6 AlexDaniel, https://gist.github.com/b28c​38d0ea1ba2ffe248423586925fcf
00:44 garu In the code above @y becomes [[3,2,1]], I wanted [3,2,1]
00:44 garu what am I doing wrong?
00:46 garu any clues?
00:46 AlexDaniel well, let me demonstrate
00:47 AlexDaniel m: sub x { my $a = 42, my @b = 3,2,1; return $a,@b,42 }; my ($x,@y) = x; $x.perl.say; @y.perl.say
00:47 camelia rakudo-moar aa86b9: OUTPUT«42␤[[3, 2, 1], 42]␤»
00:47 grondilu m: use NativeCall; constant size_t := uint32;
00:47 camelia rakudo-moar aa86b9: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Redeclaration of symbol 'size_t'␤at <tmp>:1␤------> 3se NativeCall; constant size_t := uint327⏏5;␤»
00:47 grondilu m: use NativeCall; print size_t;
00:47 camelia rakudo-moar aa86b9: OUTPUT«Use of uninitialized value of type NativeCall::Types::size_t in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤  in block <unit> at <tmp> line 1␤»
00:48 AlexDaniel garu: so one way to make it work is to use $y to hold your variable
00:48 AlexDaniel to hold your array*
00:49 AlexDaniel another way is to flatten it…
00:49 AlexDaniel m: sub x { my $a = 42, my @b = 3,2,1; return $a,@b }; my ($x,@y) = x.flat; $x.perl.say; @y.perl.say
00:49 camelia rakudo-moar aa86b9: OUTPUT«42␤[3, 2, 1]␤»
00:50 AlexDaniel and the sane way to do it does not seem to work, hmmhmm…
00:50 garu AlexDaniel: buy interface-wise I kinda need to return an (Str, Array) I think
00:51 garu I could change things, sure, but I wonder how to make that work
00:51 AlexDaniel garu: return $a,@b already returns array as a second element
00:51 AlexDaniel that's why @y ends up having the whole array inside its first argument
00:52 garu yeah but is there a way to magically flatten it so @y ends up with 3 arguments instead?
00:53 garu I tried return $a, @b.flat but it didn't exactly do what I wanted :X
00:53 garu then I learned .flat returns a Seq
00:54 AlexDaniel garu: well you can do $a,|@b but I don't recommend you to
00:54 garu why?
00:54 garu hey, it works!
00:54 garu urm... why don't you recommend that?
00:55 AlexDaniel well, first of all you said you want to return (Str, Array) and not (Str, array elements here, …)
00:56 AlexDaniel but it depends on your needs. Personally I'd much rather let the user of sub x decide which behavior he wants
00:57 garu so you'd return an array as a single argument and get it as my ($x,$y) = x()
00:57 garu is that right?
00:57 AlexDaniel I think so, yes
00:57 garu ok, I can do that :)
00:57 garu thanks for the help!
00:58 AlexDaniel garu: personally, I find | very scary and I'm not even sure if it works well in this case
00:58 AlexDaniel perhaps it works OK in this case, but I don't know…
00:58 garu (it did - I mean, it returned that flattened list and my test passed)
00:58 garu but I can try to work it like you said I think
00:58 AlexDaniel perhaps others can help :)
00:59 garu I want my Perl 6 code to look more idiomatic
00:59 garu but I find myself doing Perl 5 in Perl 6 :X
00:59 garu (and expecting the same results)
00:59 AlexDaniel OK, yes, I am right, | does not work here
01:00 AlexDaniel garu: if you decide to go this way, then either use 「return $a, slip @b」 or 「return flat($a, @b)」
01:00 garu m: sub x { my $a = 42, my @b = 3,2,1; return $a,|@b }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
01:00 camelia rakudo-moar aa86b9: OUTPUT«42␤[3, 2, 1]␤»
01:00 garu ^^^ what's wrong with that?
01:00 AlexDaniel that's not the right way to test |
01:00 AlexDaniel let me demonstrate…
01:01 AlexDaniel m: sub x { my $a = 42, my @b = 3 xx 5; return $a,|@b }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
01:01 camelia rakudo-moar aa86b9: OUTPUT«42␤[3, 3, 3, 3, 3]␤»
01:01 AlexDaniel m: sub x { my $a = 42, my @b = 3 xx 99999; return $a,|@b }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
01:01 camelia rakudo-moar aa86b9: OUTPUT«Too many arguments in flattening array.␤  in sub x at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
01:01 AlexDaniel m: sub x { my $a = 42, my @b = 3 xx 99999; return $a, slip @b }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
01:01 camelia rakudo-moar aa86b9: OUTPUT«42␤[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3…»
01:01 garu ah, I was looking into slip earlier but couldn't get it right
01:01 AlexDaniel m: sub x { my $a = 42, my @b = 3 xx 99999; return flat($a, @b) }; my ($x,@y) = x(); $x.perl.say; @y.perl.say
01:01 camelia rakudo-moar aa86b9: OUTPUT«42␤[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3…»
01:02 garu stil looks right... right?
01:02 AlexDaniel garu: look again
01:02 AlexDaniel garu: the one with $a,|@b definitely does not look right
01:03 garu oops, sorry I was looking at the last example, didn't see it was using flat()
01:03 AlexDaniel my rule of thumb is “never use |”, there's always a better way
01:03 garu is it supposed to give the "too many arguments"?
01:04 garu (and if so, why?)
01:05 AlexDaniel garu: actually, use @b.Slip instead of slip @b
01:05 AlexDaniel because seems like it works faster…
01:07 AlexDaniel .tell lizmat fwiw, 「slip @b」 seems to work much slower than 「@b.Slip」. I have no idea, maybe that's how it should be, but perhaps you might want to take a look
01:07 yoleaux AlexDaniel: I'll pass your message to lizmat.
01:08 AlexDaniel .tell lizmat e.g. 「my @alot = 3 xx 99999; say (slip @alot).perl」 vs 「my @alot = 3 xx 99999; say (@alot.Slip).perl」
01:08 yoleaux AlexDaniel: I'll pass your message to lizmat.
01:09 AlexDaniel garu: I don't know
01:09 aborazmeh joined #perl6
01:09 aborazmeh joined #perl6
01:10 garu that's ok. you've been super helpful, thank you!
01:21 AlexDaniel .tell TimToady I was expecting this to work: 「my ($x, [@y]) = 24, [40, 50, 60]; say @y.perl」, but right now it is completely bugged. What would be the right result in this case? See #130079
01:21 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=130079
01:21 yoleaux AlexDaniel: I'll pass your message to TimToady.
01:21 AlexDaniel garu: if you want, you may follow that ticket ↑
01:22 AlexDaniel I have a gut feeling that it was supposed to work, but I have no idea
01:23 AlexDaniel garu: in any case, “null object” should not appear there. So thanks to you one bug found :)
01:26 MasterDuke m: grammar G { token TOP { "foo" \s* [ \s "bar" ]? } }; say G.parse("foo      bar")
01:26 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:27 MasterDuke m: grammar G { regex TOP { "foo" \s* [ \s "bar" ]? } }; say G.parse("foo      bar")
01:27 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:28 MasterDuke m: say $/ if "foo      bar" ~~ / "foo" \s* [ \s "bar" ]? /
01:28 camelia rakudo-moar aa86b9: OUTPUT«「foo      」␤»
01:29 AlexDaniel MasterDuke: are you trying to say that it is a bug? :)
01:29 MasterDuke ^^^ am i crazy for thinking at least the last two of those should match the whole input string?
01:29 grondilu https://github.com/grondilu/binaryen-bindings
01:29 AlexDaniel m: grammar G { regex TOP { "foo" \s* [ \s "bar" ]? } }; say G.parse("foo      bar")
01:29 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:30 AlexDaniel m: grammar G { regex TOP { "foo" \s* [ \s "bar" ]? $ } }; say G.parse("foo      bar")
01:30 camelia rakudo-moar aa86b9: OUTPUT«「foo      bar」␤»
01:30 AlexDaniel m: grammar G { regex TOP { "foo" \s* [ \s "bar" ] } }; say G.parse("foo      bar")
01:30 camelia rakudo-moar aa86b9: OUTPUT«「foo      bar」␤»
01:31 AlexDaniel MasterDuke: here is a golfed down version
01:31 AlexDaniel m: grammar G { regex TOP { "a" || "abc" } }; say G.parse("abc")
01:31 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:31 AlexDaniel MasterDuke: so this is what happens
01:31 bjz joined #perl6
01:32 AlexDaniel MasterDuke: top tries to match "a", and it works, so it is happy
01:32 AlexDaniel MasterDuke: but .parse for some reason is not, because it wants the whole thing to match… or so it seems?
01:36 AlexDaniel MasterDuke: right here: https://github.com/rakudo/rakudo/b​lob/cb8f783eeb8ab25a5090fdc4e5cc31​8c36ee1afa/src/core/Grammar.pm#L25
01:36 MasterDuke ah
01:37 AlexDaniel $match.to == target.chars ?? $match !! Nil
01:37 AlexDaniel so it is a bug indeed…
01:37 dalek doc: 7ff9021 | coke++ | doc/Type/X/Proc/Unsuccessful.pod6:
01:37 dalek doc: remove trailing whitespace
01:37 synopsebot6 Link: http://doc.perl6.org/type/X/Proc/Unsuccessful
01:37 dalek doc: review: https://github.com/perl6/doc/commit/7ff90214dd
01:37 MasterDuke m: grammar G { regex TOP { "a" | "abc" } }; say G.parse("abc")
01:37 camelia rakudo-moar aa86b9: OUTPUT«「abc」␤»
01:37 AlexDaniel no, not |
01:38 AlexDaniel | does longest token matching, if I'm not mistaken
01:38 AlexDaniel so it's "abc" || "a" in reality
01:38 AlexDaniel m: grammar G { regex TOP { "abc" || "a" } }; say G.parse("abc")
01:38 camelia rakudo-moar aa86b9: OUTPUT«「abc」␤»
01:38 AlexDaniel m: grammar G { regex TOP { "a" || "abc" } }; say G.parse("abc")
01:38 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:39 AlexDaniel m: grammar G { regex TOP { "a" | "abc" } }; say G.parse("abc")
01:39 camelia rakudo-moar aa86b9: OUTPUT«「abc」␤»
01:39 AlexDaniel m: grammar G { regex TOP { "abc" | "a" } }; say G.parse("abc")
01:39 camelia rakudo-moar aa86b9: OUTPUT«「abc」␤»
01:39 AlexDaniel MasterDuke: will you submit a ticket?
01:41 travis-ci joined #perl6
01:41 travis-ci Doc build errored. Jan-Olof Hendig 'Fixed another broken link'
01:41 travis-ci https://travis-ci.org/perl6/doc/builds/175359360 https://github.com/perl6/doc/com​pare/67e6927ac82c...cbbc38acdf34
01:41 travis-ci left #perl6
01:41 MasterDuke well, i'm not exactly sure it is a bug. perl -E 'say "$1" if ("foo      bar" =~ /foo \s* (\s bar)? /x)' prints nothing also
01:43 MasterDuke "Method parse only succeeds if the cursor has arrived at the end of the target string when the match is over."
01:43 MasterDuke https://docs.perl6.org/type/Grammar#method_parse
01:45 AlexDaniel m: grammar G { regex TOP { "a" | "abc" } }; say G.subparse("abc")
01:45 camelia rakudo-moar aa86b9: OUTPUT«「abc」␤»
01:45 MasterDuke m: grammar G { token TOP { "foo" \s*  || "foo" \s* \s "bar" } }; say G.parse("foo      bar")
01:45 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:45 MasterDuke m: grammar G { token TOP { "foo" \s*  | "foo" \s* \s "bar" } }; say G.parse("foo      bar")
01:45 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:47 MasterDuke m: grammar G { token TOP { ["foo" \s*] | ["foo" \s+ "bar"] } }; say G.parse("foo      bar")
01:47 camelia rakudo-moar aa86b9: OUTPUT«「foo      bar」␤»
01:47 MasterDuke m: grammar G { token TOP { ["foo" \s*] || ["foo" \s+ "bar"] } }; say G.parse("foo      bar")
01:47 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:47 AlexDaniel I still think that it is a bug
01:48 AlexDaniel it could've arrived to the end, but it has no information in the rule itself that it should attempt to do so
01:48 AlexDaniel so it bails out and then all of sudden .parse method is unhappy
01:49 AlexDaniel .subparse is also wrong because we probably don't want it to match partially
01:49 MasterDuke i don't like it, but i'm not quite 100% convinced
01:49 AlexDaniel basically the solution is to always put $ in the end of your TOP
01:49 AlexDaniel if you don't have $ in your TOP then it does not work as you expect…
01:50 AlexDaniel I mean, sure, we can add another trap to our documentation
01:50 AlexDaniel or we can just fix the damn thing, I guess…
01:50 AlexDaniel I'll submit a ticket then
01:50 MasterDuke .ask TimToady do you mind looking at https://irclog.perlgeek.de/p​erl6/2016-11-13#i_13557942? is there something wrong or are we just expecting incorrect behavior?
01:50 yoleaux MasterDuke: I'll pass your message to TimToady.
01:51 Xliff Well, now I need to find a testing suite for libxslt.
01:51 yoleaux 12 Nov 2016 14:44Z <raiph> Xliff: Aiui the only thing that makes a data block in P6 a data block is that it's a pod block called 'data'. So the 'foo' and 'qux' blocks don't count. I'll tighten the SO lang to try make that clearer.
01:52 Xliff .tell raiph Yes, but __DATA__ blocks aren't always "data" blocks in p5. They can be almost anything but are still referred to as "data blocks". I think we have the intent of the OP clear enough, just splitting hairs over names.
01:52 yoleaux Xliff: I'll pass your message to raiph.
01:53 Xliff LOL! Tests done in python! Close enough.
01:53 Xliff http://xmlsoft.org/XSLT/python.html
01:54 pyrimidine joined #perl6
01:54 MasterDuke AlexDaniel: hmm, the perl 5 version works if you add a $ anchor at the end
01:55 MasterDuke m: grammar G { token TOP {^ "foo" \s* [ \s "bar" ]? $} }; say G.parse("foo      bar")
01:55 camelia rakudo-moar aa86b9: OUTPUT«Nil␤»
01:56 AlexDaniel MasterDuke: perl5 version works anyway
01:57 AlexDaniel MasterDuke: perhaps you've not noticed because you didn't 「use warnings;」, e.g. perl -wE
01:58 MasterDuke what do you mean works? it doesn't capture ' bar' into $1
01:58 AlexDaniel MasterDuke: why would it?
01:59 AlexDaniel MasterDuke: perl -wE 'say "ok" if "abc" =~ /b/x' # ok
01:59 AlexDaniel it does not attempt to match from the beginning, and it doesn't attempt to match till the end
02:00 AlexDaniel so once 「foo \s*」 matches there's no need to backtrack, the solution is just fine
02:01 MasterDuke the behavior i want is "capture the optional bit if it's there, but succeed anyway (without capturing anything obviously) if it isn't"
02:03 AlexDaniel well in this case you probably want [\s+ bar || \s*]
02:06 MasterDuke yup, that works
02:06 pyrimidine joined #perl6
02:09 MasterDuke i guess that's the problem with matching vs capturing. just to match it makes sense to bail out as soon as you know either way, but for capturing (and i guess i really mean parsing here) that's not always desired
02:10 araujo joined #perl6
02:15 pyrimidine joined #perl6
02:17 bjz_ joined #perl6
02:19 FROGGS_ joined #perl6
02:34 pyrimidine joined #perl6
02:46 pyrimidine joined #perl6
02:47 ilbot3 joined #perl6
02: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!
02:49 amalia_ joined #perl6
03:17 araujo joined #perl6
03:29 AlexDaniel .tell TimToady ↑ #130081
03:29 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=130081
03:29 yoleaux AlexDaniel: I'll pass your message to TimToady.
03:43 noganex joined #perl6
03:52 kyclark_ joined #perl6
03:54 pyrimidine joined #perl6
03:57 garu AlexDaniel: are you still there? I'm found an "issue" with our previous signature solution
04:00 garu AlexDaniel: sub x(+%z) gets x("foo"=>1) and %h=(foo=>1); x(%h), but not x(foo=>1)
04:01 garu also, I'm getting an array of pairs both times... how can I coerce it to a hash?
04:02 garu or is this one of those "I'm still thinking in Perl 5" moments?
04:05 kyclark_ joined #perl6
04:06 pyrimidine joined #perl6
04:11 cyphase joined #perl6
04:13 pyrimidine joined #perl6
04:14 skids joined #perl6
04:27 cyphase joined #perl6
04:41 aborazmeh joined #perl6
04:41 aborazmeh joined #perl6
04:41 cyphase joined #perl6
04:44 mr-foobar joined #perl6
04:56 araujo joined #perl6
04:58 araujo joined #perl6
05:02 pierre_ joined #perl6
05:02 araujo joined #perl6
05:02 araujo joined #perl6
05:17 bjz_ joined #perl6
05:25 pierre_ joined #perl6
05:26 Cabanossi joined #perl6
05:41 timeless joined #perl6
05:41 Spot__ joined #perl6
05:41 w4and0er96 joined #perl6
05:47 canopus joined #perl6
05:51 bjz joined #perl6
06:04 zacts joined #perl6
06:12 bjz joined #perl6
06:18 zrr joined #perl6
06:24 bjz_ joined #perl6
06:48 wamba joined #perl6
07:05 p6_nb joined #perl6
07:18 grondilu On https://docs.perl6.org/language/nativecall#Structs it is written that native functions must pass and returns structs by reference.  So how to deal with function that do it by value?
07:18 grondilu I tried to ignore the problem and got segmentation fault.
07:20 lizmat .
07:20 yoleaux 01:07Z <AlexDaniel> lizmat: fwiw, 「slip @b」 seems to work much slower than 「@b.Slip」. I have no idea, maybe that's how it should be, but perhaps you might want to take a look
07:20 yoleaux 01:08Z <AlexDaniel> lizmat: e.g. 「my @alot = 3 xx 99999; say (slip @alot).perl」 vs 「my @alot = 3 xx 99999; say (@alot.Slip).perl」
07:20 lizmat .tell AlexDaniel see https://github.com/rakudo/rakudo/commit/37d0e46614
07:20 yoleaux lizmat: I'll pass your message to AlexDaniel.
07:20 lizmat commute to T-Dose&
07:21 grondilu that is how would you translate   struct foo { int n; }; struct foo increase(struct foo bar) { struct foo result = { bar.n + 1 }; return result; }
07:21 djbkd joined #perl6
07:23 geekosaur grondilu, I suspect you can't, sanely. struct passing and returning still has weird and platform specific corner cases in C. (it will work if you use the C compiler, but figuring out how to do it from outside is often an exercise in futility even when you can inspect said compiler's source)
07:24 geekosaur this is a common shortcoming in foreign function interfaces and the workaround is almost invariably to defer it to C by making a wrapper that uses pointers and calls the real one
07:24 labster joined #perl6
07:28 geekosaur for example some platforms may quietly rewrite it to use pointers (e.g. stick the value on the stack, then a pointer to that stack value which is used as the real parameter; and for the return make extra space on the stack and either pass that as a hidden parameter or make sure said space is just above the return address and the function returning the struct has to offset everything else by that), while some others may do so only if the struct do
07:28 geekosaur esn't fit into a machine register
07:30 rurban joined #perl6
07:30 geekosaur for a long time K&R C struct return values made a function non-reentrant (it used memory allocated next to the function itself, like pre-Algol activation records)
07:30 geekosaur although ANSI disallowed that
07:32 geekosaur hm, lemme rephrase that. K&R C permitted that, older pcc (what most old-timers think of as "cc") did it that way but newer ones switched to stack allocation to get rid of the "hidden" non-reentrancy
07:40 darutoko joined #perl6
07:49 BenGoldberg joined #perl6
08:06 firstdayonthejob joined #perl6
08:08 grondilu geekosaur: it so happens I was considering writing a C wrapper.  I guess I'll do.
08:13 kent\n joined #perl6
08:18 kurahaupo joined #perl6
08:29 djbkd joined #perl6
08:30 rurban joined #perl6
08:30 djbkd joined #perl6
08:31 djbkd joined #perl6
08:31 Actualeyes joined #perl6
08:32 djbkd joined #perl6
08:43 bjz joined #perl6
08:43 djbkd joined #perl6
08:48 canopus joined #perl6
08:49 rurban joined #perl6
09:09 toolforger joined #perl6
09:15 rindolf joined #perl6
09:15 toolforger I just saw nqp/docs/jvminterop-goals.md mention an "NQP class loader". Does anybody know why NQP wants its own class loader?
09:21 rurban joined #perl6
09:24 rurban joined #perl6
09:28 rindolf joined #perl6
09:38 RabidGravy joined #perl6
09:43 moritz toolforger: is this maybe about loading NQP classes from Java land?
10:10 toolforger No idea
10:11 toolforger you don't need that in Java land, unless you want to achieve something specific
10:11 toolforger such as the ability to unload classes
10:12 toolforger or having a different set of permissions
10:13 moritz you mean Java has native support for loading NQP classes?
10:15 toolforger it has native support for loading an arbitrary byte array as a class
10:16 toolforger assuming that this specific byte array conforms to the rules for class bytecode
10:16 toolforger i.e. it must typecheck at the bytecode level, and a few other things
10:17 toolforger That's why NQP is using asm.jar, it has functions that deal with the nitty-gritty details of creating a bytecode array that the JVM will accept as a class
10:18 bjz_ joined #perl6
10:19 toolforger You can also make a class loader if you want to load a class blob from a data source that's configured differently than what the standard classloader offers
10:20 toolforger though the standard classloaders in Java land are pretty versatile, they can load from .class files, from zip archives (.jar usually), and from URLs
10:20 toolforger Unfortunately, they cannot load from nested zips, that's one of the major reasons why people write classloaders
10:20 pierre_ joined #perl6
10:24 bjz joined #perl6
10:25 toolforger NQP's class loader does not do anything of that kind though, all it does is define a wrapper function that prefills two parameters
10:25 toolforger no new functionality at all
10:26 toolforger so no new data sources, the other things might still happen, that's done in the runtime, not in the classloader itself
10:27 * toolforger goes to check where org.perl6.nqp.runtime.ByteClassLoader is used
10:27 cibs joined #perl6
10:28 [ptc] moritz: I've noticed some links to repos on modules.perl6.org give 404 page.  The reason seems to be that the author has deleted their GitHub account.  How does one handle such situations?
10:28 [ptc] should the modules be removed from the modules list, or should the code be maintained somewhere else?
10:28 [ptc] I've noticed another user had forked at least an earlier version of the code, so the code still exists in some form
10:29 [ptc] *give a 404 page
10:31 espadrine joined #perl6
10:35 rurban joined #perl6
10:37 RabidGravy there's a community modules account for just such a purpose I think
10:38 El_Che RabidGravy: if the specific module has a license that allows that
10:38 RabidGravy if the module was already being used as a dependency then it probably does want to be preserved
10:39 toolforger Hm. NQP does nothing that requires a classloader, unless it's buried somewhere in callback code.
10:40 lizmat joined #perl6
10:42 toolforger Nope. None of the things you do with a classloader, not even there.
10:43 toolforger Whom should I ask about NQP-on-JVM specifics? I might still have missed something.
10:44 [ptc] RabidGravy: they all belong to the user "carbin", hard to tell if they are used as a dependency in something though
10:45 RabidGravy you could probably do something with the projects.json, actually I think I have a little script here that does the reverse dependencies
10:45 RabidGravy 'ang on
10:45 [ptc] oh cool!
10:46 [ptc] and here was me wishing for MetaCPAN for perl6, so I could get the reverse deps :-)
10:47 [ptc] the list I have is: p6-unix-privileges, p6-jdf, p6-fcgi and p6-fcgi-psgi
10:50 RabidGravy a cursory scan of the depended on things would suggest nothing depends on those
10:54 bartolin toolforger: maybe psch or arnsholt. I seem to remember that you had a discussion with them about some jvm/interop stuff before
10:54 toolforger yep
10:55 djbkd joined #perl6
10:56 [ptc] RabidGravy: so should I submit a patch to the modules list to remove these modules?
10:56 * [ptc] hates seeing code go to waste though...
10:57 djbkd_ joined #perl6
11:00 pmurias joined #perl6
11:00 RabidGravy just checking harder
11:00 pmurias toolforger: jnthn is the most familiar with the JVM backend
11:01 toolforger thx
11:02 toolforger What's the best way to contact him? I see him in chat but he hasn't noticed it seems.
11:06 RabidGravy [ptc], there's something weird going on there though
11:06 toolforger Oh, I also see Arne Skjærholt in the git log. That's arnsholt here, right?
11:06 toolforger right, that's his mail address
11:06 RabidGravy the github user 'carbin' was only created on thursday
11:07 [ptc] RabidGravy: that's weird.
11:08 RabidGravy I'll poke a bit more in a bit,
11:08 [ptc] when I searched for one of the modules I found e.g. this: https://github.com/nbrown/p6-jdf
11:08 [ptc] where the user was actually "Carlin"
11:09 [ptc] what if the new "carbin" user is actually a new user?  And has taken the name after the old one deleted their account?  Clutching at straws, I know, but...
11:14 djbkd joined #perl6
11:19 pmurias toolforger: usually jnthn is much more active during the week
11:19 toolforger good to know
11:19 toolforger even if it's unfortunate
11:31 pmurias toolforger: what would using the builtin class loaders directly give us?
11:31 toolforger Less class confusion
11:31 toolforger Classes are not necessarily unique across classloaders
11:32 toolforger e.g. if you have classloaders A and B, you could have MyAwesomeClass loaded twice
11:32 toolforger this becomes nasty if objects cross classloader barriers
11:32 toolforger e.g. in callbacks
11:33 toolforger or generally in APIs
11:34 toolforger e.g. MyApi.doSomething(MyClass m) lives in classloader A and gets handed a MyClass object that lives in classloader B
11:35 toolforger You will get a ClassCastException telling you that org.whatever.MyClass is not compatible with org.whatever.MyClass
11:35 toolforger because the error message does not tell you the classloaders, because classloaders often do not have a human-readable name
11:36 pmurias toolforger: looking at the JVM backend it seems to have two custom class loader classes
11:36 toolforger google for "classloader hell" for more stories about this
11:36 toolforger I saw only one, ByteClassLoader
11:36 toolforger I seem to have missed the other one - which is it?
11:36 pmurias IgnoreNameClassLoader
11:37 pmurias which seems to load serialized objects from a different source
11:38 pmurias toolforger: isn't ByteClassLoader just a convinience wrapper as it just delegates?
11:38 toolforger yes
11:39 toolforger I'd recommend making it a function on some other class, possibly even a static function
11:39 toolforger this also avoids instantiating your own classloaders
11:42 pmurias toolforger: the ByteClassLoader itself doesn't seem to load anything
11:42 toolforger Indeed it doesn't
11:43 pmurias it only seems to be a subclass inorder to gain access to a protected method
11:43 toolforger though you'd have to check where it's instantiated and how the instances are used to see whether it's used for access control etc.
11:44 toolforger Oh right, the called defineClass is protected
11:44 RabidGravy [ptc] actually something like that is highly probably
11:45 RabidGravy https://raw.githubusercontent.co​m/nbrown/p6-jdf/master/META.info
11:45 pmurias toolforger: it's always created like new ByteClassLoader(getClass().getClassLoader())
11:46 toolforger OK, then all instances of ByteClassLoader are chained to the class loader of the calling code
11:46 toolforger For access control etc., one would have to check how these ByteClassLoader instances are used
11:46 RabidGravy https://github.com/nbrown/p6-jdf
11:46 cibs joined #perl6
11:46 pmurias IgnoreNameClassLoader seems like it always loads Perl 6 classes only, so it shouldn't cause mixup with Java classes
11:47 pmurias toolforger: access control?
11:47 toolforger sandboxing
11:47 toolforger that's what application servers and browser plugins need
11:48 toolforger nqp shouldn't need that
11:48 toolforger but you never know
11:49 toolforger Hmm... I see that java.lang.ClassLoader itself does not offer a way to turn a byte array into a class
11:50 pmurias I'm not a Java programmer so I'm not familiary with all the JVMy stuff ;)
11:50 bjz_ joined #perl6
11:50 toolforger I don't know how asm injects classes into the parent class loader, I think it should do that
11:50 toolforger :-)
11:51 toolforger I know a bit more, but I try to avoid ClassLoader trickery
11:51 toolforger because I know enough to know it's dangerous, but not enough to deal with the dangers
11:52 RabidGravy [ptc], so yeah at a guess I'd say they renamed their github account and forgot to update the modules list and the meta files
11:53 RabidGravy I'll fix the meta list and PR the changes to the META files
11:54 toolforger Hmm... IgnoreNameClassLoader looks whacky to me
11:54 toolforger each newly created class has its own IgnoreNameClassLoader
11:56 dalek ecosystem: 1a11045 | RabidGravy++ | META.list:
11:56 dalek ecosystem: Change 'carbin' to 'nbrown'
11:56 dalek ecosystem: review: https://github.com/perl6/e​cosystem/commit/1a11045e86
11:56 toolforger Issue is that each Class has a reference to the ClassLoader that creates it, so the IgnoreNameClassLoader objects will stick around until the class goes away, which it doesn't until you unload the ClassLoader
11:56 RabidGravy right that's part of the problem fixed
11:58 toolforger I'll have to look up how this kind of stuff is supposed to be done, proliferating ClassLoaders just to get access to a defineClass() function without having to bother with names is going to create problems, especially once you start to seriously do interop with Java code
11:59 [ptc] RabidGravy: dunno if crabin is nbrown though...
12:00 [ptc] I think nbrown just happened to have a fork of the repo; they have many forks of perl6-related repos
12:00 toolforger anyway - thx, gtg, rl interrupt, will be back after reading up things on the ASM site - the ASM guys should be pretty knowledgeable about how the bytecode their lib generates should be injected into a JVM
12:00 toolforger left #perl6
12:00 RabidGravy No they're not forks
12:02 RabidGravy and if our assumption is wrong at least the modules will be installable again :)
12:08 canopus joined #perl6
12:10 [ptc] true :-)
12:12 RabidGravy I've left a note on the PRs to get on here and discuss if that isn't the right  thing, but all done now :)
12:18 rurban joined #perl6
12:26 [ptc] RabidGravy: did a bit more digging and found that nbrown was active on this channel in 2009, and that he joined GitHub in the same year.
12:26 [ptc] other than that, he'd forked almost all perl6-related repos, and that's my guess how the "carbin" repos got there...
12:28 RabidGravy and if the "carbin" did delete their account then it might explain why they don't appear to be forks
12:29 [ptc] oh well, the modules are installable again :-)
12:31 RabidGravy yeah and if nbrown doesn't want to have anything to do with them we can arrange to have them moved elsewhere in an orderly fashion
12:41 [ptc] sounds good
12:44 RabidGravy now let's see about this "modules being in a weird order" thing
12:54 vendethiel joined #perl6
12:59 rurban joined #perl6
13:04 RabidGravy which I instantly regret due to the immense dependencies of the modules.perl.org code
13:04 RabidGravy ho hum
13:13 TimToady joined #perl6
13:16 * masak read it as "modules being the World Order"
13:26 * pmurias really dislikes how modules.perl6.org looks
13:32 lizmat joined #perl6
13:45 RabidGravy I've got a thing somewhere that loads up the modules list in CouchDB for a bit of munging goodness
13:46 rurban1 joined #perl6
13:46 masak pmurias: I don't disagree, but could you be more speicifc?
13:56 RabidGravy The projects.json is there to consume for all, it's make something that pleases you :)
13:57 pmurias masak: I don't have a good idea how it should look as I would have fixed it already
13:58 RabidGravy maybe I should have limited the number of modules the build project list retrieved this could take all afternoon
14:00 moritz RabidGravy: do you want a dump of module.perl6.org sqlite3 database?
14:01 RabidGravy it'll be fine, it's about half way through now
14:05 masak pmurias: well, it has to have *some* visual appearance... :P I was mostly asking in case you were sitting on a concrete suggestion for improvement, but seems not
14:05 masak maybe one way to ask is "should it look more like https://metacpan.org/ ?"
14:06 kurahaupo joined #perl6
14:06 masak I mean, it doesn't actually have to be a list
14:06 masak in fact, it can only remain a single list for as long as we see ourselves as not having all that many modules
14:06 moritz as long as a browser can comfortable keep the whole list, I'm all for having it right there
14:07 rurban joined #perl6
14:08 RabidGravy If more people used "tags" it would be nice to have a tag cloud kind of thing
14:08 moritz the problem with tags is always: what do you use them for?
14:08 moritz and can you make usage somewhat consistent?
14:10 RabidGravy well that's for individual module authors and/or end-users to decide :)
14:11 RabidGravy the downside of tags is exactly that people will ask the questions you did :)
14:11 moritz and I'm hesitant to implement a system where I'm not confident I can tell people how to use or, or where I'm confident they'll use it in a way that makes sense
14:12 masak what moritz said -- it's a rare thing that "tag cloud" comes in and magically makes things better or more usable in some way
14:13 masak usually it takes quite a bit of work, tweaking, and experimenting. I'm not sure we should give module authors that extra work without seeing clear benefits from it.
14:13 pmurias masak: using a fork of metacpan.org could be the right solution
14:14 stmuk what problem are we trying to solve here?
14:15 masak * pmurias really dislikes how modules.perl6.org looks
14:15 masak stmuk: ^
14:15 stmuk what does he mean by "looks"? web design or something else?
14:16 pmurias stmuk: ugliness
14:17 pmurias it used to be uglier before I remove the kwalitee-or-whatever-it-was-called
14:17 RabidGravy well regarding the "fork metacpan" isn't there a move afoot to integrate with the actual metacpan?
14:17 stmuk the ecosystem doesn't remotely resemble cpan
14:19 pmurias RabidGravy: there is some work in a branch of fork on github
14:19 stmuk forking metacpan.org wouldn't buy you much
14:20 stmuk you could just stick a search box up using elastic search or whatever
14:23 pmurias there are plans to allow perl 6 releases on cpan
14:24 stmuk there are experimental versions already on cpan
14:25 pmurias stmuk: just stealing the metacpan design might be one solution
14:26 rurban1 joined #perl6
14:26 pmurias hopefully I'll talk it over with a friend who does both programming and art and he'll tell me how modules.perl6.org should look like ;)
14:27 stmuk actually Isn't there already a forked metacpan running on hack?
14:30 RabidGravy I'm relaxed about the appearance but nice features metacpan has include the in-site browsing, dependency look-up, testing info etc
14:31 stmuk http://hack.p6c.org:5001
14:35 moritz Hosting generously provided by: The Perl 6 Community!
14:35 rurban joined #perl6
14:36 stmuk the CPAN-ecosystem experiment seemed to show quite a mismatch last time I looked
14:37 nwc10 joined #perl6
14:37 nwc10 I'm reading https://docs.perl6.org/language/phasers#INIT and I'm confused by what "When phasers are in different modules, the INIT and END phasers are treated as if declared at use time in the using module." means
14:38 nwc10 or is it as simple as I think - it's the same as Perl 5
14:38 nwc10 use Foo; where Foo.pm has `INIT {warn} END {warn}`
14:38 nwc10 is just the same as
14:38 stmuk stealing design and ideas is good .. but direct code reuse probably isn't possible
14:38 moritz nwc10: it means that they are run at the compile time of the outer module
14:38 nwc10 `BEGIN {INIT {warn} END {warn}}` in the outer module?
14:39 nwc10 which I think is what you just typed
14:39 moritz yes
14:39 nwc10 good thanks.
14:39 stmuk how would metacpan deal with modules with the same name Foo::Bar which are different? :)
14:40 moritz the nesting of compile and run time are dificult enough to understand and explain; mixing in more phases doesn't make it easier :/
14:40 nwc10 yes. agree.
14:42 pmurias stmuk: the have to have distinct fully qualified named
14:42 nwc10 I guess the reason this mattered enough here to need that note in the docs, is because INIT and END have (er) FIFO and LIFO semantics, so the ordering (relative to other INITs and ENDs) needs to be clear)
14:42 pmurias stmuk: names
14:42 nwc10 er, free ')'
14:43 stmuk pmurias: yep!
14:44 nwc10 left #perl6
14:47 stmuk yay nom seems to have enough windows fixes over 2016.10 for an MSI
14:47 stmuk so there will probably be a R* 2016.11 so the windows users can install a binary
14:48 domidumont joined #perl6
14:51 kurahaupo__ joined #perl6
15:13 lizmat stmuk++
15:16 rurban joined #perl6
15:17 raiph joined #perl6
15:22 RabidGravy I really wish I understood this jquery DataTable plugin to figure out why the weird ordering
15:24 RabidGravy ah, okay it's the dataType thing
15:25 timotimo recently the page has been very unresponsive to searching ... at least once
15:26 timotimo oh
15:26 timotimo perhaps it was because i searched for "http" and everything matched by way of their urls ;_;
15:27 canopus joined #perl6
15:30 wamba joined #perl6
15:42 AlexDaniel joined #perl6
15:45 qub joined #perl6
15:46 cdg joined #perl6
15:55 RabidGravy timotimo, I think this is entirely related to what has gone wrong with the sorting
15:55 rurban joined #perl6
15:57 rurban1 joined #perl6
15:59 timotimo mhm
16:00 araujo joined #perl6
16:04 RabidGravy yeah it appears that it is taking the whole of the first TD into consideration for searching and sorting - including the tags, href and everything
16:06 timotimo so if you search for "a" or "href", that'll go in, too?
16:17 [ptc] just tried typing "href" into the search field; didn't seem to drop the number of items at all
16:17 [ptc] doing a search for e.g. 'wig' turned up the entry one would expect
16:21 timotimo i wonder how difficult it'd be to nativecall into fortran libraries?
16:23 RabidGravy [ptc], I'm just trying to get my head round what it thinks it is doing
16:24 DrForr Doen't FORTRAN use column-major ordering, among other things?
16:24 timotimo yes
16:26 DrForr Not saying it's impossible by any stretch of the imagination, just thinking about what would have to be changed.
16:28 RabidGravy right, I've got the search right but I don't appear to have cracked the ordering
16:40 rurban joined #perl6
16:41 pmurias what's the difference between throwpayloadlex and throwpayloadlexcaller?
16:42 timotimo one skips a stack frame
16:42 timotimo so pretends to be in the caller's frame
16:42 timotimo at least that's what i think it does
16:42 timotimo the kind of thing you'd implement "die" with
16:42 RabidGravy there, that's fixed up
16:43 RabidGravy though rather fugly but I'm no client side developer
16:45 ale1ster joined #perl6
16:54 rurban1 joined #perl6
16:56 dalek modules.perl6.org: c288107 | RabidGravy++ | assets/js/dataTables.filter.perlModule.js:
16:56 dalek modules.perl6.org: Strip the html from the text, this improves search
16:56 dalek modules.perl6.org: review: https://github.com/perl6/modul​es.perl6.org/commit/c2881074f5
16:56 dalek modules.perl6.org: 09d7f7a | RabidGravy++ | assets/js/main.js:
16:56 dalek modules.perl6.org: Strip to text for order data type
16:56 dalek modules.perl6.org:
16:56 dalek modules.perl6.org: Fixes #65
16:56 dalek modules.perl6.org: review: https://github.com/perl6/modul​es.perl6.org/commit/09d7f7a8db
16:56 zakharyas joined #perl6
16:57 RabidGravy of course if anyone else better understands the datatable plugin please intervene
16:59 rurban joined #perl6
17:01 rurban1 joined #perl6
17:03 Khisanth joined #perl6
17:04 rurban joined #perl6
17:08 rurban1 joined #perl6
17:11 rurban joined #perl6
17:13 Guest11976 left #perl6
17:14 rurban1 joined #perl6
17:17 rurban joined #perl6
17:21 rurban1 joined #perl6
17:23 RabidGravy if twingling the modules.perl6.org is necessary to pick up the changes to the javascript then someone might need to do that :)
17:30 stmuk RabidGravy++ # full stack
17:31 RabidGravy :-\  well in the case of client side stuff it's more tinker with stuff until it works
17:32 timotimo i know that feeling
17:33 RabidGravy there's something not quite right about that datatable plugin though
17:33 stmuk hows that really different to any programming? :)
17:34 RabidGravy if you set a type on a column, even though it's implementation only effects the searching it impacts the sorting, so you have to set the orderTableType as well
17:37 skids joined #perl6
17:44 rurban joined #perl6
17:48 rurban joined #perl6
17:50 RabidGravy timotimo, the searching and sorting should be fine on the http://modules.perl6.org/ now it appears to have reloaded
17:50 timotimo cool :)
17:50 timotimo thank you for your work
17:51 [ptc] RabidGravy++
17:51 [ptc] just tried it and it works well
17:51 [ptc] RabidGravy: you're a full-stack developer now :-P
17:51 * timotimo stacks some more stuff on top of RabidGravy
17:52 moritz now RabidGravy is a stack overflow developer :-)
17:55 [ptc] aren't we all?
17:57 stmuk ttp://www.commitstrip.com/en/2016/11/0​7/which-full-stack-developer-are-you/
17:57 stmuk +h
17:57 stmuk I'm the first sort :P
17:58 TimToady .tell garu if you want to return multiple values from a function, you should really use binding, which will work argument by argument, rather than list assignment, which will flatten like Perl 5's list assignment
17:58 yoleaux 01:21Z <AlexDaniel> TimToady: I was expecting this to work: 「my ($x, [@y]) = 24, [40, 50, 60]; say @y.perl」, but right now it is completely bugged. What would be the right result in this case? See #130079
17:58 yoleaux TimToady: I'll pass your message to garu.
17:58 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=130079
17:58 yoleaux 01:50Z <MasterDuke> TimToady: do you mind looking at https://irclog.perlgeek.de/p​erl6/2016-11-13#i_13557942? is there something wrong or are we just expecting incorrect behavior?
17:58 yoleaux 03:29Z <AlexDaniel> TimToady: ↑ #130081
17:58 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=130081
17:59 TimToady AlexDaniel: same to you, use binding there, not list assignment
18:01 AlexDaniel TimToady: example?
18:01 yoleaux 07:20Z <lizmat> AlexDaniel: see https://github.com/rakudo/rakudo/commit/37d0e46614
18:01 girafe joined #perl6
18:02 AlexDaniel ah
18:02 AlexDaniel got it
18:03 TimToady .tell MasterDuke TOP is not going to magically start backtracking merely because .parse fails, especially since backtracking probably means you have a smelly grammar, which is why tokens and rules don't backtrack by default in the first place; so use regex and explicit $ if you really need to backtrack
18:03 yoleaux TimToady: I'll pass your message to MasterDuke.
18:03 AlexDaniel TimToady: so what should be the result if you attempt to use list assignment like this?
18:03 AlexDaniel should it be a syntax error, a run time error of some sort, or what is it?
18:05 TimToady it should be like P5's list assignment, to the extent possible, but assigning to [@y] should probably fail since that's not sensical for either assigning or binding a flat array
18:05 TimToady that would only bind an array contained as a single elem of another array
18:06 TimToady and using [@y] makes no sense under a flattening regime like p5 list assignment
18:06 TimToady just bare @y would slurp the rest of the args
18:06 AlexDaniel TimToady: well, I can barely follow any of this, so feel free to leave a comment on #130079
18:06 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=130079
18:07 TimToady alas, don't really have good internet here, except a few minutes at a time...
18:08 TimToady this hotel is not quite so enlightened as our previous one
18:08 TimToady and this coming week we may not have much internet at all, on a cruise
18:24 domidumont joined #perl6
18:31 grondilu geekosaur: would you have a few minutes to help me make the wrapper you were talking about earlier?  I wrote it but and it compiles but I can't link it properly.
18:31 geekosaur sure
18:31 grondilu hang on
18:31 grondilu the wrapper I wrote is:  http://paste.debian.net/895284/
18:32 grondilu I compiled it with gcc -lbinaryen -I../binaryen/src -c -Wall -Werror -fpic binaryen-constants.c
18:33 grondilu I made the shared library like this: gcc -shared -o libbinaryen-constants.so binaryen-constants.o
18:33 grondilu but then when trying to call it with NativeCall I get:
18:33 grondilu Cannot locate native library '/usr/local/lib/libbinaryen-constants.so': /usr/local/lib/libbinaryen-constants.so: undefined symbol: BinaryenConst
18:34 grondilu yet BinaryenConst is defined in binaryen-c
18:34 grondilu (FYI binaryen is at https://github.com/WebAssembly/binaryen)
18:36 geekosaur putting -lbinaryen at the beginning instead of the end is at minimum a smell and potentially the problem
18:36 grondilu ok
18:37 geekosaur linkers tend to search libraries only when they have undefined symbols, so a library at the beginning may be ignored because it doesnt have any symbols to look for yet
18:37 grondilu same error
18:37 geekosaur -l is not really an option like -c or -o, it's a macro of sorts that expands to the path to a libraru
18:38 grondilu also frankly I thought I was supposed to put it in the linking line, not the compilation one
18:38 grondilu but I've seen it done as such somewhere so *
18:40 geekosaur the linking line is usually better. shared object handling is somewhat odd, it may well work as part of the compile line, then again it might not
18:40 geekosaur you could try moving it
18:40 geekosaur oh, creating a .o, probably not going to be used because linker not invoked, so yes
18:40 grondilu full error message:  http://paste.debian.net/895287/
18:41 geekosaur you can also use ldd on the .so to see if it has the reference to libbinaryen.so.whatever
18:42 grondilu it doesn't apparently
18:43 labster joined #perl6
18:44 labster joined #perl6
18:44 grondilu I've tried adding ../binaryen/CMakeFiles/binar​yen.dir/src/binaryen-c.cpp.o on the linking line but I still don't see it in ldd's output
18:44 geekosaur that is static, it won't show in ldd
18:45 grondilu ok
18:45 geekosaur again, try moving that -lbinaryen to the second gcc instead of the first
18:45 [ptc] anyone got an idea what this error message is trying to tell me?  Cannot find method 'export-package' on object of type CompUnit
18:45 geekosaur (also it would likely fail because other objects would be needed)
18:45 [ptc] a `git grep` on the source doesn't turn up any `export-package` routine...
18:46 grondilu I got /usr/bin/ld: cannot find -lbinaryen
18:46 grondilu collect2: error: ld returned 1 exit status
18:46 geekosaur [ptc], something is trying to use `is export` on a CompUnit for some reason
18:46 [ptc] geekosaur: oh, ok.  Thanks :-)  Now I can dig further
18:46 MasterDuke src/core/CompUnit/Handle.pm:36:    method export-package() returns Stash {
18:46 yoleaux 18:03Z <TimToady> MasterDuke: TOP is not going to magically start backtracking merely because .parse fails, especially since backtracking probably means you have a smelly grammar, which is why tokens and rules don't backtrack by default in the first place; so use regex and explicit $ if you really need to backtrack
18:46 geekosaur grondilu, you didn;t actually install binaryen? you will need -L and -R options in the link line to point to wherever the libbinaryen.so.* is
18:47 grondilu geekosaur: I did put the libbinaryen.so file in /usr/local/lib and it works fine with NativeCall
18:47 geekosaur then ld is not using -L/usr/local/lib -R/usr/local/lib by default
18:48 geekosaur (you could check /etc/ld.so.conf to see if /usr/local/lib is in there; if so then you don't need the -R, but you might still need the -L)
18:48 grondilu gcc: error: unrecognized command line option '-R'; did you mean '-R'?
18:49 geekosaur ???
18:49 geekosaur oh
18:49 grondilu IKR
18:49 geekosaur wait, is my client changing that?
18:49 grondilu nope, it was sic
18:49 labster joined #perl6
18:50 grondilu $ grep local /etc/ld.so.conf.d/*
18:50 grondilu /etc/ld.so.conf.d/libc.conf:/usr/local/lib
18:50 geekosaur ok, you don't need the -R then
18:51 geekosaur (and I was wondering if my client had changed a normal hyphen to a Unicode smart hyphen of some kind, but I just checked that and it didn't)
18:51 geekosaur (also come to think of it that would not cause *that* error, it would somehow have to be the 'R' not the '-')
18:51 grondilu it still can find the lib
18:51 grondilu s/can/can not/
18:52 geekosaur which part can't find it now?
18:52 MasterDuke .tell TimToady i think i figured out that i needed a regex, but i'm having some problem implementing it with some further discussion here, does this look like a bug to you? https://irclog.perlgeek.de/pe​rl6-dev/2016-11-13#i_13559207
18:52 yoleaux MasterDuke: I'll pass your message to TimToady.
18:53 grondilu $ LANG=C gcc -L/usr/local/lib -shared -l binaryen -o libbinaryen-constants.so binaryen-constants.o
18:53 grondilu /usr/bin/ld: cannot find -lbinaryen
18:53 grondilu collect2: error: ld returned 1 exit status
18:53 grondilu oh wait
18:54 geekosaur aside from the fact that "-l binaryen" should not have a space and should be at the very end --- the error suggests it figured that out (which surprises me) but still can't find it. unless -l with a space does something weird
18:54 grondilu I'm so dumb
18:55 geekosaur [ptc], MasterDuke's thing suggests you may in fact have an internal error where something that expects a CompUnit::Handle got a CompUnit instead
18:55 grondilu geekosaur: I'm so sorry.  I really thought I add put it in /usr/local/lib.  Turns out I didn't.
18:56 geekosaur you may also have to put the one with the version suffix there, if it has one (and if it doesn't, it's a bad package and will bite someone someday... but that's not your problem)
18:56 grondilu well, I still get the error anyway
18:56 geekosaur ls -lL /usr/local/bin/libbinaryen.so
18:56 geekosaur er
18:56 geekosaur ls -lL /usr/local/lib/libbinaryen.so
18:56 geekosaur wait no, sigh
18:56 geekosaur ls -l /usr/local/lib/libbinaryen.so
18:56 grondilu -rwxr-xr-x 2 grondilu staff 2349192 nov.  12 20:00 /usr/local/lib/libbinaryen.so
18:57 geekosaur ok, then I don't know why it's still not finding it
18:57 grondilu the error I was talking about was the NativeCall one, not the gcc.
18:57 grondilu now -lbinaryen works
18:58 MasterDuke does anyone here have any experience parsing the json output of rakudo profiles? i profiled building rakudo, but it creates a 830mb file, which the two usual viewers can't handle
18:58 [ptc] geekosaur: could be.  I was digging in the `v5` repository and trying to work out if the test suite worked (it doesn't)
18:58 geekosaur ok, use ldd on your .so to make sure it has the link to libbinaryen.so and that it can resolve it
18:58 [ptc] geekosaur: and once one gets the PERL6LIB right, that's the error I was getting
18:59 geekosaur MasterDuke, I think people have been slamming into that one for over a year now >.>
19:00 geekosaur every so often timotimo grumps about it
19:00 grondilu no link to libbinaryen.so shown by ldd
19:00 grondilu $ ldd /usr/local/lib/libbinaryen-constants.so
19:00 grondilu linux-gate.so.1 (0xb7754000)
19:00 grondilu libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb757f000)
19:00 grondilu /lib/ld-linux.so.2 (0x800ae000)
19:01 geekosaur then it's still not actually linking it
19:01 geekosaur what does that link command currently look like?
19:01 grondilu $ LANG=C gcc -shared -o libbina
19:01 grondilu ryen-constants.so $(find ../binaryen -name 'binaryen-c.cpp.o') binaryen-constant
19:01 grondilu s.o -lbinaryen
19:01 geekosaur you broke it...
19:01 grondilu wyeah
19:01 geekosaur please do not link against the .o
19:01 grondilu bad paste
19:02 MasterDuke geekosaur: yeah, i looked into modifying the qt viewer, but don't know (or like) c++ enough to change its parsing library
19:02 geekosaur you would need to link EVERY .o and not use -lbinaryen
19:02 geekosaur do one or the other, not both
19:02 grondilu ok
19:04 grondilu finally it shows up!
19:04 grondilu but as "libbinaryen.so => not found"
19:05 labster joined #perl6
19:06 geekosaur but it's in /usr/local/lib and you showed it being in the ld.so.conf stuff. siiiigh
19:06 geekosaur ok, guess you get to try to force it
19:07 grondilu I get a different error from NativeCall now.  Progress I guess.
19:07 geekosaur since gcc was being weird about -R, try passing it through as a linker option:  -Wl,-R,/usr/local/lib
19:09 Guest22943 joined #perl6
19:09 Guest22943 joined #perl6
19:10 grondilu yes, that works.  I see it correctly in ldd now
19:11 grondilu now I get a segmentation error
19:12 geekosaur sigh
19:13 grondilu nevermind.  I'll go back to it later.
19:13 geekosaur wait, that wrapper makes not a lot of sense unless you are wrapping things that take refs already, and if you aren't then it should be throwing C errors unless they're doing something heinous in C
19:13 grondilu I guess I will have to look in the make file how they did compile and link binaryen.  I'll just cargo cult it
19:14 geekosaur (which...)
19:15 geekosaur because if something is struct foo f(struct foo a) then the wrapper is struct foo *f_(struct foo a_) {static struct foo evil = f(*a_); return &evil } # except this is not re-entrant nor thread safe, you need to be more clever in that case
19:16 grondilu I do more than turning struct value call into struct ref call if that's what you're saying.  I think I can hide the struct all together.
19:17 grondilu because the function that returns a struct is used by only one function anyway.
19:18 grondilu and that function does return a reference.
19:18 grondilu rather a BinaryenConst
19:18 grondilu which is a (void *)
19:19 grondilu I supposed the binaryen team had reasons to make the struct visible but it does not seem obviously necessary.
19:20 grondilu (sorry I meant BinaryenExpressionRef earlier, not BinaryenConst)
19:22 geekosaur you might want to make sure that does what you think it does. sadly, with C it's not always obvious
19:22 geekosaur and if you get it wrong, your diagnostic is indeed a core dump :/
19:23 grondilu I guess to be safe I could do a wrapper using struct ref as you suggested.
19:24 grondilu but the struct has an anonymous union in it, that makes it painful to do with NativeCall
19:25 cdg joined #perl6
19:25 cdg joined #perl6
19:27 grondilu oh man, I was silly again
19:27 grondilu I forgot the module argument
19:27 grondilu it works!
19:28 grondilu geekosaur: thanks a lot for your help :)
19:28 geekosaur yay
19:33 grondilu https://github.com/grondilu/binaryen-bindings
19:35 grondilu it will be cleaner to do the kind of wrapper you were talking about though, I'll work on it.
19:46 timotimo geekosaur: yeah, i grump that we don't use ldconfig to find .so files to load with nativecall
19:46 timotimo that's what that's about, right?
19:47 geekosaur no, that was MasterDuke complaining about tools choking on profile output
19:49 timotimo oh, you mean the profile output being far too big
19:49 timotimo i see
19:49 geekosaur yep
19:50 timotimo dinner time over here now :)
19:50 moritz bisectable6: my %h; %h{class { has str $.s }.new.s} = 1
19:50 bisectable6 moritz, On both starting points (old=2015.12 new=59bb1b1) the exit code is 0, exit signal is 11 (SIGSEGV) and the output is identical as well
19:50 bisectable6 moritz, Output on both points:
19:51 geekosaur grondilu, it's simpler to do the wrapper I suggested, but it's too limited --- note my comment about reentrancy. if yours works, go with it
19:51 timotimo moritz: requires an moar+nqp bump to work
19:52 grondilu I now understand why they made the struct visible.  My wrapper can not re-use the same literal for different modules, for one.
19:52 moritz timotimo: oh, tehre's a fix for that already?
19:53 setty1 joined #perl6
20:01 AlexDaniel this, I guess: https://github.com/MoarVM/MoarVM/commit/​28179938434035b425e66ead5e1bd4193ab31a53
20:02 AlexDaniel MasterDuke: should it even report exit code if there's a SEGV?
20:06 firstdayonthejob joined #perl6
20:07 rindolf joined #perl6
20:09 AlexDaniel m: say 8.9 gcd 2
20:09 camelia rakudo-moar 59bb1b: OUTPUT«2␤»
20:11 bjz joined #perl6
20:13 devmikey joined #perl6
20:13 * moritz has been working so much with gocd lately that he parses gcd as a misspelling of gocd :-) (https://go.cd/ for those wondering)
20:14 AlexDaniel I just threw it in as an interesting edge case, there's nothing wrong and nothing new with it.
20:16 AlexDaniel … otherwise Zoffix wonders why is it so quiet here :)
20:17 geekosaur quiet?
20:17 geekosaur yeek-yeek >.>
20:17 MasterDuke AlexDaniel: i guess there's no reason to
20:33 RabidGravy coo a live issue with the futuremusic.fm, haven't had one of those for a while
20:37 setty1 joined #perl6
20:38 BenGoldberg joined #perl6
20:39 leego joined #perl6
20:42 leego joined #perl6
20:54 lizmat joined #perl6
21:03 RabidGravy I've so got to finish the radio software
21:05 RabidGravy good show on the http://stream.futuremusic.fm:8000/mp3 btw :)
21:24 Vynce joined #perl6
21:24 El_Che De gustibus non est disputandum :)
21:37 timotimo moritz: yup, AlexDaniel found the right commit
21:39 bjz joined #perl6
21:41 seatek joined #perl6
21:42 kyclark_ joined #perl6
21:43 cdg_ joined #perl6
21:48 bjz joined #perl6
21:48 nowan joined #perl6
21:51 Vynce joined #perl6
22:06 bjz_ joined #perl6
22:24 Ben_Goldberg joined #perl6
22:29 cdg joined #perl6
22:34 lostinfog joined #perl6
22:38 nightfrog 0
22:41 seatek I just want to thank you all for exceptions. They work so nicely and so flexibly.
22:48 rindolf Hi all! make install http://paste.debian.net/895338/ in rakudo fails here -
22:52 danlei joined #perl6
22:53 danlei how can I redefine classes/roles/... at the repl without getting Redeclaration of ... errors?
22:56 timotimo JSON::Fast: 63.87user 0.48system 1:04.40elapsed 99%CPU (0avgtext+0avgdata 874728maxresident)k
22:57 timotimo JSON::Tiny: 338.42user 1.88system 5:40.57elapsed 99%CPU (0avgtext+0avgdata 4634628maxresident)k
22:57 timotimo about 19% as much ram usage, more than 5x as fast
22:58 timotimo for a 50 MB file
23:00 seatek timotimo: so if i were to, say, right now, change use JSON::Tiny to use JSON::Fast, no bad things would happen and my world would be much better?
23:00 timotimo correct
23:00 cdg_ joined #perl6
23:02 seatek timotimo: and you also are correct! :)
23:02 rindolf Seems like the travis-CI build fails as well - for similar reasons - https://travis-ci.org/rakudo/rakudo/jobs/175494053
23:02 seatek no failed tests. that felt nice
23:03 danlei (I found MONKEY-TYPING/augment and that kinda works, but there has to be some easier way for interactive use, no?)
23:08 gfldex danlei: no, Perl 6 is a lot less dynamic that it looks
23:10 danlei gfldex: is that the way it's supposed to be and going to stay, or is it a deficiency of the implementation (rakudo)? that seems to be some basic stuff for interactive repl use
23:10 gfldex danlei: it will stay that way
23:11 danlei gfldex: hm, I'm a little -- shocked :)
23:12 danlei gfldex: but maybe that's just because I'm used to the lisp (and other modern dynamic languages) way to do things
23:12 danlei anyway, thanks
23:12 gfldex danlei: if you don't need type checks, you can do the dynamic stuff by hand
23:13 cpage joined #perl6
23:13 danlei gfldex: you mean without using the class/rule/... sugar?
23:13 danlei gfldex: or what do you have in mind?
23:14 gfldex m: my $C = class { method m { say 'oi?' } }; $C.new.m; $C = class { method m { say 'oi!' } }; $C.new.m
23:14 camelia rakudo-moar 59bb1b: OUTPUT«oi?␤oi!␤»
23:14 danlei gfldex: ah, I see
23:15 danlei gfldex: that seems ok for playing around at the repl, but it's not ideal when, say, loading files in the repl
23:15 danlei but it's at least something
23:19 danlei gfldex: could you maybe point me to some document explaining the rationale behind this (perl6 being more static than I expected)? some synopsis maybe?
23:21 timotimo you can't really load a file "into" the repl at the moment
23:21 timotimo the repl is quite underpowered and also buggy in general
23:22 danlei timotimo: I've written a little Emacs comint repl for perl6, I use EVALFILE for whole files, but often, I'm just sending the region to the process
23:22 cpage joined #perl6
23:23 danlei timotimo: what gfldex showed is better than nothing, but of course I don't want to write my code this way :)
23:25 timotimo mhm
23:27 timotimo i got a major speed boost in JSON::Fast by throwing out the CATCH that translate the internal error from ordat going over the end of the string into a nicer error text
23:28 danlei I thought I just missed some pragma or command line switch -- I didn't expect that to be by design. it's still a great language, as far as I can tell from a few weeks of dabbling. but it's a little sobering for me.
23:28 danlei anyway, thanks for the help guys
23:29 timotimo good luck and have fun with perl6 :)
23:29 danlei thanks :)
23:30 timotimo your problem is just not being allowed to redefine classes in the repl?
23:30 cpage joined #perl6
23:35 danlei timotimo: well, whatever yields the Redeclaration errors is suboptimal for interactive use, imho. (I was playing with classes and roles today and that's where I became aware of it. no problems with variables, subs etc. until now) of course, you could always just restart the repl, but that's a little awkward if you're used to languages where redefining is no problem.
23:35 timotimo have you tried spelling it "my class Blah { .. }"?
23:36 timotimo it won't affect things that have already been declared to use your class
23:36 timotimo because the name gets overwritten for future stuff, but the old thing is still there
23:36 kyclark_ joined #perl6
23:36 cyphase joined #perl6
23:37 danlei timotimo: that's even better than gfldex' suggestion, thanks (but I'd still have to write the code in my files this way)
23:37 danlei thanks
23:41 danlei (actually, it's good to know about both :)
23:52 kyclark_ joined #perl6
23:54 danlei thanks again and happy hacking -- I'm off

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

Perl 6 | Reference Documentation | Rakudo