»ö« 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. |
|||
00:05
rindolf left,
pecastro left
00:08
cpan-p6 left
00:10
mowcat joined,
zachk left
00:11
cpan-p6 joined
00:16
xq joined
|
|||
xq | on the page docs.perl6.org/language/modules link in section 'use' that says 'here' doesn't work - it's pointing to 'Finding modules' when it should point to 'Finding installed modules' | 00:17 | |
docs.perl6.org/language/modules#use | |||
00:17
SergiusUA left
|
|||
MasterDuke | xq: if you don't feel like submitting a PR, could you create an issue? github.com/perl6/doc/issues | 00:18 | |
00:19
random_yanek left
|
|||
Skarsnik | ok, I removed emiting an array and just emiting each $event and it work :( | 00:19 | |
anyways time to sleep xD | |||
00:20
Skarsnik left
|
|||
ryanth | Is there any reason at all why postfix for 1 .. $max would be slower than for 1 .. $max { ... } ? | 00:23 | |
I'm still trying to isolate it enough for a decent benchmark, so I might be imagining things at this stage. | 00:24 | ||
guifa | Is it slow if the postfix version is encased in a block? { … } for 1 .. $max? | 00:26 | |
00:26
cpan-p6 left
|
|||
ryanth | Good question. I'll check that, too. | 00:26 | |
00:27
cpan-p6 joined
|
|||
MasterDuke | ryanth: i think pre- and post- for should compile to the same code. however, introducing a new scop with {} is frequently slightly slower | 00:29 | |
ryanth | Seems you're right. Adding new scope is a lot slower, actually. $dummy = $_ vs { $dummy = $_ } is 0.9s vs 14.73s on a loop of 10_000_000 | 00:32 | |
postfix or not doesn't seem to matter | 00:33 | ||
Of course that difference would largely evaporate if my loop was actually doing anything :-) | |||
MasterDuke | wow. wouldn't have expected that much difference | ||
m: my $a; $a = $_ for ^1_000_000; say $a; say now - INIT now | 00:35 | ||
camelia | 999999 0.6813657 |
||
MasterDuke | m: my $a; { $a = $_ } for ^1_000_000; say $a; say now - INIT now | ||
camelia | 999999 0.7293779 |
||
00:36
random_yanek joined
|
|||
guifa makes mental note, avoid new scopes for big loops | 00:36 | ||
ryanth | Interesting... much smaller difference than I'm seeing | ||
MasterDuke | ryanth: what version of rakudo are you using? | 00:37 | |
ryanth | > perl6 --version | 00:38 | |
This is Rakudo version 2019.03.1-46-g6d8077cec built on MoarVM version 2019.03-35-gd15906711 | |||
implementing Perl 6.d. | |||
(Built earlier today) | |||
MasterDuke | huh. i would assume outside influences then for a difference that big | 00:41 | |
00:41
cpan-p6 left,
cpan-p6 joined
00:42
w_richard_w joined
|
|||
ryanth | I'd buy that, but it's very consistent. (Just a small bit of normal noise in the results.) | 00:42 | |
MasterDuke | can you --profile the two versions and check if there's anything obvious? | 00:46 | |
ryanth | Sure | 00:47 | |
00:47
mowcat left
|
|||
guifa | “This type (QAST::WVal) does not support positional operations” (but no line number :( ) | 00:51 | |
cpan-p6 | New module released to CPAN! Font-FreeType (0.1.8) by 03WARRINGD | 00:52 | |
ryanth | MasterDuke: Alright, I definitely have some weirdness here. My code no longer takes 14x longer to run loops with scope. Trying to get a more reproducible problem... | 00:53 | |
00:55
Sgeo__ left
00:56
Sgeo joined
|
|||
MasterDuke | guifa: using --ll-exceptions ? | 00:56 | |
00:57
cpan-p6 left,
cpan-p6 joined,
Khisanth left
|
|||
ryanth | The problem is in my timing code! my $start = now; ... say now - $start; works fine the first time, but if I do that again in the same scope, I get a value ~10x what I expect. | 01:00 | |
BUT it DOES actually take 10x as long. | |||
guifa | weird error message | 01:01 | |
But I figured it out | |||
p6: my @foo = 2,3,4; my $bar = 1; @foo.prepend:($bar) if $bar | 01:04 | ||
camelia | ===SORRY!=== This type (QAST::WVal) does not support positional operations |
||
guifa | p6: my @foo = 2,3,4; my $bar = 1; @foo.prepend: ($bar) if $bar | ||
camelia | ( no output ) | ||
guifa | Sneaky little typo | ||
egads, even sneakIER without parentheses | 01:06 | ||
p6: my @foo = 2,3,4; my $bar = 1; @foo.prepend:$bar if $bar; say @foo; | |||
camelia | [2 3 4] | ||
guifa | p6: my @foo = 2,3,4; my $bar = 1; @foo.prepend: $bar if $bar | ||
camelia | ( no output ) | ||
guifa | p6: my @foo = 2,3,4; my $bar = 1; @foo.prepend: $bar if $bar; say @foo | ||
camelia | [1 2 3 4] | ||
MasterDuke | ryanth: you're re-assigning a new now to $start? | 01:07 | |
or, can you show the code that you're using? | |||
ryanth | I've done that, and also tried a new my $start2 = now, etc. I can post the code... pastebin ok? | 01:08 | |
MasterDuke | sure | 01:09 | |
01:09
cpan-p6 left
01:10
cpan-p6 joined
|
|||
ryanth | pastebin.com/Ma8uSPgF | 01:10 | |
The first ~8 lines are enough to show the problem for me, MOST of the time. | 01:11 | ||
It'll either run in ~1 sec, or 4 sec. | |||
And it's *always* the second (and subsequent) loops that are slow | |||
01:12
Khisanth joined
|
|||
ryanth | So far all I know it doesn't have anything to do with postfix vs normal for loops, nor does now() matter | 01:13 | |
MasterDuke | i get essentially identical times for all cases | 01:14 | |
when i remove the exit | |||
ryanth | Have you run it a bunch of times? It'll run normally a few times in a row sometimes. | 01:15 | |
01:16
random_yanek left
|
|||
MasterDuke | 15 times in a row. everything was 0.1 plus/minus .01 | 01:16 | |
ryanth | That is interesting.. thanks for testing! Either I picked a bad time to build, or something *really* weird is going on with my Ubuntu box. I'll maybe roll back to 2019.03 and see if that's any different. | 01:19 | |
MasterDuke | fwiw, i'm also at HEAD and on kubuntu 18.10 | 01:20 | |
ryanth: you could try with perf stat or callgrind. those give instruction counts and you could see if that metric is also very different, not just time | 01:21 | ||
ryanth | Interesting. Same here, except I'm on xubuntu 18.10, which shouldn't matter. | 01:22 | |
Alright, I'll give that a shot. | |||
01:25
cpan-p6 left
01:26
cpan-p6 joined
|
|||
kawaii | is `(10000...99999).rand.Int` the most direct way of getting a random 5 digit number? it works but just looks... like I took the scenic route instead of the most direct one | 01:27 | |
01:28
random_yanek joined
|
|||
MasterDuke | m: say rand 5 | 01:28 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of rand(N); in Perl 6 please use N.rand for Num or (^N).pick for Int result at <tmp>:1 ------> 3say rand7⏏5 5 |
||
MasterDuke | kawaii: oh, and you want to use '..' instead of '...'. the sequence operator is much slower | 01:32 | |
ugexe | m: say (^9).rand.Int xx 5 # maybe reads a littler more obvious its specifically 5 digits and works with numbers with leading zeros | 01:34 | |
camelia | (8 7 8 1 0) | ||
ugexe | ^10 rather | ||
ryanth | MasterDuke: Been a while since I set up perf. I can't remember how to get cycles/instructions/etc. to show up. So it's taking me a little while... | 01:36 | |
(That is, `perf stat $cmd` shows <not supported> for cycles, instructions, branches, and branch-misses) | |||
MasterDuke | ryanth: hm. works for me. don't remember if i had to set anything up though | 01:38 | |
01:39
quipa left
|
|||
ryanth | My guess is it's a virtualization issue, as this particular install is a VM. I can run it on a dedicated box, but I'll have to rebuild rakudo | 01:39 | |
MasterDuke | that might explain it, i'm on bare metal | 01:40 | |
ryanth | Alright, I've done about all I can do for now then, until I can free up an 18.04 box to test with. Thanks for your help. | 01:46 | |
01:47
cpan-p6 left
|
|||
MasterDuke | np | 01:47 | |
01:48
cpan-p6 joined
01:49
MidCheck joined
01:56
zakharyas joined
02:03
cpan-p6 left
02:04
cpan-p6 joined
02:06
irco left
02:07
Herby_ joined
|
|||
Herby_ | o/ | 02:07 | |
02:13
lookatme_q left,
lookatme_q joined
02:17
cpan-p6 left
02:18
cpan-p6 joined,
Herby_ left
|
|||
guifa | Given the signatures foo(Str() bar) and foo(Callable bar) is default, how is foo(* + *) sent to the Str one instead of the Callable? | 02:19 | |
ugexe | m: multi sub foo(Str() $bar) { say 1; }; multi sub foo(Callable $bar) { say 2 }; foo(* + *) | 02:23 | |
camelia | 2 | ||
guifa | weird | 02:24 | |
ugexe | which one do you have first in your source code? | ||
the order is important | |||
guifa | oh wait, I figured it out. I was overtyping. I had “Callable &foo” and … it didn’t like that. Either dropping Callable or using the $ sigil made it work | 02:26 | |
02:31
cpan-p6 left
02:32
cpan-p6 joined
02:50
cpan-p6 left,
cpan-p6 joined
03:03
cpan-p6 left
03:04
cpan-p6 joined
03:18
cpan-p6 left,
cpan-p6 joined
03:44
cpan-p6 left
03:46
cpan-p6 joined
03:55
jiffyLOW joined
04:07
w_richard_w left
04:11
sauvin joined
04:18
w_richard_w joined
04:34
cpan-p6 left
04:38
cpan-p6 joined
04:41
Cabanossi left
04:49
Cabanossi joined
04:51
cpan-p6 left
04:52
cpan-p6 joined
05:02
guifa_ joined,
guifa left,
guifa_ is now known as guifa
05:20
cpan-p6 left
05:21
cpan-p6 joined
05:28
molaf joined
05:34
cpan-p6 left,
cpan-p6 joined
05:43
adu joined
05:48
curan joined
05:52
cpan-p6 left
05:58
cpan-p6 joined
06:08
andrzejku joined
06:09
MidCheck left
06:19
robertle left
06:25
cpan-p6 left
06:26
cpan-p6 joined
06:39
ChoHag left
06:51
cpan-p6 left,
Cabanossi left,
ChoHag joined,
cpan-p6 joined
06:54
zacts joined,
zacts left,
Cabanossi joined
07:08
adu left
07:11
Elronnd joined
07:17
cpan-p6 left
07:19
jmerelo joined
07:20
cpan-p6 joined
07:28
domidumont joined
07:44
cpan-p6 left
07:45
cpan-p6 joined
07:46
pistacchio left,
pistacchio joined
07:50
robertle joined
07:51
ufobat joined
07:53
frog_ joined
07:55
frog_ left
07:58
patrickb joined
08:00
cpan-p6 left
08:01
cpan-p6 joined
08:05
[Sno] left
08:06
woolfy left,
woolfy joined
08:07
netrino joined
08:10
dakkar joined
08:17
dakkar left
08:19
netrino left
08:26
cpan-p6 left
08:27
cpan-p6 joined
08:32
adu joined
08:36
rindolf joined
08:40
cpan-p6 left,
cpan-p6 joined
08:42
ExtraCrispy left,
rindolf left
08:52
zakharyas left
08:53
scimon joined
09:02
rindolf joined
|
|||
Geth | doc: c9c28134fd | (JJ Merelo)++ | 3 files Minor fixes and reflow |
09:05 | |
doc: cba74fec13 | (JJ Merelo)++ | doc/Type/StrDistance.pod6 Fixes StrDistance, refs #2683 |
|||
09:05
cpan-p6 left
|
|||
SmokeMachine | Xliff: github.com/FCO/Red/issues/15#issue...-474745855 | 09:10 | |
09:10
zakharyas joined
|
|||
SmokeMachine | .tell Xliff github.com/FCO/Red/issues/15#issue...-474745855 | 09:16 | |
yoleaux | SmokeMachine: I'll pass your message to Xliff. | ||
09:17
cpan-p6 joined
09:20
sena_kun joined
09:21
w_richard_w left,
kensanata joined
09:22
kurahaupo left
|
|||
kawaii | Good morning! I'm trying to constrain an array (used as a named parameter) to contain only ENUMs, I tried doing `method analyze(:$comment, MODEL :@models) {` and then setting my array like `my @models = MODEL::TOXICITY, MODEL::SPAM;`, which returns the following error: `Type check failed in binding to parameter '@models'; expected Positional[MODEL] but got Array ($[MODEL::TOXICITY, MO...)`. | 09:26 | |
sena_kun | you have to explicity initialize your array | 09:29 | |
like, `Array[MODEL].new(foo, bar, baz)` | |||
09:29
adu left
|
|||
sena_kun | as typecheck doesn't infer args | 09:29 | |
m: sub a(Int @a) { say @a }; a(Array[Int].new([1,2,3])); | 09:30 | ||
camelia | [1 2 3] | ||
sena_kun | m: sub a(Int @a) { say @a }; a([1,2,3]); | 09:31 | |
camelia | Type check failed in binding to parameter '@a'; expected Positional[Int] but got Array ($[1, 2, 3]) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
kawaii | sena_kun: like this? `my @models = Array[MODEL].new(MODEL::TOXICITY, MODEL::SPAM);` | ||
09:32
cpan-p6 left
|
|||
sena_kun | m: enum MODEL <A B>; sub a(MODEL @a) { say @a }; my MODEL @models = Array[MODEL].new(A, B, A); a(@models); | 09:32 | |
camelia | [A B A] | ||
09:33
cpan-p6 joined
|
|||
sena_kun | m: enum MODEL <A B>; sub a(MODEL @a) { say @a }; a(Array[MODEL].new(A, B, A)); | 09:33 | |
camelia | [A B A] | ||
sena_kun | kawaii, ^ | ||
kawaii | sena_kun: worked, thanks :) | 09:44 | |
sena_kun | \o/ | ||
09:46
zakharyas left
|
|||
xinming | m: | 09:49 | |
evalable6 | |||
xinming | m: $_ = %(:a<b>); $_.<a>.perl.say; | ||
camelia | "b" | ||
xinming | What is the difference between $_.<a> and $_<a>? | ||
moritz | nothing | ||
xinming | Ok, Thanks. | ||
09:51
Cabanossi left
09:56
Cabanossi joined
09:57
gregf_ joined,
cpan-p6 left
|
|||
Altreus | how does one constrain an array by type? | 10:02 | |
When we converted (:@models) to (MODEL :@models) it said... oh hang on | |||
sena_kun | `MODEL @models` should be enough. | 10:03 | |
and, actually, it is Positional[MODEL] type of constrain. if you certainly want an array, then `Array[MODEL] $models`. | 10:04 | ||
10:05
cpan-p6 joined
|
|||
Altreus | MODEL :@models seems like it should DWIM | 10:06 | |
note colon | |||
sena_kun | sure | ||
Altreus | Positional[MODEL] was the problem | ||
sena_kun | it being named should not be an issue | ||
Altreus | lemme see if I can find the actual error | 10:07 | |
Because ... well | 10:08 | ||
10:08
ToddAndMargo joined
|
|||
ToddAndMargo | Anybody on newbie duty tonight? | 10:08 | |
$ p6 'my $x="04030000_16014"; $x~~m/ (..) (..) (..) (..) ("_") (.*?) ("_") .* /; say $0;' Nil | |||
Why does `(..)` not pick out two letters? | 10:09 | ||
Altreus | I just feel like this is never what I mean when I say this | ||
jast | m: my $x="04030000_16014"; $x~~m/ (..) (..) (..) (..) ("_") (.*?) ("_") .* /; say $0 | ||
camelia | Nil | ||
ToddAndMargo | I want $0 to be 04 | 10:10 | |
jast | your expression attempts to match two underscore characters but your string only has one, hence the expression doesn't match | ||
10:10
ufobat_ joined
|
|||
Altreus | m: enum M ( <A B C> ); sub a(M :@ms) { say @ms } a(:ms(M::A, M::B)); | 10:10 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Strange text after block (missing semicolon or comma?) at <tmp>:1 ------> 3M ( <A B C> ); sub a(M :@ms) { say @ms }7⏏5 a(:ms(M::A, M::B)); expecting any of: infix inf… |
||
Altreus | m: enum M ( <A B C> ); sub a(M :@ms) { say @ms }; a(:ms(M::A, M::B)); | ||
camelia | Type check failed in binding to parameter '@ms'; expected Positional[M] but got List ($(M::A, M::B)) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
sena_kun | m: say "04030000_16014" ~~ / (..) (..) (..) (..) ("_") (.*?) ("_") .* / | ||
camelia | Nil | ||
Altreus | well OK | ||
ToddAndMargo | Poop! right under my nose!!! Thank you! | ||
Altreus | m: enum M ( <A B C> ); sub a(M :@ms) { say @ms }; a(:ms(@(M::A, M::B))); | 10:11 | |
camelia | Type check failed in binding to parameter '@ms'; expected Positional[M] but got List ($(M::A, M::B)) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
sena_kun | m: say "04030000_16014" ~~ / (..) (..) (..) (..) ("_") (.*?) / | ||
camelia | 「04030000_」 0 => 「04」 1 => 「03」 2 => 「00」 3 => 「00」 4 => 「_」 5 => 「」 |
||
jast | ToddAndMargo: "right under my nose" is the best kind of error IMO :) | ||
Altreus | m: enum M ( <A B C> ); sub a(M :@ms) { say @ms }; my @arr = M::A, M::B; a(:@ms); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@ms' is not declared at <tmp>:1 ------> 3) { say @ms }; my @arr = M::A, M::B; a(:7⏏5@ms); |
||
Altreus | m: enum M ( <A B C> ); sub a(M :@ms) { say @ms }; my @arr = M::A, M::B; a(:@arr); | ||
camelia | Unexpected named argument 'arr' passed in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Altreus | ok next time I promise I will test this in DM first | ||
m: enum M ( <A B C> ); sub a(M :@ms) { say @ms }; my @ms = M::A, M::B; a(:@ms); | |||
camelia | Type check failed in binding to parameter '@ms'; expected Positional[M] but got Array ($[M::A, M::B]) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Altreus | there | 10:12 | |
jast | reported to the internet police for using the bot | ||
Altreus | basically, why doesnt "M :@arr" mean "array of Ms" ? | ||
and why would I want it not to? | |||
10:13
ufobat left
|
|||
Altreus | m: enum M ( <A B C> ); sub a(Array[M :@ms) { say @ms }; my @ms = M::A, M::B; a(:@ms); | 10:14 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@ms' is not declared at <tmp>:1 ------> 3enum M ( <A B C> ); sub a(Array[M :7⏏5@ms) { say @ms }; my @ms = M::A, M::B; a |
||
Altreus | m: enum M ( <A B C> ); sub a(Array[M] :@ms) { say @ms }; my @ms = M::A, M::B; a(:@ms); | ||
camelia | Type check failed in binding to parameter '@ms'; expected Positional[Array[M]] but got Array ($[M::A, M::B]) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Altreus | m: enum M ( <A B C> ); sub a(Array[M] :$ms) { say $ms }; my @ms = M::A, M::B; a(:@ms); | ||
camelia | Type check failed in binding to parameter '$ms'; expected Array[M] but got Array ($[M::A, M::B]) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Altreus | idgi | 10:15 | |
sena_kun | erm... | 10:16 | |
Altreus, isn't it the same question kawaii asked a minute ago? :) | |||
give me a second... | |||
10:16
MidCheck joined
|
|||
sena_kun | m: enum M <A B C>; sub a(Array[M] :$ms) { say $ms }; my $ms = Array[M].new(M::A, M::B); a(:$ms); | 10:17 | |
camelia | [A B] | ||
kawaii | sena_kun: yes but I think we both agreed that `my MODEL @models = Array[MODEL].new(MODEL::TOXICITY, MODEL::SPAM, MODEL::INCOHERENT);` was an ugly and not very perl 6y way of doing it :) | ||
sena_kun | well, firstly, you can just use `TOXICITY, SPAM, INCOHERENT`. | ||
:) | |||
10:17
cpan-p6 left
|
|||
kawaii | ah true, because I've constrained to the MODEL ENUM already | 10:17 | |
sena_kun | secondly, you can omit a type. | ||
actually | |||
10:18
cpan-p6 joined
|
|||
sena_kun | because if it will be a MODEL 100% of time, moarvm optimizer will optimize all checks anyway. | 10:18 | |
just dynamically. | |||
Altreus | sena_kun: probably - I didn't see it | ||
kawaii | `my MODEL @models = Array[MODEL].new(TOXICITY, SPAM, INCOHERENT);` so this is a little cleaner now | ||
Altreus | The idea being that you *have* to pick from the enum | ||
it's not for the optimiser, it's for the developer | 10:19 | ||
But forcing the developer to do crap like that ^ just to satisfy the constraint is Not OK | |||
sena_kun | well, another way is to write a type alias, I think. | ||
but yes, this thing is not too convenient, imho. | |||
Altreus | Should I open an issue on some github, requesting nicer syntax? | 10:20 | |
10:20
ToddAndMargo left
|
|||
sena_kun | m: enum M <A B C>; sub a(:@ms where .all ~~ M) { say @ms }; my @ms = A, B; a(:@ms); | 10:21 | |
camelia | [A B] | ||
sena_kun | that's another way | ||
Altreus, I don't know, to be honest. I just know about this thing of the type checker. I am also not sure if it's an edge case of some serious design solution or just a lack of ones willing to patch type checker to make inference(which is HARD and I wonder if possible with dynamic nature of Perl 6). | 10:23 | ||
s/solution/decison/ | |||
s/decison/decision/ | |||
Altreus | Sure but at the same time it's not convincing me to prefer P6 over ... well anything really | 10:26 | |
kawaii | I think we'll stick with what we have now, it's not pretty but hey, it's a good time for me to wrote documentation anyway where I can warn users of the module that their scripts must adhere to that syntax :) | 10:27 | |
sena_kun | kawaii, you can use a `where`, then no issues for users. | ||
10:33
cpan-p6 left,
cpan-p6 joined
|
|||
discord6 | <Vendethiel> uh oh. zef install WWW ends with a Segfault after trying to install JSON::Name. 2nd time runs fine. | 10:42 | |
10:42
Black_Ribbon left
|
|||
kawaii | sena_kun: `my @models = (TOXICITY, SPAM);` now works, much nicer, thanks! :) | 10:44 | |
sena_kun | and parens are redundant too. ;) | 10:47 | |
jnthn | I'm curious why one would ever write `my MODEL @models = Array[MODEL].new(TOXICITY, SPAM, INCOHERENT);`; `my MODEL @models = TOXICITY, SPAM, INCOHERENT` works fine because it checks each thing as it assigns it into the Array. If using `:=` it'd make sense, but it's still a bit much to write out. | 10:49 | |
Array assignment is a copying operation, so the Array on the RHS is just a throwaway in such code. | 10:50 | ||
sena_kun | jnthn, eeeeeh... | ||
jnthn, because it fails the typecheck? | |||
10:50
cpan-p6 left
|
|||
sena_kun | otherwise. | 10:50 | |
jnthn | m: class C { }; my C @a = C.new, C.new; | 10:51 | |
camelia | ( no output ) | ||
discord6 | <Vendethiel> typed, it shouldn't | ||
jnthn | Looks OK to me? | ||
sena_kun | no | ||
jnthn, give me a second... | |||
discord6 | <Vendethiel> mh, when using zef install X --to=Y, it checks for deps globally. I wonder if there's a way aroudn that | ||
sena_kun | m: num MODEL <A B>; sub a(MODEL @a) { say @a }; my MODEL @models = A, B, A; a(@models); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3num7⏏5 MODEL <A B>; sub a(MODEL @a) { say @a } expecting any of: infix infix stopper statement end statemen… |
||
sena_kun | m: enum MODEL <A B>; sub a(MODEL @a) { say @a }; my MODEL @models = A, B, A; a(@models); | 10:52 | |
camelia | [A B A] | ||
sena_kun | erm, stop | ||
discord6 | <Vendethiel> it breaks down when it's untyped | ||
<Vendethiel> if you do my @models = .... it'll break though | |||
jnthn | What'll break? | ||
sena_kun | m: sub a(Int @a) { say @a }; a([1,2,3]); | ||
camelia | Type check failed in binding to parameter '@a'; expected Positional[Int] but got Array ($[1, 2, 3]) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
sena_kun | ^ | ||
discord6 | <Vendethiel> that's normal. | 10:53 | |
sena_kun | m: sub a(Int @a) { say @a }; my Int @a = 1, 2, 3; a(@a); | ||
camelia | [1 2 3] | ||
masak | that old thing. | ||
jnthn | Yes, of course. | ||
discord6 | <Vendethiel> Array is accessible from the outside, there's no way to tell it's not gonna be altered | ||
sena_kun | of course, the second one won't fail. | ||
masak | let's discuss it again :) | ||
discord6 | <Vendethiel> jnthn: I mean this: enum MODEL <A B>; sub a(MODEL @a) { say @a }; my @models = A, B, A; a(@models); | ||
10:53
cpan-p6 joined
|
|||
discord6 | <Vendethiel> I can't "m: ..." from discord... | 10:53 | |
sena_kun | it seems the answer is to just `my MODEL @models`. | ||
m: enum MODEL <A B>; sub a(MODEL @a) { say @a }; my MODEL @models = A, B, A; a(@models); | |||
camelia | [A B A] | ||
sena_kun | without a where constraint or explicit array. | 10:54 | |
-_- | |||
jnthn | OK, so nothing new here. :) | ||
I just saw the my Foo @a = Array[Foo].new(...) thing and was like "huh, that's a waste of chars/time" :) | |||
10:54
Ven`` joined
|
|||
Ven`` | m: enum MODEL <A B>; sub a(MODEL @a) { say @a }; my @models = A, B, A; a(@models); | 10:55 | |
camelia | Type check failed in binding to parameter '@a'; expected Positional[MODEL] but got Array ($[MODEL::A, MODEL::B,...) in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
masak | when you `MyType @a` a parameter, Perl 6 requires of the incoming array argument not just that it's filled with `MyType` values, but that the array _itself_ be an `Array[MyType]` | ||
discord6 | <Vendethiel> (I just wanted to have mine here) | ||
masak | that's why real Ven``'s eval just failed. | 10:56 | |
what I like about TypeScript here is that it succeeds where Perl 6 fails, so to speak | |||
kawaii | I settled for doing `method analyze(:@models where .all ~~ MODEL)` and then `my @models = TOXICITY, SPAM;` like sena_kun suggested :) | 10:57 | |
sena_kun | isn't it a tradeoff of where to have a type check? | ||
Ven`` | We don't do bottom-up type derivation, AFAIK. | ||
masak | in TypeScript, the array's type is inferred, not really part of the code. and so you don't have to cross your Ts and dot your Is in the same way. | ||
sena_kun | kawaii, what jnthn's suggested is better. | ||
Ven`` | no, Typescript just recovers the type from its use | ||
masak | kawaii: of course, that will loop forever on an infinite array ;) | 10:58 | |
Ven`` | At least in some places (it doesn't from return type i.e.) | ||
masak | Ven``: maybe that's a better way to describe it, yes | ||
Ven`` | .oO( we should introduce most() which checks only a random sample of the array and assume the rest is fine ) |
||
masak | in any case, next to TypeScript, Perl 6 does give a very stuffy feel. "I know the array looks good, but you have to _declare_ it!" | 10:59 | |
Ven`` | it looks good *right now*. Maybe with a `is copy` it should be smarter, but otherwise... | ||
sena_kun | the question is "can Perl 6 know it looks good or not in any possible case". | 11:00 | |
masak | point taken. | ||
Ven`` | This is akin to `const T&` in C++. Maybe you have a const reference to it, but that certainly doesn't mean it can't be mutated. | ||
masak | right | ||
it's a statement about a "view" on the value | |||
jnthn | Yeah, but isn't it also the case that TypeScript doesn't actually enforce anything at runtime, and just does best effort at compile time? | ||
masak | oh, definitely | ||
Ven`` | It does enforce some things at runtime in some cases (bivariance with function types, at least a few years back). | 11:01 | |
kawaii | sena_kun: github.com/shuppet/p6-api-perspect...5acf89232d | ||
fixed! | |||
`my MODEL @models = TOXICITY, SPAM;` is fine too :) | |||
sena_kun | \o/ | ||
jnthn | It could be interesting to try writing a structural typing module for Perl 6 :) | 11:02 | |
Ven`` | (I'm not sure "best effort" at compile-time is fair; since their OO is statically checked) | ||
jnthn: with the ways things are wired, would it be even imaginable replacing the OO system with a "static"(-ish) one? | |||
(let's say a simple version taht replaces dot-calls with sub calls, and generates multisub depending on self's type) | 11:03 | ||
jnthn | Ven``: In theory, though you might have to do a lot more type declarations to make things work, and decide what to do with FALLBACK, etc. | ||
Ven``: Oh, I'd probably do it as some kind of compiler plugin; it probably blocks on QTrees to do it really well. | 11:04 | ||
Ven`` | Interesting thought experiment at least | ||
jnthn | But in theory if there was a hook to obtain the compilation unit's QTree at compile time and a way to export a CHECK phaser, you'd probably be in a good place to write such a thing. | ||
kawaii | sena_kun: can I do `method analyze(:$comment, MODEL :@models = TOXICITY)` to have a default fall-back if :@models is not provided to the method? :) | 11:05 | |
11:06
cpan-p6 left,
cpan-p6 joined
|
|||
Ven`` | I'm not sure what to do with FALLBACK, but to be fair, most static OO systems don't have such a feature | 11:06 | |
sena_kun | kawaii, I doubt that. this is possibly a place where explicit type declaration may be necessary. | 11:07 | |
11:09
epony left
|
|||
Altreus | is there some magic whereby a scalar pulled from MODEL knows what it is, but an array of items pulled from MODEL doesn't have anyway of passing the type up to the array itself? | 11:10 | |
11:13
domidumont left
11:19
cpan-p6 left
11:20
cpan-p6 joined
|
|||
SmokeMachine | would it be possible to something like `sub bla(Int() @a) {}; blu [1, 2, 3]` to work? | 11:23 | |
and it transform `[1, 2, 3]` into `Array[Int].new: [1, 2, 3]` | 11:24 | ||
s/blu/bla/ | 11:25 | ||
11:33
cpan-p6 left
11:34
cpan-p6 joined
11:45
aindilis left,
quipa joined
|
|||
tbrowder | SmokeMachine: hi. i guess i need a working simple sample of how to get the data out of my Person table. i cannot figure out how to get Red to do it. | 11:48 | |
quipa | Hello, does someone know of a tutorial on using Perl/Tk in Perl 6 using Inline::Perl5 ? I am new to Perl 6 & 5 | 11:49 | |
I looked at Gtk::Simple but I am a bit unsure it's mature enough for what I will be doing | 11:50 | ||
GTK::Simple | |||
11:51
cpan-p6 left,
cpan-p6 joined
|
|||
tadzik | I think GTK::Simple is mature enough to provide more than Tk provides altogether :) | 11:51 | |
I don't remember anyone ever using Tk in Perl6 to be honest, so I doubt that there is a tutorial for it | 11:52 | ||
quipa | tadzik: Ok! I'll continue with the tutorials on GTK::Simple, hopefully your right :) | 11:54 | |
Also used to Tk so would avoid having to learn another GUI library, but hey why not :p | |||
tadzik | hehe | 11:55 | |
SmokeMachine | tbrowder: www.irccloud.com/pastebin/zbIa4F2t/ | ||
tadzik | to be fair, they are all quite similar in the way they work | ||
quipa | yup I've used Tkinter and wxPython in Python, but got to say for what I am doing (nothing to complex) Tk was a bit easier to deal with | 11:56 | |
11:56
pistacchio left
11:57
pistacchio joined
|
|||
quipa | I have only had contact with GTK using glade haven't ever done anything usable | 11:57 | |
11:57
Ven``` joined
|
|||
SmokeMachine | tbrowder: www.irccloud.com/pastebin/Uc3VELXi/ | 11:58 | |
11:59
Ven`` left
|
|||
quipa | on a totally different note, has anyone heard of an implementation in Perl 6 (or 5) of top down operator precedence / Pratt parser (that can dynamically define new token rules, like in the original CGOL developed by Pratt)? | 12:01 | |
tbrowder | SmokeMachine: erg, that looks good, but in my case it still throws. mabe my models are wrong? have you tried my case yet? i'm obviousy doing something stupid. | 12:03 | |
SmokeMachine | tbrowder: what happens when you do `.say for Person.^all`? | 12:04 | |
tbrowder | i'll paste it, give me a minute | ||
12:08
cpan-p6 left
|
|||
tbrowder | .say Person.^all => pastebin.com/9shdQLp5 | 12:08 | |
12:08
cpan-p6 joined
|
|||
tbrowder | the data seem to be there, but there's something worng with the call | 12:09 | |
*wrong | |||
i just pulled latest changes from upstream master and still get the same error. | 12:15 | ||
one major difference between your working example and the PR is the multiple associated models. in the error i'm not sure i see the other models' data | 12:17 | ||
is it an error in my model (looks like a relationship problem to me) or a Red problem? | 12:18 | ||
12:21
cpan-p6 left,
cpan-p6 joined
12:25
MidCheck left
|
|||
discord6 | <Vendethiel> Seems like even with ODBC I need a mssql driver installed to piggyback | 12:28 | |
12:28
AlexDaniel left
|
|||
scimon | quipa: I did a quick thing about GTK::Simple for last years advent calender. It's not too hard to use and the event handling via supplies is nice an easy. | 12:28 | |
perl6advent.wordpress.com/2018/12/...ktop-apps/ | 12:29 | ||
quipa | scimon: cool thanks :) | ||
scimon: was actually reading your article on Inline::Perl5 before asking | 12:30 | ||
tbrowder | also note the "child" models don't have a primary key. in the README i describe the need for a combined key created by uniqueness of data and person-id. Red may not be able to handle that yet, but my real-world case needs that. | 12:31 | |
quipa | or at advent calendar | ||
12:31
mowcat joined
|
|||
quipa | didn't realise it was different people hehe | 12:31 | |
12:31
mowotter joined
|
|||
quipa | perl6advent.wordpress.com/2016/12/...g-the-gap/ | 12:32 | |
tbrowder | for now i can call sqlite code inside query-db.p6 to read the tables unless you can see a work around for the combined key requirement. | 12:34 | |
12:36
andrzejku left
|
|||
tbrowder | for now i will work on the update part and see how that goes. | 12:36 | |
12:36
ravenousmoose left,
ravenousmoose joined,
zakharyas joined
12:37
cpan-p6 left,
epony joined,
cpan-p6 joined
12:48
pistacchio left,
pistacchio joined
|
|||
tbrowder | SmokeMachine: can on define a single relationship on two other models? | 12:49 | |
s/on/one/ | 12:50 | ||
12:55
cpan-p6 left
13:02
jmerelo left
13:07
cpan-p6 joined
13:22
lucasb joined,
zakharyas left
13:24
cpan-p6 left
13:25
cpan-p6 joined
13:26
AlexDaniel joined
13:31
MidCheck joined
13:43
cpan-p6 left
13:44
cusion joined,
mowotter left,
mowcat left
13:45
mowcat joined,
cpan-p6 joined
|
|||
SmokeMachine | tbrowder: what do you mean? | 13:46 | |
tbrowder | look at the README and the sql for the tables as i think they would be created if i were using sqlite directly. notice the two unique columns thus a kind of combined key. doesn't that sound like a relationship on two models? | 13:51 | |
13:51
Cabanossi left
|
|||
tbrowder | i'm going to add red's sql for the tables to the readme to show the comparison. | 13:53 | |
13:58
Cabanossi joined
13:59
ravenousmoose left
14:06
eliasr joined
14:08
ravenousmoose joined
14:19
natrys joined
14:20
cpan-p6 left,
cpan-p6 joined
14:30
ravenousmoose left
14:31
ravenousmoose joined
14:34
cpan-p6 left,
cpan-p6 joined
14:38
Sgeo left
|
|||
SmokeMachine | tbrowder: I would probably do something like this... (not tested) www.irccloud.com/pastebin/UGwTrDBo/ | 14:39 | |
14:45
sno joined
14:46
cpan-p6 left
14:47
cpan-p6 joined
14:56
molaf left
15:00
MasterDuke left
15:02
Ven```` joined
15:03
Ven``` left
15:05
cpan-p6 left
15:06
cpan-p6 joined
15:19
cpan-p6 left
15:20
cpan-p6 joined
|
|||
tbrowder | SmokeMachine: thanks, looks like a plan! | 15:20 | |
15:31
Migas joined,
Migas left
15:34
cpan-p6 left
15:35
cpan-p6 joined,
kurahaupo joined
15:41
pierrot left
|
|||
AlexDaniel | kawaii: please hang around on #perl6-dev and #moarvm | 15:42 | |
kawaii | AlexDaniel: done! | ||
AlexDaniel | kawaii: also here's the public log (similar link for other channels is available too): colabti.org/irclogger/irclogger_logs/perl6-dev | ||
kawaii | I also re-sent my CLA earlier, and cc'd Coke | ||
AlexDaniel | kawaii: also, I think the discord bot is now on #perl6-dev and #moarvm, so you should be able to read the logs there as well | 15:43 | |
15:43
pierrot joined
15:47
cpan-p6 left,
curan left,
cpan-p6 joined
15:49
jmerelo joined
|
|||
kawaii | It is, but I like IRC now so :) | 15:50 | |
xinming | What is the best way to implement array with fixed length? Something like, when we call push, the @array remove's the first elements? | 15:51 | |
15:51
Cabanossi left
|
|||
xinming | I wrote one implementation myself, Just wonder if there is better ways for this purpose. | 15:51 | |
sena_kun | a custom class. | 15:52 | |
I doubt there is. | |||
xinming | for example, with array fixed length | ||
sena_kun | and a class is a pretty normal solution. | ||
xinming | Or maybe roles. | ||
my @array = blabla; @array does FixedLength(5); | |||
Maybe something like this. | |||
sena_kun: How do I specify the array class for @array? | 15:53 | ||
sena_kun | You can make FixedLength `does` Positional and re-implement necessary method. | ||
ugexe | you'd probably create a does Positional class, and then use e.g. custom BIND-POS | ||
jmerelo | xinming: a subset that could be parametrized could be ideal | ||
xinming | my Int @array creates a array with values with Int. Not the class for that. | ||
15:53
mowcat left
|
|||
jmerelo | xinming: as in subset fixedlength where fixedlength.elems < $x. I don't think that can be done. | 15:53 | |
AlexDaniel | xinming: like a deque, right? | 15:54 | |
ugexe | m: my Int @array; say @array.^name | ||
camelia | Array[Int] | ||
sena_kun | `class Foo does Posiitional { method BIND-POS {...} }` and then `my Foo $array`. | ||
AlexDaniel | with a maxlen | ||
xinming | AlexDaniel: Yes, a bit like deque, But actually, It's used to keep history. | 15:55 | |
And throw out old ones | |||
AlexDaniel | xinming: if you implemented that, perhaps consider publishing a module | 15:57 | |
xinming | What I do for now is, I override the push method, and with my own implementation, It uses splice to re-shape the array. | ||
ugexe | what if they use something other than push? | ||
:P | |||
xinming | I'm still thinking for the good sollution. | ||
ugexe | @foo[$max + 1] = 666 | ||
AlexDaniel | xinming: maybe consider a ring buffer instead of splicing | ||
ugexe | @foo.append(...) | ||
xinming | ugexe: I haven't think about this yet. as I use the push method only. :-) | ||
ugexe | thats why you would does Positional and write e.g. BIND-POS methods | ||
which would work for push, append, etc | 15:58 | ||
xinming | Since after splice, the @array is already updated. | ||
15:58
Possum joined
|
|||
xinming | AlexDaniel: does perl6 have ring buffer? | 15:58 | |
AlexDaniel | xinming: no, but if you implement the logic it's probably going to be many times more efficient than doing what you have now :) | 15:59 | |
xinming | Ok, Will check them. | 16:00 | |
ANother question just raised | |||
m: my Int @array; say @array.^name | |||
camelia | Array[Int] | ||
xinming | How can we may the Array[Int] to MyArray[Int] for @array? | ||
jmerelo | xinming: Use a role? | 16:02 | |
16:03
Cabanossi joined
|
|||
xinming | Not a role, I'm thinking about how to make @array to use customized class. | 16:03 | |
moritz | using the "is" trait | ||
my Int @array is MyArray | |||
xinming | got it. Thanks. | ||
That's what I'm curious about. | |||
moritz | (iirc; haven't tried it with type constraints yet) | ||
xinming | I think, In my rest of my life, I'll only use perl6 as much as I can. :-) | 16:04 | |
lizmat | news.perlfoundation.org/2019/03/gra...-for-.html | ||
Grant Committee - Request for Members | |||
AlexDaniel | weekly: news.perlfoundation.org/2019/03/gra...-for-.html | 16:05 | |
notable6 | AlexDaniel, Noted! | ||
AlexDaniel | :) | ||
moritz | dumb question: am I still member of the grants committee? | ||
I'm pretty sure I was asked to vote on one or two grant applications, and then never again | 16:06 | ||
but nobody told me I was out either | |||
AlexDaniel | weekly: Welcome to the new rakudo dev Kane Valentine (kawaii) github.com/kawaii | ||
notable6 | AlexDaniel, Noted! | ||
kawaii | ah, a link to my github where you'll all see my bad perl 6 modules | 16:07 | |
AlexDaniel | yes | ||
moritz: I think you should ask [Coke] directly (via email) | |||
moritz | AlexDaniel: probably, yes | ||
xinming | m: class T is Array { }; my @a is T; @a.^name | 16:09 | |
camelia | ( no output ) | ||
kawaii | Altreus: I should probably rewrite API::Cloudflare using Cro::HTTP:Client if we're going to standardise our API libs around Cro ecosystem | ||
xinming | m: class T is Array { }; my @a is T; @a.^name.say; | ||
camelia | T | ||
xinming | m: class T is Array { }; my Int @a is T; @a.^name.say; | ||
camelia | T[Int] | ||
xinming | perl6++ | ||
ugexe | m: role Foo[$bar] { }; say Foo[Int].new.^name | ||
camelia | Foo[Int] | ||
ugexe | you can use a role like a class | 16:10 | |
16:10
MidCheck left
|
|||
xinming | and with parameterized roles, We can have only one public attribute | 16:10 | |
ugexe | no | ||
xinming | Will this limitation be removed in the future? | ||
ugexe: It is | 16:11 | ||
ugexe | only one public attribute means you can do `does RoleName(...)` instead of `does RoleName[...] | ||
xinming | role T { has $.a; has $.b; }; | ||
ugexe | whats wrong with that? | ||
xinming | ugexe: Yes, Aren't they the same? | ||
does RoleName(...) <--- does RoleName[...] | 16:12 | ||
ugexe | no they are not the same | ||
xinming | this makes me confused. | ||
ugexe | then just use the second variant | ||
16:12
cpan-p6 left
|
|||
moritz | the does RoleName(...) syntax is a shortcut that only works when one attribute is present | 16:12 | |
16:13
cpan-p6 joined
|
|||
moritz | if the role has more attributes, you cannot use it, but you can still use the [] syntax | 16:13 | |
ugexe | and RoleName[...] does not setup attributes at all, although you can manually use the `...` code to set them | ||
xinming | moritz: Yes, I use that. and 'does RoleName[$arr1, $attr2]' will work? | ||
ugexe | m: ole Foo[$a, $b] { has $.a = $a, has $.b = $b }; say Foo[1,2].new.a | 16:14 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3ole Foo[7⏏5$a, $b] { has $.a = $a, has $.b = $b }; |
||
xinming | Don't know why does RoleName(...) won't support multiple public attrs. | ||
ugexe | m: role Foo[$a, $b] { has $.a = $a, has $.b = $b }; say Foo[1,2].new.a | ||
camelia | 1 | ||
ugexe | how should RoleName(1,2) know which public attributes 1 and 2 go to? | ||
RoleName(1) can assume there is only a single public attribute, and thus doesn't need to know that attributes name | 16:15 | ||
xinming | m: role T { has $.a }; my $x = 1 does T(:a(5)); $x.a.perl.say; | 16:16 | |
camelia | 5 | ||
xinming | m: role T { has $.a }; my $x = 1 does T(5); $x.a.perl.say; | ||
camelia | 5 | ||
xinming | ugexe: But with :a(5) in this example, We can request which attr to be initliazed. | 16:17 | |
m: role T { has $.a; has $.b; }; my $x = 1 does T(:a(5), :b(3)); $x.a.perl.say; | |||
camelia | Cannot invoke this object (REPR: Uninstantiable; T) in block <unit> at <tmp> line 1 |
||
xinming | m: role T { has $.a; has $.b; }; my $x = 1 does T[:a(5), :b(3)]; $x.a.perl.say; | 16:18 | |
camelia | Could not instantiate role 'T': in any protect at gen/moar/stage2/NQPCORE.setting line 1099 in block <unit> at <tmp> line 1 |
||
xinming | m: role T[$a, $b] { has $.a; has $.b; }; my $x = 1 does T[:a(5), :b(3)]; $x.a.perl.say; | ||
camelia | No appropriate parametric role variant available for 'T' in block <unit> at <tmp> line 1 |
||
xinming | m: role T[$a, $b] { has $.a = $a; has $.b = $b; }; my $x = 1 does T[5, 3]; $x.a.perl.say; | ||
camelia | 5 | ||
xinming | m: role T[$a, $b] { has $.a = $a; has $.b = $b; }; my $x = 1 does T[:a(5), :b(3)]; $x.a.perl.say; | ||
camelia | No appropriate parametric role variant available for 'T' in block <unit> at <tmp> line 1 |
||
16:19
xq left
|
|||
ugexe | m: role T { has $.a }; my $x = 1 does T(:z(5)); $x.a.perl.say; | 16:19 | |
camelia | 5 | ||
ugexe | that did not set `z`, it set `z` | ||
so you did not request which attr to be initialized | |||
xinming | So, it tries to use the pair value to init the public attribute | ||
ugexe | well that much seems like a bug. but what its not doing is requesting which attr to be initialized | 16:20 | |
i'd expect T(:x(5)) to set $.a to x => 5, but it sets $.a to 5 | |||
xinming | ugexe: Thanks for the explanation, I thought it was a feature to assign attr value. | 16:21 | |
16:21
Black_Ribbon joined
|
|||
xinming | ugexe: so, for `does Role(...)` the content between (...) are all for the single public attribute. | 16:22 | |
ugexe | yeah, except the seemingly buggy behavior shown with pairs | ||
xinming | But that make me curious why can't we make it a capture kind of thing. | 16:23 | |
ugexe | m: role T { has $.a }; my $x = 1 does T(:z(:y(5))); $x.a.perl.say; | ||
camelia | :y(5) | ||
ugexe | so a pair inside a pair is fine? | ||
xinming | let's say, role Role1 { has $.attr1; has $.attr2; }; $var does Role1(:attr1<value1>, :attr2<value2); | 16:24 | |
ugexe: I think the current logic, if it's a pair, it tries to return the value of the pair and use that value to init the role. | |||
16:25
lookatme_q left,
bobby left,
cpan-p6 left,
lookatme_q joined,
cpan-p6 joined
|
|||
xinming | Is there any reason to not design the does Role1(:attr1<value1>, :attr2<value2>) like this? | 16:26 | |
tbrowder | SmokeMachine: i'm assuming the order of attributes or traits for a column{} in a model is not critical so i'm changing your code a small bit to keep my original format. | ||
16:26
patrickb left
|
|||
xinming | Just want to know the reason behind the design decision :-) | 16:27 | |
16:27
bobby joined
|
|||
xinming | anyone would answer that for me? :-D | 16:27 | |
tbrowder | SmodeMachine: is the order of listing attibutes for a model critical? from the generated sql it doesn't look so. | ||
SmokeMachine | tbrowder: nowadays Red ignores the attractive order... github.com/FCO/Red/issues/135 | ||
jnthn | xinming: It was provided simply as a shortcut for the one-attribute case, to ease adding simple properties to an existing object. There may be further reasoning in S12. | 16:28 | |
Forcing writing the attribute name would make it a less useful shortcut, and trying to guess one way or the other would be ambiguous and confusing. | 16:29 | ||
xinming | jnthn: Thanks for the explanation. | 16:30 | |
so role Role1 { has $.a }; does Role1(5); is the same as role Role1[$a] { has $.a = $a }; does Role1[5]; right? | 16:31 | ||
hmm, well, ignore me. | |||
tbrowder | ok, thnx. i have to be away for a while, but i am working on your suggesitons and expect to good results!! 😁 | ||
*suggestions *get good [stupuid <= keyboard] | 16:32 | ||
xinming | I think they are the same. :-) | ||
ugexe | i can say they are probably the same enough for your purposes :P | 16:34 | |
16:34
bobby left
|
|||
ugexe | otherwise remember you'll have an `$a` floating around in your role in the second example | 16:34 | |
which probably isn't a problem. just pointing out its not exactly the same | 16:35 | ||
xinming | ugexe: I'd like to know deeper. | ||
Geth | doc: 4b5032160c | (Elizabeth Mattijsen)++ | doc/Programs/03-environment-variables.pod6 Make sure that environment variables can be searched And some minor rewording / consistent flowing. |
||
doc: 5b0448dcfd | (Elizabeth Mattijsen)++ | doc/Type/Variable.pod6 Add some more info about "is dynamic" And how it should probably not be used. |
|||
16:36
bobby joined
|
|||
xinming | m: role R[$a] { $a //= 5; has $.a = $a; }; my $x = 1 does R(); $x.a.perl.say; | 16:38 | |
camelia | Cannot mix in non-composable type R(Any) into object of type Int in block <unit> at <tmp> line 1 |
||
xinming | m: role R[$a] { $a //= 5; has $.a = $a; }; my $x = 1 does R(3); $x.a.perl.say; | ||
camelia | No appropriate parametric role variant available for 'R' in block <unit> at <tmp> line 1 |
||
16:38
cpan-p6 left
|
|||
xinming | m: role R[$a] { $a //= 5; has $.a = $a; }; my $x = 1 does R[3]; $x.a.perl.say; | 16:38 | |
camelia | 3 | ||
16:39
cpan-p6 joined
|
|||
xinming | m: role R[$a] { $a //= 5; has $.a = $a; }; my $x = 1 does R[]; $x.a.perl.say; | 16:39 | |
camelia | No appropriate parametric role variant available for 'R' in block <unit> at <tmp> line 1 |
||
xinming | m: role R[$a] { $a //= 5; has $.a = $a; }; my $x = 1 does R[Nil]; $x.a.perl.say; | ||
camelia | Could not instantiate role 'R': in any protect at gen/moar/stage2/NQPCORE.setting line 1099 in block <unit> at <tmp> line 1 |
||
xinming | m: role R[$a] { $a = 5; has $.a = $a; }; my $x = 1 does R[0]; $x.a.perl.say; | ||
camelia | Could not instantiate role 'R': in any protect at gen/moar/stage2/NQPCORE.setting line 1099 in block <unit> at <tmp> line 1 |
||
xinming | ugexe: Is this a bug too? | 16:40 | |
m: role R[$a] { $a ||= 5; has $.a = $a; }; my $x = 1 does R[0]; $x.a.perl.say; | |||
camelia | Could not instantiate role 'R': in any protect at gen/moar/stage2/NQPCORE.setting line 1099 in block <unit> at <tmp> line 1 |
||
xinming | Or, after role is compiled, the param shouldn't be changed? | 16:41 | |
ugexe | is LTA error message | 16:42 | |
m: role R[$a is copy] { $a ||= 5; has $.a = $a; }; my $x = 1 does R[0]; $x.a.perl.say; | |||
camelia | 5 | ||
xinming | Ah, THanks | 16:43 | |
16:43
bobby left
16:44
bobby joined
|
|||
jnthn | xinming: They work quite differently, though the visible result would indeed about the same. | 16:45 | |
xinming | m: role R[::X] { has X $.a; }; my $x = 1 does R[Int]; $x.a.perl.say | ||
camelia | No such method 'perl' for invocant of type 'X' in block <unit> at <tmp> line 1 |
||
jnthn | xinming: Parametric roles are intenred on their positional parameters | ||
Which means that they'll not be GC'd | 16:46 | ||
So if you do `does R[$value]` for a thousand different Int instances then you'll have a thousand different roles | |||
Whether that's a problem depends on what you're doing | 16:47 | ||
It might not matter, or it might cause your program to eat huge volumes of memory :) | |||
xinming | Thanks for the note. | ||
m: role R[::X] { has X $.a; }; my $x = 1 does R[Int]; $x.a.perl.say | |||
camelia | No such method 'perl' for invocant of type 'X' in block <unit> at <tmp> line 1 |
||
xinming | m: role R[::X] { has X $.a is rw; }; my $x = 1 does R[Int]; $x.a = 4; $x.a.perl.say | 16:48 | |
camelia | 4 | ||
xinming | In this case, it work as expected | ||
No such method 'perl' for invocant of type 'X', Is this desired behaivor? | |||
jnthn | Yeah, I think that first issue is already filed; it's failing to handle the default there | ||
16:48
robertle left
|
|||
jnthn | During generic instantiation | 16:49 | |
vrurg++ was/is working on that, I think | |||
xinming | I thought that we'll always have "perl" method. :-) | ||
jnthn: Got it. | |||
Geth | doc: dfd3cdbb55 | (JJ Merelo)++ | 2 files Eliminates reference to preview and reflow, refs #2687 |
16:51 | |
16:51
Bob- joined
16:52
bobby left
16:57
cpan-p6 left,
bobby joined,
Bob- left
17:01
cpan-p6 joined
17:06
guifa_ joined
17:07
guifa left,
guifa_ is now known as guifa
17:13
sauvin left
17:14
cpan-p6 left
17:19
cpan-p6 joined
17:20
ufobat_ left
17:27
molaf joined
17:30
scimon left
17:36
cpan-p6 left
17:37
cpan-p6 joined
17:45
domidumont joined
17:50
cpan-p6 left
17:51
cpan-p6 joined,
vrurg left
18:05
cpan-p6 left,
|oLa| left,
cpan-p6 joined
18:07
Ven````` joined,
pistacchio left,
pistacchio joined
18:08
Ven```` left
18:10
aindilis joined
18:11
andrzejku joined
18:12
sno left,
pistacchio left,
pistacchio joined
18:13
ravenous_ joined,
pistacchio left,
ravenous_ left
18:14
pistacchio joined
18:15
sno joined
18:16
zachk joined
18:17
zachk left
18:18
zachk joined
18:19
pistacchio left,
kensanata left,
zachk left,
zachk joined,
zachk left
18:20
zachk joined,
zachk left,
zachk joined
18:21
zachk left
18:24
cpan-p6 left
18:30
pirateFinn left,
lucasb left,
scott left
18:31
eliasr left,
mrsolo left,
BuildTheRobots left,
patrickb joined,
kipd left
18:32
jhill left,
mrsolo joined
18:33
eliasr joined,
BuildTheRobots joined
18:35
kipd joined,
jhill joined
18:37
netrino joined
18:39
leont joined
18:40
scott joined
18:45
pirateFinn joined
18:57
andrzejku left
19:04
pistacchio joined,
sena_kun left
19:05
pistacchio left
19:06
pistacchio joined
19:10
andrzejku joined
19:11
vrurg joined,
uzl joined
|
|||
uzl | It seems repl.it is making some progress towards including Perl 6 as one of its available languages. repl.it/languages/perl6 | 19:13 | |
yoleaux | 17 Mar 2019 19:26Z <jmerelo> uzl: there are several mentors involved usually, just in case someone is busy for some stretch of time. Summer is long... | ||
17 Mar 2019 19:26Z <jmerelo> uzl: we'll definitely do that. | |||
jmerelo | uzl: great! | ||
19:13
MilkmanDan left
|
|||
uzl | Sure! Just came across this tweet from them: twitter.com/replit/status/11081841...49472?s=20 | 19:14 | |
19:15
MilkmanDan joined
|
|||
uzl | weekly: Perl 6 in Repl.it (twitter.com/replit/status/11081841...9472?s=20) | 19:16 | |
notable6 | uzl, Noted! | ||
uzl | * on/in? | 19:17 | |
jmerelo | uzl: you're good with in. | ||
uzl | jmerelo: I don't know why but for some reason "on" sounds more natural to me when talking about websites (i.e., on Github/Youtube/etc.) ;-) | 19:20 | |
jmerelo | uzl: like "hang it on the web" | ||
uzl | jmerelo: sort of... | 19:22 | |
jmerelo | If you're still interested in GSoC, you should start to prepare a project to submit. | 19:23 | |
uzl | but there's probably not idiomatic difference when using either "in" or "on" in this case so I'm not really sure. | ||
19:26
andrzejku left
|
|||
uzl | jmerelo: the thing is I don't have anything in mind and the idea of half-delivering one of the current project ideas (at least, the most approachable to my current skills) makes me shiver... | 19:28 | |
jmerelo | uzl: we can talk in private if you want so that we can create a good proposal from what it's there. It's going to be limited to what I know, though... | 19:29 | |
uzl: going now for dinner. You can reach me at this nick (or jjmerelo) at gmail, if you want. | |||
19:29
jmerelo left
|
|||
vrurg | jnthn: you mentioned me with regard to parmetrized roles bug. There is a PR already for a similar case – 2731. Though I'd need to check if it fixes xinming's case. Will test later today if get more time. | 19:30 | |
uzl | jmerelo: I'll do so. Buen provecho! | 19:31 | |
19:31
uzl left
19:34
niclo joined
19:45
|oLa| joined
|
|||
niclo | hi all, newbie here | 19:45 | |
AlexDaniel | hello | ||
19:46
cpan-p6 joined
19:47
Geth left,
Geth joined,
ChanServ sets mode: +v Geth
19:50
MidCheck joined,
telex left
19:52
telex joined
|
|||
niclo | i'm completely new to perl6 and i'm looking for good reference to use, possibly a book, do you think Learning Perl 6 by O'Reilly can be a good one ? | 19:53 | |
to use togheter with online documentation | |||
moritz | niclo: do you have experience with other programming languages? | 19:57 | |
perl6book.com/ has a flow chart to recommend you a Perl 6 book based on a few questions like that :D | 19:58 | ||
niclo | thank you so much | ||
quipa | Yeah that's a really nice and simple graph just saw it a few hours ago on my own learning process | 19:59 | |
20:01
pecastro joined
20:02
netrino_ joined
20:04
dr_df0 joined,
netrino__ joined,
netrino left
20:05
|oLa| left
20:06
robertle joined
20:07
netrino_ left
20:25
cpan-p6 left
20:26
cpan-p6 joined
20:27
ggoebel left
20:35
quipa left,
quipa joined
20:37
molaf left
20:40
cpan-p6 left,
cpan-p6 joined
20:56
cpan-p6 left,
cpan-p6 joined
|
|||
Geth | doc: a948e0648b | cfa++ | doc/Language/modules.pod6 Fix internal modules link (xq++, #perl6) |
21:07 | |
21:12
Ven`````` joined
21:13
zachk joined,
Ven````` left
21:19
|oLa| joined
21:24
abc3354 joined
|
|||
abc3354 | hi ! | 21:24 | |
I have a question | |||
lucs | We've got full of answers. Let's hope they match up! | 21:26 | |
abc3354 | ok ! | 21:27 | |
I was building an exemple | |||
can I eval code here ? | |||
moritz | yes | ||
lucs | m: print 6 * 7 | ||
camelia | 42 | ||
moritz | m: say 'Hi, abc3354' | ||
camelia | Hi, abc3354 | ||
abc3354 | m: sub is-valid ($a, $b) { return True; } my @queue = []; my @curr = [0,0]; my @t; for [0,1],[1,0],[0,-1],[-1,0] { @t = [@curr Z+ @_]; @queue.push($(@t)) if is-valid(|@t); say @queue; } | 21:28 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Strange text after block (missing semicolon or comma?) at <tmp>:1 ------> 3sub is-valid ($a, $b) { return True; }7⏏5 my @queue = []; my @curr = [0,0]; my @ expecting any of: … |
||
abc3354 | how can I eval multiline ? | ||
moritz | abc3354: you need to a semicolon after } if there isn't a newline after it | ||
abc3354 | ok | 21:29 | |
m: sub is-valid ($a, $b) {return True;}; my @queue = []; my @curr = [0,0]; my @t; for [0,1],[1,0],[0,-1],[-1,0] { @t = [@curr Z+ @_]; @queue.push($(@t)) if is-valid(|@t); say @queue; } | |||
camelia | [[0 1]] [[1 0] [1 0]] [[0 -1] [0 -1] [0 -1]] [[-1 0] [-1 0] [-1 0] [-1 0]] |
||
abc3354 | ok | ||
21:29
|oLa| left
|
|||
abc3354 | it is not really readable | 21:29 | |
moritz | we'll manage :-) Just ask your question | 21:30 | |
abc3354 | there is a link to tio.run | ||
tio.run/##PY7BDoIwEETv/Yo5cCixGLh4...zW9JGOb9Bw | |||
21:30
cpan-p6 left
|
|||
abc3354 | so, at the end it says [[-1 0] [-1 0] [-1 0] [-1 0]] | 21:30 | |
21:31
cpan-p6 joined
|
|||
abc3354 | but I want [[0 1] [1 0] [0 -1] [-1 0]] | 21:31 | |
And did not figure out why it returns that | |||
any idea ? | 21:32 | ||
moritz | you are pushing references to the same array onto @queue | 21:35 | |
and then changing the contents of that array | 21:36 | ||
@queue.push([@t]) | |||
creates a new array every time | |||
21:37
|oLa| joined
|
|||
abc3354 | oh thanks @moritz ! | 21:38 | |
moritz | abc3354: my slightly simplified version: tio.run/##K0gtyjH7/z@3UsGhsDS1NNWa...sLWWq7//wE | ||
abc3354 | thank you ! | ||
21:39
domidumont left
|
|||
abc3354 | by the way, the is-valid was part of a bigger project | 21:40 | |
lucs | abc3354: Do you happen to speak French by any chance? | ||
abc3354 | hum | ||
yes | |||
x) | |||
lucs | Hehe! | ||
abc3354 | is my english so bad ? | ||
moritz | abc3354: (re is-valid), thought so | 21:41 | |
lucs | "exemple" and spaces in front of "?" and "!" gave it away :) | ||
Nah, your English is fine. | |||
abc3354 | oh ok | ||
lucs est francophone, n'est-ce pas | 21:42 | ||
moritz francophobe :D | |||
lucs | Hey! >:( | ||
lizmat | .oO( a payphone that only takes francs ) |
21:43 | |
lucs | moritz: I hope you mean the language (francophobe usually refers to people). | ||
lizmat: Never thought of that :) | |||
moritz | lucs: I'm not phobic of either, really. Just my experience as a foreign speaker in France was... less pleasant than in other countries :D | 21:44 | |
lucs | Oh, too bad. Come to Québec, we're really nice here :) | 21:45 | |
lizmat | on parle Français en Québec ? | ||
lizmat ducks | |||
lucs | :) | ||
21:47
leont left,
eliasr left
21:48
theangryepicbana joined
|
|||
abc3354 | hi taeb x) | 21:49 | |
theangryepicbana | does anyone here think that making a Tk lib for Perl 6 is a good idea? | ||
moritz | theangryepicbana: I'm torn between "no, Tk looks horribly old-fashioned" and "it might work for a few years, in contrast to any other GUI toolkit" | 21:50 | |
lucs | theangryepicbana: I recently used the Perl5 version with Inline::Perl5, so I'd say, sure, why not. | ||
theangryepicbana | oh cool | ||
well, I've gotten a thing to work where I use Proc::Async to talk with a Tcl process | |||
and I have gotten it to a point where I can use Tk now | 21:51 | ||
would anyone be interested in seeing it? | |||
dr_df0 | theangryepicbana: sure! go for it | 21:54 | |
21:54
cpan-p6 left
|
|||
theangryepicbana | you may have to press the "fork" button for it to work, but here it is: repl.it/@theangryepicbanana/P6TK | 21:55 | |
21:55
cpan-p6 joined
|
|||
theangryepicbana | (any feedback would be appreciated btw) | 21:56 | |
dr_df0 | theangryepicbana: looks pretty cool! although I've some unhandled exceptions | 21:59 | |
theangryepicbana | thanks | ||
where are the exceptions though? | |||
22:00
MidCheck left
22:01
qwebirc256180 joined,
qwebirc16280 joined
22:02
qwebirc1024151 joined
|
|||
qwebirc1024151 | crap it refreshed | 22:02 | |
how do I log back in (first time using freenode) | 22:03 | ||
dr_df0 | Unhandled exception in code scheduled on thread 8 | ||
qwebirc1024151 | ah | ||
22:03
molaf joined
|
|||
dr_df0 | theangryepicbana: No such method 'ast' for invocant of type 'Any' | 22:04 | |
in method parse at /home/runner/lib/Tcl/OptionParser.pm6 | |||
qwebirc1024151 | ok | ||
22:04
theangryepicbana left
|
|||
qwebirc1024151 | ok now I can log back in, right? | 22:04 | |
ad theangryepicbanana | |||
*as | |||
22:05
theangryepicbana joined
|
|||
theangryepicbana | ok nice | 22:05 | |
22:05
niclo left
|
|||
theangryepicbana | I'll fix the error | 22:05 | |
22:05
qwebirc256180 left
22:06
qwebirc16280 left
22:09
qwebirc1024151 left
22:13
quipa left
22:16
theangryepicbana left
22:18
theangryepicbana joined
|
|||
abc3354 | buy ! | 22:20 | |
bye * | |||
lucs | Salut! | 22:23 | |
22:25
theangryepicbana left,
abc3354 left
22:29
cpan-p6 left
22:30
cpan-p6 joined
22:34
[Sno] joined
22:35
sno left
22:37
leont joined
|
|||
TreyHarris | Some 'is' traits can't be applied to multis (they throw `Cannot invoke object with invocation handler in this context`), but work if applied to the proto (e.g., `is cached`); some can be applied to multis, but are useless and don't work unless they're applied to the proto (`is pure`); some only work on the multis and not the proto but don't complain if applied to the proto (`is export`). Could the compiler | 22:39 | |
deduce which is which and give a more useful error message (or a warning in the latter cases where it's currently silent)? | |||
22:39
profan_ left
22:41
profan joined
22:46
natrys left
22:52
pecastro left
|
|||
tbrowder | .tell uzl fwiw i say "on" website most of the time around techies, "at" mostly around non-techies, and | 22:52 | |
yoleaux | tbrowder: I'll pass your message to uzl. | ||
22:52
molaf left
22:53
cpan-p6 left
22:54
cpan-p6 joined
23:03
netrino joined
23:05
netrino__ left,
patrickb left
23:12
cpan-p6 left
23:15
cpan-p6 joined
23:27
cpan-p6 left
23:28
cpan-p6 joined
23:32
Sgeo joined
23:34
zacts joined,
hphhphhphhphhphh joined
23:35
netrino left
23:42
MidCheck joined,
cpan-p6 left
23:43
cpan-p6 joined
|
|||
lizmat | TreyHarris: an issue with an overview of what goes wrong / expected, would be appreciated | 23:49 | |
23:54
zacts left
23:59
cpan-p6 left
|