»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
Xliff m: my $a = Any + 1; say $a 00:13
camelia Use of uninitialized value of type Any in numeric context
1
in block <unit> at <tmp> line 1
00:18 MasterDuke joined, p6bannerbot sets mode: +v MasterDuke, MasterDuke left, MasterDuke joined, herbert.freenode.net sets mode: +v MasterDuke, p6bannerbot sets mode: +v MasterDuke 00:28 pecastro left
buggable New CPAN upload: CroX-HTTP-FallbackPassthru-0.1.tar.gz by HANENKAMP cpan.metacpan.org/authors/id/H/HA/...0.1.tar.gz 00:37
00:41 movl joined 00:42 p6bannerbot sets mode: +v movl 01:24 SourceBaby left 01:28 lichtkind left 01:37 cydf left
Xliff m: class A { has $.a = rand() }; my $a = (A.new xx 2); say $a.gist 02:13
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of rand(); in Perl 6 please use rand
at <tmp>:1
------> 3class A { has $.a = rand7⏏5() }; my $a = (A.new xx 2); say $a.gist
Xliff m: class A { has $.a = rand }; my $a = (A.new xx 2); say $a.gist 02:14
camelia (A.new(a => 0.16441350714980596e0) A.new(a => 0.16372031521031205e0))
02:37 evalable6 left 02:39 evalable6 joined, ChanServ sets mode: +v evalable6, p6bannerbot sets mode: +v evalable6 02:44 doufu300 joined, p6bannerbot sets mode: +v doufu300 02:57 doufu300 left 03:02 kurahaupo_ joined 03:03 p6bannerbot sets mode: +v kurahaupo_ 03:06 kurahaupo left 03:10 leont left 03:18 Bird|otherbox4 joined, Bird|otherbox4 left
buggable New CPAN upload: App-Tasks-0.0.11.tar.gz by JMASLAK modules.perl6.org/dist/App::Tasks:cpan:JMASLAK 03:47
SmokeMachine timotimo, mst: Now Red's columns, by default, are NOT NULL... you can change it with column's `is column{ :nullable }` or to change de default behaviour for every column of a model, use the model's `is nullable` 03:53
04:07 Cabanossi left 04:08 Cabanossi joined 04:09 p6bannerbot sets mode: +v Cabanossi 04:46 ferreira left 04:47 ferreira joined 04:48 p6bannerbot sets mode: +v ferreira 05:23 warriors left 05:37 irdr left 05:40 irdr joined 05:41 p6bannerbot sets mode: +v irdr 06:21 benjikun left 06:30 kurahaupo_ left, kurahaupo joined 06:31 p6bannerbot sets mode: +v kurahaupo 07:15 jmerelo joined 07:16 p6bannerbot sets mode: +v jmerelo 07:32 hamhu3_ joined 07:33 p6bannerbot sets mode: +v hamhu3_ 07:36 hamhu3 left 07:38 domidumont joined 07:39 p6bannerbot sets mode: +v domidumont 07:42 lizmat left 07:53 caa51h left, kdr22 left, xinming left, kdr22 joined, xinming joined 07:54 p6bannerbot sets mode: +v kdr22, p6bannerbot sets mode: +v xinming 07:55 caa51h joined, p6bannerbot sets mode: +v caa51h 08:33 cydf joined 08:34 p6bannerbot sets mode: +v cydf 08:48 domidumont left 09:11 |oLa| left 09:18 rindolf joined 09:19 p6bannerbot sets mode: +v rindolf 09:29 Dino joined, p6bannerbot sets mode: +v Dino, Dino is now known as Guest97597 09:32 sena_kun joined 09:33 p6bannerbot sets mode: +v sena_kun 09:44 Guest97597 left 09:46 cydf left 10:06 robertle left 10:09 avar left, avar joined, avar left, avar joined, p6bannerbot sets mode: +v avar 10:10 p6bannerbot sets mode: +v avar, domidumont joined 10:11 p6bannerbot sets mode: +v domidumont 10:29 dalek joined, ChanServ sets mode: +v dalek, p6lert left, sergot left, synopsebot_ joined, Geth joined, ChanServ sets mode: +v synopsebot_, ChanServ sets mode: +v Geth, p6lert joined, synopsebot left, p6bannerbot sets mode: +v dalek 10:30 p6bannerbot sets mode: +v synopsebot_, p6bannerbot sets mode: +v Geth, p6bannerbot sets mode: +v p6lert
Xliff m: use NativeCall; class A does repr('CStruct') { has uint64 $.a }; say A ~~ Pointer; 10:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'repr'. Did you mean 'REPL'?
at <tmp>:1
------> 3use NativeCall; class A does repr7⏏5('CStruct') { has uint64 $.a }; say A ~~
Xliff m: use NativeCall; class A is repr('CStruct') { has uint64 $.a }; say A ~~ Pointer;
camelia False
Xliff m: use NativeCall; class A is repr('CPointer') { }; say A ~~ Pointer;
camelia False
Xliff m: use NativeCall; class A is repr('CPointer') { }; say A ~~ CPointer;
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
CPointer used at line 1. Did you mean 'Pointer'?
Xliff Does anyone know how to pull the repr out of a class definition? I am primarily only interested in CStruct and CPointer; 10:34
m: use NativeCall; class A is repr('CPointer') { }; say A ~~ NativeCall::Types::Pointer; 10:39
camelia False
Xliff m: use NativeCall; class A is repr('CPointer') { }; say A.REPR 10:40
camelia CPointer
Xliff m: use NativeCall; class A is repr('CPointer') { }; say A.REPR eq 'CPointer'
camelia True
Xliff m: use NativeCall; class A is repr('CStruct') { }; say A.REPR eq 'CPointer'
camelia 5===SORRY!5=== Error while compiling <tmp>
Class A has no attributes, which is illegal with the CStruct representation.
at <tmp>:1
Xliff m: use NativeCall; class A is repr('CStruct') { has uint64 $.a }; say A.REPR eq 'CPointer' 10:41
camelia False
Xliff m: use NativeCall; class A is repr('CStruct') { }; say A.REPR eq 'CStruct'
camelia 5===SORRY!5=== Error while compiling <tmp>
Class A has no attributes, which is illegal with the CStruct representation.
at <tmp>:1
Xliff m: use NativeCall; class A is repr('CStruct') { has uint64 $.a }; say A.REPR eq 'CStruct'
camelia True
Xliff Well! That will work!
:>
10:47 |oLa| joined 10:48 p6bannerbot sets mode: +v |oLa|
Xliff m: use NativeCall; class A is repr('CStruct') { has uint64 $.a }; say A.new.REPR 10:53
camelia CStruct
Xliff m: say Any.^name 10:56
camelia Any
Xliff m: say Mu.^name
camelia Mu
11:09 yqt joined, p6bannerbot sets mode: +v yqt 11:14 molaf joined, p6bannerbot sets mode: +v molaf
Geth doc: dc30eee82e | (JJ Merelo)++ | doc/Type/Rational.pod6
Fixes arithmetic error and adds examples closes #2463
11:26
synopsebot_ Link: doc.perl6.org/type/Rational
11:29 kurahaupo left 11:30 kurahaupo joined 11:31 p6bannerbot sets mode: +v kurahaupo 11:39 lizmat joined, p6bannerbot sets mode: +v lizmat 11:41 cydf joined 11:42 p6bannerbot sets mode: +v cydf 12:19 leont joined 12:20 p6bannerbot sets mode: +v leont 12:27 kurahaupo left, kurahaupo joined, kurahaupo left 12:28 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 12:33 pecastro joined 12:34 p6bannerbot sets mode: +v pecastro 12:38 pecastro left 12:49 marmor joined 12:50 p6bannerbot sets mode: +v marmor, pecastro joined 12:51 p6bannerbot sets mode: +v pecastro 13:00 pmurias joined, p6bannerbot sets mode: +v pmurias 13:03 kurahaupo left 13:04 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 13:21 kurahaupo left, kurahaupo joined 13:22 p6bannerbot sets mode: +v kurahaupo 13:26 MasterDuke left 13:29 jmerelo left
SmokeMachine .tell timotimo colabti.org/irclogger/irclogger_lo...-11-18#l34 13:41
yoleaux SmokeMachine: I'll pass your message to timotimo.
timotimo SmokeMachine: fantastic! 13:43
yoleaux 13:41Z <SmokeMachine> timotimo: colabti.org/irclogger/irclogger_lo...-11-18#l34
14:06 dogbert2_ left 14:09 patrickb joined 14:10 p6bannerbot sets mode: +v patrickb
Geth mu: efe5cc112c | timo++ (committed using GitHub Web editor) | misc/perl6advent-2018/schedule
claim a slot in the advent calendar
14:15
14:32 Xliff_ joined 14:33 p6bannerbot sets mode: +v Xliff_ 14:35 Xliff left, Xliff_ left 14:36 Xliff_ joined, p6bannerbot sets mode: +v Xliff_ 14:50 |oLa| left 14:51 zakharyas joined 14:52 p6bannerbot sets mode: +v zakharyas 14:58 movl left 15:00 movl joined, p6bannerbot sets mode: +v movl, testguest joined, p6bannerbot sets mode: +v testguest 15:02 lizmat left, testguest left 15:06 Kaiepi left, zakharyas left 15:07 Kaiepi joined, zakharyas joined, p6bannerbot sets mode: +v Kaiepi 15:08 p6bannerbot sets mode: +v zakharyas 15:10 xinming_ joined, p6bannerbot sets mode: +v xinming_ 15:12 |oLa| joined 15:13 p6bannerbot sets mode: +v |oLa|, xinming left 15:14 lizmat joined, p6bannerbot sets mode: +v lizmat
leont might take a slot on the advent calendar, that also depends if a certain bug gets fixed before that time 15:16
15:18 lizmat left 15:20 marmor left 15:21 patrickz joined
sena_kun m: multi trait_mod:<is>(Attribute $attr, :$def) { #`( magic here ) }; class A { has $.a is def(5); }; say A.new; 15:21
camelia A.new(a => Any)
15:22 p6bannerbot sets mode: +v patrickz
sena_kun so I want to know, how can I apply one another trait in my custom one? If I have my magic done, I'd like to do like `$attr is default($def)`, but that's banned for obvious reasons. 15:22
docs say that: "As such compiler hooks, they are defined in compile time, although they can be used in runtime", but it is not really clear if I can do what I want to. 15:23
another option would be to just `has $.a is def(5) is default5)`, but that's not too nice.
15:24 Skarsnik joined 15:25 p6bannerbot sets mode: +v Skarsnik, patrickb left
Skarsnik Hello 15:25
sena_kun o/
timotimo o/ 15:27
yo Skarsnik, wanna take part in the advent calendar this year? :)
Skarsnik I was actually on my way to start my experiment with binary and grammar xD 15:28
timotimo i could swear there was a way to get from a commit view on github to the file at that version
could have sworn*
SmokeMachine timotimo: :) 15:30
15:30 zakharyas left 15:31 zakharyas joined 15:32 p6bannerbot sets mode: +v zakharyas
leont sena_kun: I would guess you can just call «trait_mod:<is>($attr, :default(5))» in your own trait 15:34
sena_kun m: multi trait_mod:<is>(Attribute $attr, :$def) { $attr«trait_mod:<is>($attr, :default(5))» }; class A { has $.a is def(5); }; say A.new 15:39
camelia A.new(a => Any)
sena_kun hmm, I am impressed this syntax exists, but it seems to me that the trait still isn't applied, hmmm. 15:40
timotimo that's not syntax, that's just the full name of the subroutine :)
leont The «» were quotes, they shouldn't be in the code :-)
sena_kun ah
no, stop
ah
leont m: multi trait_mod:<is>(Attribute $attr, :$def) { trait_mod:<is>($attr, :default(5)) }; class A { has $.a is def(5); }; say A.new
camelia A.new(a => 5)
sena_kun m: multi trait_mod:<is>(Attribute $attr, :$def) { trait_mod:<is>($attr, :default(5)) }; class A { has $.a is def(5); }; say A.new 15:41
camelia A.new(a => 5)
sena_kun \o/
leont, thanks a lot!
leont YW
15:55 jmerelo joined, p6bannerbot sets mode: +v jmerelo
Skarsnik hm matching on bit value in grammar look tricky x) 15:56
I am streaming my attempt if people are curious www.twitch.tv/skarsnikus x) 16:00
16:06 molaf left, colomon joined, marmor joined 16:07 p6bannerbot sets mode: +v colomon, zakharyas left, p6bannerbot sets mode: +v marmor
timotimo hell yeah p6 live coding 16:09
16:11 marmor left 16:18 colomon left
timotimo m: my int @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; } 16:20
camelia [997 901 925 720 459]
[997 901 925 720 459 359 738 863 857 720]
[997 901 925 720 459 359 738 863 857 720 334 233 952 424 688]
[997 901 925 720 459 359 738 863 857 720 334 233 952 424 688 10 982 788 514 595]
timotimo ??!?
that's not right at all!
bisectable: my int @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; }
bisectable6 timotimo, Bisecting by output (old=2015.12 new=50f2207) because on both starting points the exit code is 0
timotimo, bisect log: gist.github.com/cc5c67f880dd7369cc...97ec00688d 16:21
timotimo, (2015-12-25) github.com/rakudo/rakudo/commit/07...dc61f84053
timotimo, The result looks a bit unrealistic, doesn't it? Most probably the output is different on every commit (e.g. 「bisect: say rand」)
timotimo m)
of course
bisectable: srand(0); my int @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; }
bisectable6 timotimo, Bisecting by output (old=2015.12 new=50f2207) because on both starting points the exit code is 0
timotimo, bisect log: gist.github.com/fec75e964515a59c42...d159ce8394
timotimo, (2018-04-09) github.com/rakudo/rakudo/commit/72...4215ddbcf1
timotimo c: 2862990 srand(0); my int @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; } 16:22
committable6 timotimo, ¦2862990: «800 631 977 808 124␤846 987 763 1004 476␤347 870 677 834 804␤297 138 725 963 440␤»
timotimo m: my @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; }
camelia [875 114 500 356 57]
[942 1016 674 217 265]
[723 969 847 921 275]
[818 412 754 126 246]
Skarsnik hm Grammar still can't work on byte level? 16:24
timotimo if you read in your data as latin1 it can
it's a hack, but it does work 16:25
16:32 kensanata joined, p6bannerbot sets mode: +v kensanata
kensanata p6: use JSON::Fast; my @hashes = from-json '[{"a": 1, "b": 2}, {"a": 3, "b": 4}]'; for @hashes -> %hash { say %hash<a> } 16:32
camelia ===SORRY!===
Could not find JSON::Fast at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-1/share/perl6/site
/home/camelia/rakudo-m-inst-1/share/perl6/vendor
/home/camelia/rakudo-m-inst-1/share/perl6
CompUni…
kensanata Oops.
timotimo you're probably getting bitten by containerization
so you'll want to for @hashes<> -> %hash 16:33
b2gills Skarsnik: token data ($length) { 16:34
kensanata timotimo: I still get "Type check failed in binding to parameter '%hash'; expected Associative but got Array", so perhaps that's another problem I just haven't run into.
timotimo ah, yes 16:35
it'll have stored the result of from-json as the first element inside @hashes
so you'll also need to <> or .List on the result of from-json
kensanata timotimo: That's what it looks like. Interesting.
timotimo i want to change all that in JSON::Fast version 2
kensanata Would it make more sense to use JSON::Tiny?
16:36 ufobat___ joined
kensanata For now, I'll append a .List to from-json. That fixed it for me! 16:37
16:37 p6bannerbot sets mode: +v ufobat___
timotimo i was meaning for JSON::Fast to be a drop-in replacement for JSON::Tiny, so if the results differ between the two it'd actually go against my initial idea 16:38
kensanata timotimo: I verified that JSON::Tiny has the same feature. :)
timotimo "feature" :)
kensanata 😇
16:52 zakharyas joined 16:53 p6bannerbot sets mode: +v zakharyas 17:04 ryn1x left 17:05 phogg left
kensanata Given a loop like the one above, how could I parallelize my testing? Complete code here: github.com/kensanata/text-markdown...utomatic.t – basically I have a for @tests -> %test { ... } loop and know that they are all independent of each other and I'd like to keep the CPU as busy as I can for these tests. Or I guess tell me why this is a bad idea? 17:05
17:05 zakharyas left, zakharyas joined 17:06 p6bannerbot sets mode: +v zakharyas
kensanata Alternatively, a pointer to a suitable section in the Perl 6 Deep Dive book will do as well. :) 17:06
I guess I could create a test file for every test section and just let 'prove' handle it for me. 17:08
17:08 zakharyas left
kensanata The chapter on junctions makes me think I should be able to turn @tests into one big junction and then somehow it would all magically work... 17:09
17:09 zakharyas joined
timotimo you'll literally just "hyper for @tests.hyper(:batch(1)) -> %test { ... }" 17:09
i think the default Test implementation is not threadsafe 17:10
kensanata Ah. I guess that means farming it out to multiple files...
timotimo so you'd want probably want to .map instead of hyper-for, and then afterwards go through the results and use "ok" on it
17:10 p6bannerbot sets mode: +v zakharyas
timotimo no need for that :) 17:10
kensanata We'll see how well that works when tests are failing. :) 17:11
timotimo :) 17:12
17:13 TeamBlast left
timotimo you can also just protect the invocation of "is" or "ok" with a shared lock, but be extra careful that you actually calculate what should be passed to it beforehand 17:13
but using hyper and going through the result afterwards makes sure things are in the right order 17:14
AlexDaniel leont: which bug?
17:15 TeamBlast joined
leont rakudo#2379 17:15
synopsebot_ RAKUDO#2379 [open]: github.com/rakudo/rakudo/issues/2379 Loop variable in BEGIN block becomes a VMNull
17:15 p6bannerbot sets mode: +v TeamBlast
buggable New CPAN upload: App-Tasks-0.0.12.tar.gz by JMASLAK modules.perl6.org/dist/App::Tasks:cpan:JMASLAK 17:17
AlexDaniel timotimo: did you ticket it? 17:18
17:18 phogg joined, phogg left, phogg joined, p6bannerbot sets mode: +v phogg
AlexDaniel this one I mean: 17:18
c: 72473bd0^,72473bd0,HEAD srand(0); my int @foo; for ^4 { @foo = (1024.rand.Int) xx 5; say @foo; }
committable6 AlexDaniel, gist.github.com/a3b468b7df7c1767ba...8a6af9a8e5
17:18 p6bannerbot sets mode: +v phogg 17:21 ryn1x joined 17:22 p6bannerbot sets mode: +v ryn1x 17:28 lizmat joined, p6bannerbot sets mode: +v lizmat
timotimo no, but i fixed it 17:32
i didn't make spectest yet, though 17:33
17:37 lichtkind joined, p6bannerbot sets mode: +v lichtkind 17:50 dct joined, p6bannerbot sets mode: +v dct 17:52 molaf joined 17:53 p6bannerbot sets mode: +v molaf
Geth doc: uzluisf++ created pull request #2464:
Wording and text reflow
18:01
doc: 91c70d4271 | (Luis F. Uceta)++ | doc/Language/containers.pod6
Wording and text reflow
doc: f151a39e04 | (Luis F. Uceta)++ (committed using GitHub Web editor) | doc/Language/containers.pod6
Merge pull request #2464 from uzluisf/master

Wording and text reflow
synopsebot_ Link: doc.perl6.org/language/containers
18:04 zakharyas left 18:09 jmerelo left 18:13 ryn1x left
AlexDaniel .in 7d check if timotimo wrote a spectest for that thing that we don't even remember now 18:18
yoleaux AlexDaniel: I'll remind you on 25 Nov 2018 18:18Z
18:18 ryn1x joined, p6bannerbot sets mode: +v ryn1x 18:20 ryn1x left
Skarsnik hm, is there a shorter syntax for enum A{]; sub foo($piko where $piko = A1 | A2) ($piko is not needed) 18:31
18:33 hamhu3 joined 18:34 p6bannerbot sets mode: +v hamhu3, p6noob joined, p6bannerbot sets mode: +v p6noob 18:35 hamhu3_ left
p6noob Hi there, trying to make a Class that does Positional role indexing based on a Point. But Perl6 seems to always want to coerce to an Int first. 18:38
paste.ee/p/VcRYs Any battering with a clue stick, welcome. 18:39
Skarsnik hm probably because AT-POS always expect a Int? 18:43
p6noob Skarsnik, that's what it looks like. Is that a reasonable limitation though?
18:43 daxim left
Skarsnik This look weird ::?CLASS:D: Point $index xD 18:44
does it work with just Point $index
in the AT-POS and EXIST-AT?
p6noob Skarsnik: that is just the notation to force the type constraint of only being called from an instantiated object. 18:46
it works the same without that
Skarsnik ok, it seems it does not call the right multi method 18:47
sena_kun I am not an expert, but isn't `Positional` is a role with parameters? I somewhat remember something like this, let me search for some code...
Skarsnik or maybe [] does not just translate to AT-EXIST/AT-POS
p6noob Skarsnik: yeah, works the same even if I drop "multi"
sena_kun: oh cool. thx 18:48
18:50 daxim joined, p6bannerbot sets mode: +v daxim
Skarsnik m: my $foo = buf8.new(0); $foo.append("foo".decode("latin1")); 18:50
camelia No such method 'decode' for invocant of type 'Str'. Did you mean 'encode'?
in block <unit> at <tmp> line 1
Skarsnik m: my $foo = buf8.new(0); $foo.append("foo".encode("latin1")); 18:51
camelia ( no output )
kensanata I have the beginning of a parser here: github.com/kensanata/text-markdown...Common.pm6 and a simple test here: github.com/kensanata/text-markdown...t/simple.t and the test result is that I get (Str) instead of '<p>foo</p>' which makes sense. But where do I specify what parse should return? In the TOP action somehow?
sena_kun no, it seems I am wrong. it was about `Associative[Foo, Foo]` and for `Positional` it is only `Positional[Foo]` is seems, which denotes a value type.
p6noob, what if you define an operator `[ ]` that works with `Point` and your class? 18:52
p6noob sena_kun: Ah, okay I thought that was what the Positional role did for you. Let me lookup on how to define that and i'll give it a try. thanks for the idea. 18:53
Skarsnik hm
Cannot resolve caller append(Buf[uint8]: Blob[uint8]); none of these signatures match: <snip> (Buf:D $: Blob:D $buf, *%_) this sig should work? 18:54
sena_kun p6noob, give me one more second... 18:55
m: class A { has @.a = <Rize Sharo Chiya>; }; class Point { has $.index = 1; }; multi postcircumfix:<[ ]>(A $x, Point $p) { $x.a[$p.index] }; my $a = A.new; say $a[Point.new];
camelia Sharo
sena_kun something like this will allow you to have postcircumfix subscription without implementing `Positional`, but that's kind of cheating if you ask me. :) 18:56
and it depends on whether you just want indexing with `[ ]` or something more from Positional, like `for A.new -> $items` and such. 18:57
p6noob sena_kun, let me give that a go. This class already implements positional for Int and Int;Int indexing... was just trying to add convenience ability for a point.
sena_kun if it's just to make code neater/shorter, I think an op will do. 18:58
in its body you can get some indexes, turn those into Int if necessary and use your already implemented subscription.
Skarsnik m: my buf8 $foo; $foo.append("foo".encode("latin1"));
camelia Cannot resolve caller append(Buf[uint8]: Blob[uint8]); none of these signatures match:
(Buf:D: int $got, *%_)
(Buf:D: Int:D $got, *%_)
(Buf:D: Mu:D $got, *%_)
(Buf:D: Blob:D $buf, *%_)
(Buf:D: int @values, *%_)
(Buf…
Skarsnik !bug 18:59
!rt
what is the mail to send directly bug repport? xD
sena_kun Skarsnik, nowadays we use github issues.
Skarsnik, github.com/rakudo/rakudo/issues <-
Skarsnik, also, I am not really sure if it's a bug. 19:00
I mean, your `buf8` is not initialized, just typed.
m: my buf8 $foo = buf8.new; say $foo.append("foo".encode("latin1"));
camelia Buf[uint8]:0x<66 6F 6F>
Skarsnik the bug is that it should show thet buf is U 19:01
sena_kun ah
Skarsnik so you don't search forever why it does not match one of the signature ^^
sena_kun then please fill one. :)
sena_kun .oO ( my wisdom is still so shallow )
p6noob sena_kun: is there something similar to multi postcircumfix:<[ ]>(A $x, Point $p) {} for assignment.. to make $class[$point] = $val work? 19:24
sena_kun I haven't tried it myself, but something says to me that `=` is actually just your average operator. 19:25
let me check...
it'd be `infix`...
p6noob, docs.perl6.org/language/operators#infix_= <- yup 19:26
p6noob sena_kun: hmmm, I didn't think = was the issue there, need to noodle on that a bit
sena_kun p6noob, hmm, it depends on what `$class[$point]` returns, actually. 19:28
so yes, `=` does not seem like an issue to me. 19:29
b2gills p6noob: multi postcircumfix:<[ ]>(A $x, Point $p) is rw {} 19:30
sena_kun m: class A { has @.a = <A B C>; }; class Point { has $.index = 1; }; multi postcircumfix:<[ ]>(A $x, Point $p) is rw { $x.a[$p.index] }; my $a = A.new; $a[Point.new] = 'A'; 19:32
camelia No such method 'Int' for invocant of type 'Point'
in block <unit> at <tmp> line 1
p6noob b2gills: that makes a lot of sense... 19:38
sena_kun: that's the same error I keep getting :-)
19:39 thothamon joined
sena_kun well, then I can't help with this one. :/ 19:39
p6noob sena_kun: you've already been a help. Thank you
19:39 p6bannerbot sets mode: +v thothamon
sena_kun p6noob, the pleasure was all mine. :) 19:40
19:41 |oLa| left
b2gills m: class A { has @.a = <A B C>; }; class Point { has $.index = 1; }; multi postcircumfix:<[ ]>(A $x, Point $p, $?) is rw { $x.a[$p.index] }; my $a = A.new; $a[Point.new] = 'A'; dd $a 19:42
camelia A $a = A.new(a => ["A", "B", "C"])
b2gills For some reason sometimes &postcircumfix:<[ ]> gets called with a third argument
sena_kun p6noob, ^ 19:44
p6noob m: class A { has @.a is rw = <A B C>; }; class Point { has $.index = 1; }; multi postcircumfix:<[ ]>(A $x, Point $p, $?) is rw { $x.a[$p.index] }; my $a = A.new; $a[Point.new] = "Z"; dd $a 19:48
camelia A $a = A.new(a => ["A", "B", "C"])
19:49 dct left
p6noob b2gills: that has to be the answer on how to make it work... but it seems "Z" still isn't actually being assigned 19:49
thothamon Hey all, what are the best options, either now or on the horizon, for transpiling Perl6 to JavaScript in the browser? I.e. attempting to use Perl6 as a browser front-end language. I'd read about perlito and I see that nqp has a JS backend. Are these the best options? 19:50
El_Che thothamon: ping pmurias 19:51
sena_kun and now there is something I don't really get with Perl 6 type system...
thothamon Thanks El_Che
sena_kun m: class A { has Str @.a; }; my @a; @a.push('a'); A.new(|{a => @a});
camelia Type check failed in assignment to @!a; expected Str but got Array ($["a"])
in block <unit> at <tmp> line 1
sena_kun m: class A { has Str @.a; }; my $a; $a.push('a'); A.new(|{a => $a})
camelia Type check failed in assignment to @!a; expected Str but got Array ($["a"])
in block <unit> at <tmp> line 1
El_Che thothamon: github.com/rakudo/rakudo/tree/js
b2gills m: class A { has Str @.a; }; my Str @a; @a.push('a'); A.new(|{a => @a}); 19:52
camelia Type check failed in assignment to @!a; expected Str but got Array[Str] (Array[Str].new("a"))
in block <unit> at <tmp> line 1
sena_kun given I can't(likely) change such type restrictions, how can I make it work? Given I cannot type `@a` because I don't know exact type yet.
El_Che thothamon: here are some blogposts about it by pmurias: blogs.perl.org/users/pawel_murias/. There are some talks online as well
thothamon Ah thanks El_Che, I hadn't seen those 19:53
sena_kun I meant `my @a` lexical variable -> I cannot type that, as type is still unknown.
p6noob b2gills: it's passing the assignment value as the third parameter ! 19:54
kensanata Grammar student here... looking at this grammar github.com/kensanata/text-markdown...n.pm6#L73, say ~Text::Markdown::Common::Grammar.parse('foo', :actions(Text::Markdown::Common::ToHtml.new)); gives me "foo" instead of "<p>foo</p>". Any ideas? 19:56
pmurias thothamon: rakudo has a js backend ;)
thothamon Hey pmurias! Was just about to message you :-) 19:57
19:57 patrickz left
b2gills p6noob: That seems to be specific to that postcircumfix, most don't work that way 20:00
pmurias the backend itself handles a lot of Perl 6 (like 80% of roast test files) but for it's drawbacks the generated code is large (it doesn't do tree shaking) and it's yet optimized
b2gills m: class A { has @.a = <A B C>; }; class Point { has $.index = 1; }; multi postcircumfix:<< .M M. >>(A:D $x, Point:D $p) is rw { $x.a[$p.index] }; my $a = A.new; $a..M Point.new M. = 'Z'; dd $a
camelia A $a = A.new(a => ["A", "Z", "C"])
pmurias thothamon: if you have any question I'll gladly answer those 20:01
thothamon Hey pmurias, I tried to PM you but maybe I don't have the hang of this 20:02
p6noob b2gills: sena_kun: multi postcircumfix:<[ ]>(Pixels $i, Point $p, $v?) is rw { my $a := $i[$p.y;$p.x]; $a = $v if $v.defined; return-rw $a };
b2gills: is what I had just hacked together and seemed to work... but i'll take a look at what you just posted.
pmurias thothamon: you need to have your nick registered in freenode to msgs people
* msg
thothamon Oh! 20:03
OK
I was saying I was looking at the page that says to contact you about the perl6 js backend. It looks like nqp is the thing that actually translates to JS
pmurias there was an mass attack of spammers abusing internet of things devices that caused some restrictions :(
thothamon No problem, I can get that taken care of 20:04
pmurias thothamon: QAST is translated to JS
thothamon Is QAST the full perl6 AST?
b2gills p6noob: I think it is a bug. Just go with what you have and if the bug gets fixed your code should still work.
pmurias both NQP and Perl 6 get translated to QAST
20:04 domidumont left
thothamon I see. Cool! So a regular perl6 file should translate too. 20:04
p6noob b2gills: if i understood the bug i'd be happy to make a bug report.
pmurias thothamon: yes
perl6.github.io/6pad/ - allows you to test it in your browser 20:05
p6noob b2gills: as it is i don't really understand what i've written, was just copying from you and sena_kun
pmurias it's chrome only but I have a workaround for a missing Firefox feature in the work
thothamon pmurias: Perhaps running the output through Babel will make it more compatible with other browsers 20:06
pmurias BigInt support is still WIP in firefox 20:07
thothamon I see. What about perl regexes? Do those work cleanly or do you need to do something like use a JS regex? 20:08
pmurias I have mostly switched to using a github.com/GoogleChromeLabs/jsbi workaround but it needs a bug fixed (there is a PR underway)
thothamon: they get compiled to JS code
thothamon So they're clean, out of the box? That's very cool
I know there's a JSX slang out there, the raduko JS compiler plus that might be a quick way to enable a React app 20:09
Maybe a quick example app would prove the concept. 20:10
And also illustrate any ongoing pain points.
b2gills p6noob: I'm saying that &postcircumfix:<[ ]> is different in that it takes 3 arguments. It shouldn't be different.
pmurias thothamon: that was my plan behind creating the JSX slang
;)
thothamon Oh you created that! 20:11
haha
pmurias there are two
thothamon So you are a few (dozen) steps ahead of me :-)
pmurias github.com/pmurias/p6-jsx
thothamon: but I plan to get round to that next week (or kind of like that, no hard promises) 20:12
thothamon Yeah, cool, I appreciate you are a very busy guy ;-)
Mind if I take a crack at it? If I can't do it, at least I'll have some questions other people trying the same will probably have 20:13
Maybe just a super simple counter all 20:14
app
pmurias thothamon: sure
thothamon: I'll release a new rakudo.js to npm that actually supports loading modules in the browser (not only under node.js) 20:15
El_Che pmurias: what's the size of the java script you end up for a hello world app?
thothamon Ah nice...yeah I guess we'll need to lead react at least to create the component
load react
pmurias El_Che: you mean javascript?
El_Che pmurias: yes, the result of the compile 20:16
pmurias El_Che: the CORE setting is the big thing
b2gills My guess: MASSIVE
El_Che (just thiking on the likes of wasm on go, where you end up with a 10mb download) 20:17
thothamon Yeah right now I'd be delighted if it works at all, even if performance is terrible and size is horrible
pmurias El_Che: 75M unminified and uncompressed :(
for rakudo+CORE that's included in a hello world 20:18
El_Che pmurias: it will load as fast as gmail then, no worries :)
thothamon hahah
pmurias thothamon: the modules that we need to load is for JSX 20:19
thothamon: react can be loaded as a regular javascript ;)
thothamon Oh I thought you might have been referring to some kind of perl6/JS interop issue or something
pmurias thothamon: perl6.github.io/6pad/#4ee170f8043e...fb55d6a187 - example of perl6/JS interop 20:20
thothamon: I have been working on rakudo.js in node.js most of the time (because it's more convenient) 20:21
thothamon Yeah I understand that
Just a convenient first target 20:22
pmurias thothamon: I have fairly recently started working on the few things that are done differently in the browser
thothamon: yep, it even uses the same JS VM ;)
thothamon What is your goal? Are you going to try to address all the browser differences?
Go for a least-common-denominator? Or emit rational JS code and let something else transliterate? 20:23
pmurias for now I want to target the onest that are the vast majority of the market (chrome+firefox) 20:24
20:25 sacomo left
pmurias I count chrome derivatives such as Opera as chrome 20:25
and deal with others one rakudo.js is production ready and it's actually needed
thothamon Makes sense. Mobile might be a next step (iOS/Safari and Mobile Chrome)
20:25 sacomo joined 20:26 p6bannerbot sets mode: +v sacomo
thothamon Probably no effort to address older versions of FF/Chrome unless there's a crying need for it 20:26
And no effort for IE, which is being phased out by MS
In fact I think already deprecated by MS
pmurias FF/Chrome autoupdate 20:27
FireFox support will come next week
thothamon Then there's Edge, which is better than IE but can still be a pain 20:28
pmurias thothamon: if you want to play around with rakudo.js 6pad is recomended because it avoids the whole reload huge CORE/rakudo part for now
thothamon OK, cool. Yeah that's pretty nice. Have your example running now 20:29
pmurias thothamon: if you need something for 6pad tell me 20:32
btw. it's a stolen from dartpad.dartlang.org/ 20:33
AlexDaniel .in 6.5d nevermind the next reminder
yoleaux AlexDaniel: I'll remind you on 25 Nov 2018 08:33Z
20:39 yqt left
pmurias thothamon: for react 6pad likely needs to retrigger <script> tags (as innerHTML doesn't run those) github.com/dart-lang/dart-pad/blob...e.html#L42 20:39
thothamon: 6pad lives at github.com/perl6/6pad 20:40
the code behind is simple at the moment (bit primitive even ;) github.com/perl6/6pad/blob/master/main.js 20:41
thothamon: I'm not fully awake enough to fix it atm
sena_kun m: sub a { my @a; @a.push(1); @a }; my %params = a-result => a(); %params.perl.say 20:48
camelia {:a-result($[1])}
sena_kun how should I change my code to get `{:a-result([1])}` instead(i.e. not wrap a @ into $)? 20:49
pmurias thothamon: if you need anything I'll be around tommorow (and I backlog the irc log) 20:51
20:51 kensanata left
pmurias sleep& 20:52
20:52 pmurias left 20:57 ZZZzz_ joined, p6bannerbot sets mode: +v ZZZzz_, ZZZzz_ left 21:03 beeman left 21:08 beeman joined, p6bannerbot sets mode: +v beeman 21:18 Kaiepi left, ZZZzz_ joined, p6bannerbot sets mode: +v ZZZzz_ 21:34 lucasb joined, p6bannerbot sets mode: +v lucasb
lucasb how do you create method/sub aliases? like in P5 "*foo = \&bar" 21:35
21:38 Kaiepi joined 21:39 p6bannerbot sets mode: +v Kaiepi
sena_kun if I am understanding you correctly, for subs: 21:39
m: sub a { 1.say }; my &b = &a; &b();
camelia 1
sena_kun for methods it's possible with MOP, but that is a cheating and I should feel bad because of it:
m: class A { sub a { 2.say } }; my &b = A.^methods[0]; &b; 21:40
camelia WARNINGS for <tmp>:
Useless use of &b in sink context (line 1)
sena_kun m: class A { sub a { 2.say } }; my &b = A.^methods[0]; &b();
camelia Cannot invoke this object (REPR: Uninstantiable; Callable)
in block <unit> at <tmp> line 1
sena_kun hmm...
jnthn A sub is not a method
sena_kun yes
you need a self
jnthn Needs to be `method` inside the class 21:41
sena_kun but, well, anyway I am sure there is a better way to do that.
jnthn That's why A.^methods is empty
sena_kun ah, that's a thinko of mine. :)
m: class A { method a { 2.say } }; my &b = A.^methods[0]; &b(A.new);
camelia 2
jnthn m: class A { method m() { 2.say }; BEGIN A.^add_method('m2', A.^lookup('m'); }; A.m; A.m2; # perhaps this was wanted 21:42
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3GIN A.^add_method('m2', A.^lookup('m'); 7⏏5}; A.m; A.m2; # perhaps…
jnthn m: class A { method m() { 2.say }; BEGIN A.^add_method('m2', A.^lookup('m')); }; A.m; A.m2; # perhaps this was wanted
camelia 2
2
lucasb yes, that's what I wanted, thanks
21:42 Sound joined, p6bannerbot sets mode: +v Sound
lucasb you showed the method alias. is there any way for subs? 21:43
jnthn Just assignment `my &b = &a`
lucasb "my &b = &a" is a lexical var, works, but not totally equivalent to "*foo = \&bar"
jnthn I forget exactly what *foo is? 21:44
lucasb a type glob 21:45
jnthn Yes, I remember the name, not the semantics. I'm not sure Perl 6 has an equivalent.
In Perl 6, a `sub` decl is my-scoped by default, and really is installed as a lexical, though. The only significant thing is that it's done at compile time. 21:46
lucasb ah, I think like this works: 21:47
m: module Foo { our sub foo { 42 }; our &bar = &foo }; say Foo::bar
camelia 42
lucasb sorry for not being specific :)
jnthn Ah, right, package scoped subs. :)
lucasb ok, sub & method aliases. thanks sena_kun and jnthn
jnthn nearly never uses those :)
sena_kun jnthn, can you help me with `@` sigil semantics right now? 21:48
just in case 21:49
jnthn sena_kun: Use binding in the first place, or use .Map to turn the Hash (with the containers) into a Map (without)
lucasb In Ruby, "BEGIN Klass.^add_method('foo', Klass.^lookup('bar')" is spelled "alias foo bar" 21:50
can't we get something shorter in P6 too? :)
sena_kun can I with a Map instantiate an object with `.new(|@foo)`?
let's try it out...
jnthn lucasb: Just factor it out into a trait if doing it a lot. 21:51
lucasb: Then you can write `method foo() is aka('bar') { }` or however you want it
lucasb jnthn: ok. I'll see how to do that. thanks
jnthn sena_kun: Oh, I might not have read your question right :) 21:53
sena_kun jnthn, well, Map might be the answer.
jnthn Oh, no, I did. Map is the answer :) 21:54
sena_kun and there is A B problem, because I want something more deeper, but tried to make it less complex. :)
I'll try with Map approach anyway...
s/more//
hmm, no, I still can't instantiate a class. :S 21:56
21:56 rindolf left 21:59 benjikun joined, Sound left, p6bannerbot sets mode: +v benjikun
sena_kun m: class A { has Str @.p; }; sub a { sub in { my @a; @a.push: 'a'; @a }; my %params; %params<p> = in; %params; }; A.new(|a) 22:02
camelia Type check failed in assignment to @!p; expected Str but got Array ($["a"])
in block <unit> at <tmp> line 1
sena_kun m: class A { has Str @.p; }; sub a { sub in { my @a; @a.push: \'a\'; @a }; my @params; @params.push: \'p\'; @params.push: in(); @params.Map; }; say A.new(|a) 22:03
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3ush: in(); @params.Map; }; say A.new(|a)7⏏5<EOL>
expecting …
sena_kun m: class A { has Str @.p; }; sub a { sub in { my @a; @a.push: 'a'; @a }; my @params; @params.push: 'p'; @params.push: in(); @params.Map; }; say A.new(|a) 22:04
camelia A.new(p => Array[Str].new("a"))
sena_kun \o/
now it's the question why my real code does not work in a similar way...
oh, I've used `%params` in another place. the case is solved. jnthn++ 22:06
jnthn :)
Xliff_ \o 22:09
22:14 pecastro left
lucasb jnthn: ok. I'll see how to do that. thanks 22:16
oops, sorry. up arrow
timotimo ISTR we already had something like "is aka", but what do i know :)
lucasb yeah! I found Method::Also by lizmat on the ecosystem 22:17
timotimo cool
lizmat timotimo: is aka was reverted as it was deemed not sufficiently useful
lucasb my multi sub trait_mod:<is>(Method:D \m, :$aka!) { m.package.^add_method($_.Str, m) for @$aka } 22:21
timotimo OK 22:22
lucasb I'll copy this line into my module
Xliff_ lucasb: I'd use Method::Also, rather than that line. 22:26
I was using aka as well, but recently made the change.
lucasb I'm playing with a pseudo-pair object gist.github.com/lucasbuchala/9617c...6e288d02e8 22:29
not sure every details works yet. didn't tested yet :) 22:30
22:33 hamhu3_ joined, Bucciarati left, p6bannerbot sets mode: +v hamhu3_ 22:35 hamhu3 left 22:45 Bucciarati joined 22:46 p6bannerbot sets mode: +v Bucciarati 22:54 lucasb left 22:59 Skarsnik left 23:27 sena_kun left