»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
00:03
mcmillhj left
|
|||
timotimo | --debug is no problem, it just puts debug symbols in with the binary | 00:04 | |
they shouldn't impact performance | |||
if you don't have --optimize=3, though, that'd make performance a bit weaker | |||
00:04
labster joined
|
|||
MasterDuke | just rebuilt moar, nqp, and rakudo without --debug, no change | 00:05 | |
timotimo | nqp and rakudo don't have --debug | 00:06 | |
MasterDuke | yeah, but i couldn't remember if there were some commits i'd pulled but hadn't built yet | ||
i don't think i've ever seen type_check in a profile before, much less at the top | 00:07 | ||
00:07
perlawhirl joined
|
|||
timotimo | right | 00:08 | |
can you spot it in the call graph? | |||
MasterDuke | i'm using the qt version, let me generate some html | 00:09 | |
Callers: <anon> <unit-outer> <unit> <anon> | 00:11 | ||
timotimo | hm. weird. | 00:12 | |
anyway, i'll be going to bed, i think | |||
00:12
BenGoldberg joined
|
|||
MasterDuke | actually, it seems to be in the postcircumfix:<[ ]> | 00:13 | |
timotimo | weird | 00:14 | |
MasterDuke | both the AT-POS and the ASSIGN-POS | ||
profile is 49% specialized frames, 47% JIT-compiled | 00:16 | ||
00:18
mcmillhj joined
00:23
mcmillhj left
00:24
Unavowed_ left
00:37
Unavowed joined
00:40
mempko left
00:41
adu left
00:45
cyphase left
00:47
pierre_ joined
00:48
nadim_ left
00:49
adu joined
00:50
cyphase joined,
cyphase left
00:52
mcmillhj joined
00:56
mcmillhj left
01:04
cyphase joined,
mcmillhj joined
01:06
canopus left
01:08
mcmillhj left
01:14
canopus joined,
mcmillhj joined
01:17
zakharyas joined
01:19
mcmillhj left
01:21
tushar left
01:26
Sqirrel left
01:31
itaipu joined
01:33
adu left
01:34
itaipu left,
mcmillhj joined
01:36
itaipu joined
01:37
adu joined
01:39
mcmillhj left
01:42
itaipu left
01:43
itaipu joined
01:53
mcmillhj joined
01:58
mcmillhj left
01:59
petercommand joined
02:05
mcmillhj joined
|
|||
seatek | So, with panda-installed modules being named with crazy UUID-looking filenames... if I manage to find one, and fix a problem in someone's module.... how do get that module to update or recompile, or whatever needs to happen? | 02:08 | |
I've got to add a column data type to the DBDish Pg thang | 02:09 | ||
otherwise it's nagging all the time about having no type map for a column | 02:10 | ||
02:10
mcmillhj left
|
|||
seatek | this is a very, weirdly different feeling | 02:11 | |
02:11
itaipu left
02:24
Sqirrel joined
02:25
mcmillhj joined
|
|||
seatek | i looks like some kind of "precompiling" stuff goes on in the modules? So if you change the module source, I assume you have to kick off that precompiling again, whatever that is | 02:26 | |
02:29
mcmillhj left
|
|||
llfourn | seatek: that's correct | 02:29 | |
if you wanan fix a problem with the module you should clone it from github and perl6 -Ipath/to/lib | 02:30 | ||
seatek | is there a quick and dirty way to take a UIID-like source file you edited, and get it to "precompile", so that it will be used henceforth? | ||
llfourn | maybe but it's such a bad idea I wouldn't tell you if I knew :P | 02:31 | |
seatek | lots of trouble with a biggie like DBIish | ||
llfourn | why? | ||
02:31
pierre_ left
|
|||
llfourn | (I've honestly never used it) | 02:32 | |
in any case you should just be able to -I its lib and it will use it instead of the panda installed one | 02:33 | ||
it will still use the panda installed depends etc | |||
02:41
pierre_ joined
02:45
grondilu left,
adu left,
pierre_ left
02:47
pierre_ joined
|
|||
seatek | good lord that was a pain. I understand the precompiling now. That was incredibly, incredibly slow to run after using the non-precompiled. | 02:48 | |
llfourn: thanks for goading me into doing what I didn't want to HAVE to do. ;) | |||
llfourn | seatek: anytime :P | ||
seatek | llfourn++ | ||
llfourn | I hope you can fix the bug :) | ||
seatek | already done | 02:49 | |
it's just a column type that was generating a warning all the time because oid wasn't known | |||
llfourn | seatek++ # I'm sure they'd love a PR if you haven't already | ||
seatek | i'm still irritated i couldn't edit source locally. if i get over it, I will. ;) | 02:50 | |
this makes it easier having the git stuff here though already | 02:51 | ||
so really the pain is good | |||
llfourn | yes. You'll need to fork DBIish on github to make the PR :) | 02:53 | |
02:54
khw left,
mcmillhj joined
|
|||
seatek | forget it then ;) | 02:54 | |
llfourn goads seatek some more | |||
seatek | i don't think anbody but me ever uses the "money" type column in postgres anyway | 02:56 | |
and maybe i should stop since Perl6 is supposedly immune to rounding errors now | |||
I don't know what to believe any more. ;) | 02:57 | ||
02:57
noganex_ joined
02:58
mcmillhj left
02:59
skids left
03:00
noganex left
|
|||
BenGoldberg | seatek, Perl6 isn't immune to rounding errors in Num, as that uses the underlying C 'double' type. However, decimal literals such as 123.45 are not turned into Nums, they're turned into Rats (rationals), and don't get rounded. | 03:03 | |
03:05
mcmillhj joined
|
|||
seatek | BenGoldberg, that sounds like what I should be using | 03:05 | |
Ugh. I don't even have a GitHub account. I've managed to avoid it for years. | 03:06 | ||
Making one now just to create a ticket with this silly little diff instead of forking the whole thing | |||
03:10
mcmillhj left
03:11
Xliff joined
|
|||
Xliff | \o #perl6 | 03:11 | |
I've written a STORE method for CArray, but it doesn't seem to be getting called, rather I am getting a type mismatch error. What else do I need to do to get my code to run? | 03:12 | ||
03:14
eliasr left
03:15
pierre_ left
03:16
pierre_ joined,
mcmillhj joined
03:21
mcmillhj left
03:24
Actualeyes left
03:29
mcmillhj joined
03:33
mcmillhj left
03:35
cxreg2 is now known as cxreg
03:42
pdcawley left
|
|||
dalek | Iish: 0ce19e2 | (Salvador Ortiz)++ | lib/DBDish/Pg/Native.pm6: Pg: Add simple Str support for PG type 790 (money) adaptiveoptics++ for the patch Closes #71 |
03:42 | |
03:45
cognominal joined
03:46
Lucas_One joined,
cog_ left
03:48
pdcawley joined,
Actualeyes joined
03:49
BenGoldberg left
04:00
pierre_ left
04:02
mcmillhj joined
04:05
pierre_ joined
|
|||
seatek | Oh wow that DBIish patch went in quick. Salvador is speedy! | 04:06 | |
04:07
mcmillhj left
04:13
pierre_ left
04:20
pierre_ joined
04:24
pierre_ left
04:27
bioduds left
04:33
mcmillhj joined
04:38
mcmillhj left
04:44
pierre_ joined,
pierre_ left
04:53
pierre_ joined
04:55
Cabanossi left,
ponpon left
04:57
pierre_ left,
Cabanossi joined
05:00
AlexDaniel left
05:10
wamba joined
05:14
ponpon joined,
ponpon is now known as Guest53048
05:21
_slade_ left
05:22
_slade_ joined
05:25
Guest53048 is now known as ponbiki
05:28
mcmillhj joined
05:30
ufobat joined
05:32
mcmillhj left
05:38
sftp left
05:40
cibs left
05:42
cibs joined,
domidumont joined
05:45
sftp joined,
domidumont1 joined
05:47
domidumont1 left,
domidumont1 joined
05:48
wamba left,
domidumont left,
mcmillhj joined
05:53
mcmillhj left
05:54
pierre_ joined
05:59
pierre_ left
06:01
pierre_ joined
06:02
rgrinberg left
|
|||
ufobat | morning :) | 06:06 | |
[ptc] | o/ | 06:09 | |
06:18
mempko joined
06:20
sortiz joined
|
|||
sortiz | \o #perl6 | 06:20 | |
06:23
mcmillhj joined
06:29
mcmillhj left
06:37
seatek left,
Zero_Dogg left,
Zero_Dogg joined,
Zero_Dogg left,
Zero_Dogg joined
06:40
mcmillhj joined
06:42
Dunearhp left
06:43
Dunearhp joined,
Actualeyes left
06:44
Lucas_One left,
bjz joined,
mcmillhj left
07:01
bjz left
07:03
domidumont1 left
07:05
perlawhirl left
07:10
zacts left
07:13
Actualeyes joined,
mcmillhj joined
07:15
bjz joined
07:16
domidumont joined
|
|||
lizmat clickbaits p6weekly.wordpress.com/2016/10/03/...toberfest/ | 07:16 | ||
07:17
mcmillhj left
07:21
RabidGravy joined
07:25
mcmillhj joined
07:28
nadim_ joined
07:30
mcmillhj left
07:44
mcmillhj joined
07:45
dakkar joined
07:49
mcmillhj left
|
|||
[ptc] | lizmat++ | 07:49 | |
07:50
g4 joined,
g4 left,
g4 joined
07:55
rindolf joined
08:01
imcsk8 left,
user9 joined,
imcsk8 joined
08:04
ocbtec joined
08:07
_slade_ left
08:17
eliasr joined
08:21
jnx joined
|
|||
jnx | Hello everyone! | 08:21 | |
I'd like to ask if there's a good beginners book for Perl 6 | 08:22 | ||
or if it's better to start with a beginners Perl 5 book | 08:23 | ||
If anyone could help | |||
thanks a lot | |||
08:27
wamba joined
|
|||
[ptc] | jnx: I don't think there are any books as yet. There's one in the works (www.reddit.com/r/perl/comments/557...6_books/), but it's not published yet | 08:28 | |
jnx: the docs page (docs.perl6.org/) has a tutorial section; there's also perl6intro.com/ which might be helpful | 08:29 | ||
jnx | I've heard abour Perl 6 Now, Perl 6 Essentials... but they seem dated | ||
maybe I'm worng | |||
[ptc] | jnx: word has it that "Perl 6 Programming" is also in the works, but I don't know how far along that is | 08:30 | |
Perl 6 Essentials is very out of date | |||
there's also learnxinyminutes.com/docs/perl6/, which can get you up and going quickly | |||
08:31
user9 left
|
|||
lizmat | jnx: please note that perl6intro.com comes in many languages | 08:33 | |
08:34
wamba left
|
|||
lizmat | alas, no chinese (yet) | 08:34 | |
jnx | Thanks ptc, lizmat | 08:35 | |
Maybe it's too soon and the language it's evolving | 08:36 | ||
so it has to be complicated | 08:37 | ||
08:37
user9 joined
|
|||
lizmat | jnx: the stuff that the introduction is covering, is not evolving anymore | 08:37 | |
afk& | 08:39 | ||
jnx | ok | 08:45 | |
08:48
mcmillhj joined
08:52
mcmillhj left
09:05
bjz left
09:06
bjz joined
09:09
bjz left,
bjz joined
09:10
wamba joined
09:11
cyphase left
09:16
cyphase joined
09:22
mcmillhj joined
09:26
brrt joined
09:27
sortiz left,
mcmillhj left
09:30
bjz left,
bjz joined,
bjz left
09:31
bjz joined
09:33
mcmillhj joined
09:38
mcmillhj left
09:39
user9 left
09:41
user9 joined
09:44
gregf_ left
09:51
labster left
09:53
mcmillhj joined
09:54
gregf_ joined
09:55
mniip left
09:57
b2gills left
09:58
mcmillhj left
10:02
zakharyas left,
zakharyas joined
10:04
fudje joined
10:06
bjz left
10:07
bjz_ joined,
zakharyas left
10:08
TEttinger left
|
|||
fudje | Hihi. Anyone still awake? | 10:13 | |
awake yet? | |||
gfldex | shhh, we are thinking | 10:14 | |
fudje | So I've been trying to work out if it's possible to create a multi routine in a namespace, that can have candidates added from outside the class/role/module/package etc. | 10:15 | |
so far the answer seems to be no. | |||
Can anyone correct me on that? | |||
gfldex | m: use MONKEY-TYPING; package P { class C {} }; augment class P::C { method m { 'oi‽' } }; say P::C.new.m | 10:17 | |
camelia | rakudo-moar 01321c: OUTPUT«oi‽» | ||
gfldex | please note that this will kill precomp | ||
fudje | Essentially I thought it'd be cool to be able to do like module MyMod { proto decode(Str $mime, Blob $data) { * } } #`(some other file with speculative pseudocode :) multi MyMod::decode('application/json', Blob $data) { ... } | 10:18 | |
gfldex | m: use MONKEY-TYPING; package P { class C { multi m(Str){ 'Str' } } }; augment class P::C { multi method m(Int) { 'oi‽' } }; say P::C.new.m('foo') | 10:19 | |
camelia | rakudo-moar 01321c: OUTPUT«Cannot resolve caller m(P::C: Str); none of these signatures match: (P::C $: Int, *%_) in block <unit> at <tmp> line 1» | ||
gfldex | bug | ||
m: use MONKEY-TYPING; class C { multi m(Str){ 'Str' } }; augment class C { multi method m(Int) { 'oi‽' } }; say C.new.m('foo') | 10:20 | ||
camelia | rakudo-moar 01321c: OUTPUT«Cannot resolve caller m(C: Str); none of these signatures match: (C $: Int, *%_) in block <unit> at <tmp> line 1» | ||
jkramer | When using a module with 'use-ok' in a test, it seems that subs are not exported into the tests scope. Am I doing something wrong or is this correct? | ||
gfldex | m: use MONKEY-TYPING; class C { multi method m(Str){ 'Str' } }; augment class C { multi method m(Int) { 'oi‽' } }; say C.new.m('foo') | ||
camelia | rakudo-moar 01321c: OUTPUT«Str» | ||
gfldex | nobug :) | ||
RabidGravy | Hmm, you can do it with a role IIRC | ||
gfldex | m: use MONKEY-TYPING; package P { class C { multi method m(Str){ 'Str' } } }; augment class P::C { multi method m(Int) { 'oi‽' } }; say C.new.m('foo') | 10:21 | |
camelia | rakudo-moar 01321c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: C used at line 1» | ||
gfldex | m: use MONKEY-TYPING; package P { class C { multi method m(Str){ 'Str' } } }; augment class P::C { multi method m(Int) { 'oi‽' } }; say P::C.new.m('foo') | ||
camelia | rakudo-moar 01321c: OUTPUT«Str» | ||
gfldex | fudje: if you want to subclass, why not subclass? | 10:22 | |
fudje | gfldex: because I *want* to abuse multidispatch in my nefarious plot ;) | 10:23 | |
gfldex | you can but you wont have precomp and that hurts a lot | ||
10:25
perlawhirl joined
10:29
gregf_ left
10:34
ccakes joined
|
|||
fudje | jkramer: don't think use-ok will install symbols into the calling scope - if that's what you're trying to do? | 10:35 | |
timotimo | fudje: you do know you don't have to monkey-type to abuse multi-dispatch? | 10:36 | |
10:36
ccakes left
|
|||
fudje | timotimo ??? | 10:37 | |
10:38
abraxxa joined
|
|||
timotimo | when you subclass or mixin roles, candidates get thrown together into the same pot | 10:39 | |
10:40
ccakes joined
10:42
wamba left
10:44
itaipu joined
10:45
ccakes left
|
|||
fudje | Hmm, I see.... | 10:47 | |
10:48
pierre_ left
10:51
dayangkun joined
10:52
aries_liuxueyang left
10:53
aries_liuxueyang joined
10:57
gregf_ joined
|
|||
jkramer | fudje: Yeah, that's what I want. I mean I want to test if it can be used and then of course I want to test the exported subs as well | 10:57 | |
Should I put a normal use after it? | |||
fudje | jkramer: That's what's done in github.com/perl6/perl6-examples/bl...-example.t | 10:58 | |
11:00
matthewsellers joined
|
|||
jkramer | fudje: Ok, thanks | 11:00 | |
11:00
Dunearhp left,
dayangkun left
11:01
mcmillhj joined
|
|||
jkramer | Seems a bit pointless to me though. The normal use is done at compile-time, right? So it'll crash before the use-ok will be executed | 11:02 | |
gfldex | EVAL <-- trick | ||
11:03
bjz_ left,
bjz joined
11:04
dayangkun joined
11:05
matthewsellers left
|
|||
fudje | m: class Foo { our &Bar = (Callable but { proto method CALL-ME(Str) { * } }).new }; &Foo::Bar does role { multi method CALL-ME('bar') { 'baz' } }; Foo::Bar('bar') | 11:05 | |
camelia | ( no output ) | ||
fudje | m: class Foo { our &Bar = (Callable but { proto method CALL-ME(Str) { * } }).new }; &Foo::Bar does role { multi method CALL-ME('bar') { 'baz' } }; Foo::Bar('bar').say | ||
camelia | rakudo-moar 01321c: OUTPUT«baz» | ||
fudje | :D | ||
11:06
mempko left,
mcmillhj left
11:08
Sqirrel left
|
|||
fudje | hmm the proto becomes useless in that case though. | 11:09 | |
11:11
ribasushi left,
dayangkun left
11:12
bjz left,
bjz joined
11:13
bjz left,
bjz joined
11:15
neuraload joined,
mcmillhj joined
11:19
mcmillhj left
11:24
woolfy left,
woolfy joined,
bjz left
11:26
bjz joined
11:27
wamba joined
11:30
rudolfochrist joined
11:34
Actualeyes left
|
|||
dalek | c: 77acc0f | gfldex++ | / (2 files): allow insertion of default exception handler for example execution tests |
11:34 | |
c: d11caf6 | gfldex++ | doc/Language/functions.pod6: make examples compile |
|||
11:36
brrt left
11:37
brrt joined
11:46
mcmillhj joined
11:48
pierre_ joined
11:49
itaipu left
11:51
mcmillhj left,
rudolfochrist left
11:54
Actualeyes joined
|
|||
moritz | re perl6-users thread about a doc bug, I've sent the OP a commit bit :-) | 11:59 | |
11:59
ribasushi joined
|
|||
gfldex | moritz: can you provide a link to that thread please? | 12:00 | |
moritz | gfldex: I can't, www.nntp.perl.org/group/perl.perl6.users/ isn't up-to-date enough, it seems | 12:01 | |
12:02
itaipu joined
12:09
grondilu joined
12:14
llfourn left
12:15
aries_liuxueyang left
12:16
fudje left,
aries_liuxueyang joined
12:17
fudje joined
12:18
cpage__ joined
12:21
llfourn joined
12:37
zacts joined
|
|||
dalek | c: 74dbf1c | gfldex++ | doc/Type/ (2 files): link to subscripts |
12:39 | |
12:44
eliasr left
12:49
jnx left
|
|||
dalek | c: c2ecacb | gfldex++ | doc/Language/subscripts.pod6: show * in multidim subscripts |
12:57 | |
13:01
mcmillhj joined
13:03
zakharyas joined
13:04
fudje left
13:06
rgrinberg joined
13:09
rgrinberg left
13:10
rgrinberg joined
13:11
canopus left
|
|||
gfldex | where does projects.json reside? | 13:13 | |
13:16
perlawhirl left
13:17
canopus joined,
itaipu left
13:21
movl left
13:26
lucasb_ joined
|
|||
gfldex | found it | 13:31 | |
13:33
ptolemarch joined,
sufrostico joined
13:42
skids joined
13:49
seatek joined
14:00
shlomif joined
14:02
woolfy left
14:05
shlomif left
14:06
lizmat left,
cdg joined,
cdg left
14:07
cdg joined
14:08
zakharyas left
14:14
gregf_ left
14:23
Khisanth left
14:24
tatata joined
|
|||
tatata | Hello all, is there an object like Channel that may fail on send, what I mean: is there an object like Channel where send is a Promise? A bit like Socket::Async but without the Socket implemented | 14:25 | |
14:26
pierre_ left
14:27
wamba left
|
|||
hackedNODE | Nope. | 14:28 | |
moritz | tatata: I think Channel can fail on send, when it's closed | ||
hackedNODE | You could setup two channels, and use the second one to signal to the first that the reception failed. | ||
tatata | moritz : I see it raises an exception | ||
hackedNODE | tatata: what do you need this for? | 14:29 | |
tatata | wouldn't a Dumbo::Async class be very usefull? | ||
moritz | tatata: or you can create a Promise yourself, and put that into a Channel | ||
hackedNODE | That name is awful :) | ||
tatata | I'm trying to understand the logic behind the async and the reactive api | 14:30 | |
(without finding one) | |||
but prob I'm just illiterate | |||
hackedNODE | mmkay | ||
moritz | tatata: have you read docs.perl6.org/language/concurrency.html | ||
14:31
Dunearhp joined
|
|||
moritz | tatata: also design.perl6.org/S17.html might be of interested | 14:31 | |
tatata | moritz yep it seems all very high level, to the point of being a nightmare | ||
why for instance Proc::Async is there? | 14:32 | ||
moritz | tatata: well, we have API docs for the individual classes too | ||
that's a high-level question. Didn't you just complain that the docs were too high-level? :-) | |||
tatata | I wouldn't like to complain | 14:33 | |
14:36
Khisanth joined
14:38
lizmat joined
|
|||
tony-o | m: (65000 / 12) * .6 | 14:43 | |
camelia | rakudo-moar b12297: OUTPUT«WARNINGS for <tmp>:Useless use of "*" in expression "(65000 / 12) * .6" in sink context (line 1)» | ||
tony-o | m: say (65000 / 12) * .6 | ||
camelia | rakudo-moar b12297: OUTPUT«3250» | ||
tony-o | m: say (185000 / 12) * .6 | 14:44 | |
camelia | rakudo-moar b12297: OUTPUT«9250» | ||
14:44
mcmillhj left
14:50
dayangkun joined
14:51
wamba joined,
cdg left
14:53
mcmillhj joined
14:54
gregf_ joined,
neuraload left
14:55
neuraload joined
14:57
acrussell joined,
rudolfochrist joined
15:00
dayangkun left
15:05
dayangkun joined
15:06
telex left,
rudolfochrist left,
b2gills joined,
khw joined
15:07
neuraload left,
domidumont left
15:08
telex joined
15:09
wamba left
15:12
g4 left
15:27
sftp left
|
|||
Xliff | \o #perl6 | 15:27 | |
I've written a STORE method for CArray, but it doesn't seem to be getting called, rather I am getting a type mismatch error. What else do I need to do to get my code to run? | |||
15:27
sftp joined
|
|||
timotimo | you can write a tiny piece of code and --target=ast to see how exactly it's getting invoked | 15:30 | |
other than that, have you tried giving us your code? even golfed if you like | |||
15:31
rudolfochrist joined
15:33
brrt left
15:35
dayangkun left
|
|||
hackedNODE | seatek: why is it a wrong message? rt.perl.org/Ticket/Display.html?id...et-history | 15:42 | |
seatek: you never fixed the first error it complained about, so it's still complaining about it. | 15:43 | ||
15:45
FROGGS joined
|
|||
hackedNODE | m: sub MAIN (:$x, @foo) {} | 15:46 | |
camelia | rakudo-moar 2a2f26: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Cannot put required parameter @foo after variadic parametersat <tmp>:1------> 3sub MAIN (:$x, @foo7⏏5) {} expecting any of: constraint» | ||
hackedNODE | .oO( what the fuck is a variadic parameter... ) |
||
m: sub foo (:$x, *@foo) { dd [$x, @foo] } foo :x, ^10 | 15:47 | ||
camelia | rakudo-moar 2a2f26: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Strange text after block (missing semicolon or comma?)at <tmp>:1------> 3sub foo (:$x, *@foo) { dd [$x, @foo] }7⏏5 foo :x, ^10 expecting any of: infix infix stopper …» | ||
hackedNODE | m: sub foo (:$x, *@foo) { dd [$x, @foo] }; foo :x, ^10 | ||
camelia | rakudo-moar 2a2f26: OUTPUT«[Bool::True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]» | ||
hackedNODE | seatek: never mind. I see it now | ||
FROGGS | o/ | 15:48 | |
[Coke] | hackedNODE: I'm guessing CS-pretentious way of saying optional? | 15:49 | |
hackedNODE | Well, the docs say variadic params are slurpies: docs.perl6.org/type/Signature#Slur...Parameters | 15:50 | |
Which makes even less sense, since I wouldn't call :$x slurpy | |||
And `variadic` isn't even in the dictionary. Kinda LTA if you ask me. | |||
[Coke] | en.wikipedia.org/wiki/Variadic | ||
hackedNODE | I see | 15:51 | |
15:52
rudolfochrist left
|
|||
TimToady | basically, you should be able to find the positions of the positional parameters easily, and it's not easy if you have any optional parameters before the positional ones | 15:52 | |
RabidGravy | It's in my dictionary :) | 15:53 | |
grep -i variadic /usr/share/dict/words | |||
variadic | |||
hackedNODE | RabidGravy: and what's the definition? :) | ||
grondilu | hello #perl6 | 15:54 | |
15:54
lostinfog joined
|
|||
grondilu | m: (sub f($) {})(f($)) | 15:54 | |
camelia | ( no output ) | ||
15:54
acrussell left
|
|||
grondilu | ^I'm slightly surprised this is ok | 15:54 | |
hackedNODE | grondilu: why? A sub can call itself without issues | 15:55 | |
TimToady | it should probably read: Cannot put positional parameter @foo after optional or slurpy parameters | ||
grondilu | yeah but I thought it was out of scope | ||
awwaiid | I don't think parens make a scope | ||
TimToady | two different $ there | ||
awwaiid | only curleys | ||
grondilu | awwaiid: true | ||
[Coke] | grondilu: no different scope wise than : sub f($) {} ; f($) | 15:56 | |
TimToady | those are not the same $ | ||
dalek | c: 758b7ac | (Zoffix Znet)++ | doc/Type/Signature.pod6: Add note on what "variadic" is and pop into index |
||
hackedNODE | By default subs are our scoped | 15:57 | |
TimToady | or yeah, parens don't make a scope, if that's the issue | ||
hackedNODE: no, they are my scoped | |||
hackedNODE | huh | ||
Oh, I'm confused with classes | |||
awwaiid | yeah, I ran into that when trying to call a package's sub from outside. Gotta 'our' it | 15:58 | |
TimToady | yes, that requires 'our', or an export from a module | ||
or some other kind of alias to the outer scope | |||
hackedNODE | TimToady: oh, I left you a bot message in #perl6-dev :) | ||
awwaiid | ya | 15:59 | |
16:00
grondilu left
16:01
abraxxa left,
grondilu joined,
acrussell joined
16:06
cdg joined
16:13
lizmat left
16:18
wamba joined
16:19
rgrinberg left
|
|||
seatek | hackedNODE, sorry was away - yeah, it was just a definition for a variable type associated with a Pg column data type that needed to be added to make the warnings disappear | 16:19 | |
16:20
brrt joined
16:23
wamba left
16:26
lizmat joined
16:33
_slade_ joined
|
|||
hackedNODE | yeah, I'll try to fix that some time by Tuesday | 16:33 | |
16:38
rgrinberg joined
16:39
dakkar left,
wamba joined
16:40
cdg left,
cdg joined
|
|||
seatek | hackedNODE, oh I thought you were talking about the patch I sent for DBIish - but you were talking about the error message vagueness with the variadoc parameters. Yeah, that came about when I was silli-ly trying to associate a default value list, with the slurpy list part. Which would be handy, but I imagine might be weird to actually cope with (and is better handled in the method itself). I mean, you could | 16:44 | |
16:44
brrt left
|
|||
seatek | put everything and the kitchen sink into the parameter stuff, but it's good it gets cut off somewhere. | 16:44 | |
16:44
wamba left,
brrt joined
16:45
brrt left
|
|||
hackedNODE | I actually think defaults on slurpies would be handy. And I'm yet to get any answer for why they're not supported :) | 16:45 | |
sub foo (*@files = 'default-file') {...} | 16:46 | ||
seatek | yeah that's what i natually felt it could do | ||
but it couldn't | |||
hackedNODE | I guess I can see why: you can't not-specify a slurpy, so it doesn't know when to give it a default. It's just my thinking was to apply the default if the slurpy ends up empty. | 16:48 | |
dalek | c: a8e3008 | (Garrett Goebel)++ | doc/Type/List.pod6: #926 produce method is not documented |
16:50 | |
c: bf0331b | (Garrett Goebel)++ | doc/Type/List.pod6: found and fixed typo |
|||
c: e730384 | RabidGravy++ | doc/Type/List.pod6: Merge pull request #936 from ggoebel/master Issue #926 produce method is not documented |
|||
seatek | that's what i though -- that it must not instantiate the list unless there is something there... but you always have to check if something is there.... so why not check if there is some default.... ? :) | ||
hackedNODE | m: sub foo (@files = 'default-file') { dd @files }([]) | 16:51 | |
camelia | rakudo-moar 392d21: OUTPUT«[]» | ||
seatek | hmm | 16:53 | |
:) | |||
hackedNODE | Yeah. It's only when the param is missing entirely that the default would kick in | ||
Actually, there's a way to workaround it | 16:54 | ||
m: sub foo (*@files where { $^v.push: "default-value" unless $^v; True } ) { dd @files }() | |||
camelia | rakudo-moar 392d21: OUTPUT«["default-value"]» | ||
hackedNODE | m: sub foo (*@files where { $^v.push: "default-value" unless $^v; True } ) { dd @files }(1, 2, 3) | ||
camelia | rakudo-moar 392d21: OUTPUT«[1, 2, 3]» | ||
seatek | i refuse. i'll just do it in the method ;) | 16:56 | |
hackedNODE | m: sub foo (*@files where $_ || .push: "default-value" ) { dd @files }() | ||
camelia | rakudo-moar 392d21: OUTPUT«["default-value"]» | ||
hackedNODE | Well, you can also do this: | 16:57 | |
m: subset Default where $_ || .push: "default value"; sub foo (Default *@files) { dd @files }() | |||
camelia | rakudo-moar 392d21: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Slurpy positional parameters with type constraints are not supportedat <tmp>:1------> 3default value"; sub foo (Default *@files7⏏5) { dd @files }() expecting any of: constraint» | ||
hackedNODE | oh... :) | ||
seatek | all these crazy new syntaxes... i found myself yesterday doing this: for @row -> ($var1, $var2, $var3) {} instead of just doing the easy ($var1, $var2, $var3) = @rows like we've always done. | ||
i think i have a sprained brain | 16:58 | ||
hackedNODE | m: sub infix:<¯\_(ツ)_/¯> { @_.join }; say "What " ¯\_(ツ)_/¯ "crazy new syntaxes?" | 16:59 | |
camelia | rakudo-moar 392d21: OUTPUT«What crazy new syntaxes?» | ||
17:00
eliasr joined
|
|||
hackedNODE | m: sub 𝕹𝖊𝖛𝖊𝖗-𝖍𝖊𝖆𝖗𝖉-𝖔𝖋-𝖙𝖍𝖊𝖒 { &?BLOCK.name.say }() | 17:01 | |
camelia | rakudo-moar 392d21: OUTPUT«𝕹𝖊𝖛𝖊𝖗-𝖍𝖊𝖆𝖗𝖉-𝖔𝖋-𝖙𝖍𝖊𝖒» | ||
gfldex | m: my @row = 1; my ($a, $b, $c) = @row; dd $a, $b, $c; for @row -> $a, $b, $c {}; | 17:02 | |
camelia | rakudo-moar 392d21: OUTPUT«Int $a = 1Any $b = AnyAny $c = AnyToo few positionals passed; expected 3 arguments but got 1 in block <unit> at <tmp> line 1» | ||
gfldex | seatek: not the same thing ^^^ | ||
17:02
domidumont joined,
hankache joined
|
|||
hankache | good evening #perl6 | 17:03 | |
hackedNODE | m: -> $tod { "good $tod!".say }(<evening morning afternoon>.all) | ||
camelia | rakudo-moar 392d21: OUTPUT«good all("evening", "morning", "afternoon")!» | ||
hackedNODE | bah | 17:04 | |
blocks don't thread? | |||
m: sub ($tod) { "good $tod!".say }(<evening morning afternoon>.all) | |||
camelia | rakudo-moar 392d21: OUTPUT«good evening!good morning!good afternoon!» | ||
hankache | :) | ||
hackedNODE | m: -> Any $tod { "good $tod!".say }(<evening morning afternoon>.all) | 17:05 | |
camelia | rakudo-moar 392d21: OUTPUT«good evening!good morning!good afternoon!» | ||
hackedNODE | \o/ | ||
seatek | m: my @row = 1, 2, 3; my ($a, $b, $c) = @row ; say "$a $b $c"; | ||
camelia | rakudo-moar 392d21: OUTPUT«1 2 3» | ||
seatek | m: my @row = 1, 2, 3; for @row -> $a, $b, $c {} ; say "$a $b $c"; | ||
camelia | rakudo-moar 392d21: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$a' is not declaredat <tmp>:1------> 3 2, 3; for @row -> $a, $b, $c {} ; say "7⏏5$a $b $c";» | ||
hackedNODE | seatek: the block of the for loop does arity and type checks for you, while () doesn't | 17:06 | |
seatek | hackedNODE, yeah - i didn't need any checking... it was just that the old and traditional way that I've used a million times had fallen out of my head somehow ;) | 17:07 | |
I've been spending so much time play on this I've gone loopy | 17:08 | ||
17:10
vike joined
|
|||
[Coke] | "old traditional" == perl 5? | 17:12 | |
17:12
cdg left
|
|||
seatek | yeah, well, in at least that 6 is new to me and 5 isn't | 17:13 | |
17:13
gregf_ left
17:14
cdg joined
|
|||
seatek | I just have to learn new bad habits in Perl 6 | 17:15 | |
17:18
TEttinger joined
|
|||
psch | i think that's part of the users mission currently, to figure out bad habits | 17:19 | |
as in, we don't really have lots of Best Practices yet | |||
although maybe that's started and i've been burying myself too deep in the compiler :) | 17:20 | ||
seatek | I do find it interesting. Like today I was wondering, should I do @row[0] or @row.head | 17:21 | |
my guess is [0] would be much faster | |||
hackedNODE | Well, they do different things, so you'd do the one that gives you the right thing :) | ||
m: my @a = ^10; dd @a.head; dd @a[0] | 17:22 | ||
camelia | rakudo-moar 392d21: OUTPUT«Int @a = 0Int @a = 0» | ||
hackedNODE | bah | ||
m: my @a = ^10; dd @a.head | |||
camelia | rakudo-moar 392d21: OUTPUT«Int @a = 0» | ||
hackedNODE | That gives me (0,).Seq on 2016.08.1-143-gc9b18c6 | ||
RabidGravy | itym .first | 17:23 | |
but they are almost identical in speed | |||
seatek | oh so it's not returning the values but a list | ||
RabidGravy | [jonathan@cannibal ~]$ time perl6 -e 'my @a = <a b c>; say @a[0]' | ||
a | |||
real0m0.449s | |||
user0m0.377s | |||
sys0m0.071s | |||
[jonathan@cannibal ~]$ time perl6 -e 'my @a = <a b c>; say @a.first' | |||
a | |||
real0m0.446s | |||
user0m0.379s | |||
sys0m0.065s | |||
hackedNODE | CCCombo breaker! | ||
perlpilot | m: my @a = 5..10; dd @a.head; dd @a[0]; dd @a.first; # hmm | 17:24 | |
camelia | rakudo-moar 392d21: OUTPUT«Int @a = 5Int @a = 55» | ||
hackedNODE | seatek: they're supposed to, but I suspect recent changes broke something | ||
And our bisect bots are ded :( | |||
m: my @a = ^10; dd @a.head: 5 | |||
camelia | rakudo-moar 392d21: OUTPUT«(0, 1, 2, 3, 4).Seq» | ||
hackedNODE | m: my @a = ^10; dd @a.head: 2 | ||
camelia | rakudo-moar 392d21: OUTPUT«(0, 1).Seq» | ||
hackedNODE | m: my @a = ^10; dd @a.head: 1 | ||
camelia | rakudo-moar 392d21: OUTPUT«(0,).Seq» | ||
hackedNODE | m: my @a = ^10; dd @a.head | ||
camelia | rakudo-moar 392d21: OUTPUT«Int @a = 0» | ||
hackedNODE | Interesting | ||
m: [], 'head', \() | 17:25 | ||
camelia | rakudo-moar 392d21: OUTPUT«WARNINGS for <tmp>:Useless use of constant string "head" in sink context (lines 1, 1)» | ||
hackedNODE | s: [], 'head', \() | ||
SourceBaby | hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/c6c0...s.pm#L1886 | ||
hackedNODE | Ah, OK. It was made that way on purpose. | ||
seatek: I guess in this case, it's TMTOWTDI. I don't think there's any noticable speed difference | 17:26 | ||
s: &postcircumfix:<[ ]>, \([], 0) | 17:27 | ||
SourceBaby | hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/c6c0...ce.pm#L122 | ||
psch | m: ^5 .head(0..$_).sum.say for ^5 # great way to write '[\+] ^5' innit | ||
camelia | rakudo-moar 392d21: OUTPUT«013610» | ||
hackedNODE | s: [], 'AT-POS', \(0) | 17:28 | |
SourceBaby | hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/c6c0...ay.pm#L558 | ||
seatek | it's weird that @a.first can be as fast as @a[0] -- especially when you can use smartmatch in first | ||
psch | seatek: well, MMD | ||
hackedNODE | seatek: @a[0] is just a sub call that calls a method (the above two links from SourceBaby are the source) | 17:29 | |
psch | m: [Any, 1, 2].first.say | ||
camelia | rakudo-moar 392d21: OUTPUT«(Any)» | ||
seatek | everything's an object -- so intuitive notions of what might be more optimal aren't necessarily right | ||
perlpilot | seatek: the smartmatching first is a different code path because of multi dispatch | 17:30 | |
hackedNODE | seatek: Also, not everything is yet optimal :) | ||
perlpilot | seatek: so, it's not weird at all | ||
seatek | got it ;) | ||
psch | m: say Array.can('first')[0].candidates>>.signature | ||
camelia | rakudo-moar 392d21: OUTPUT«(($: :$end, *%_) ($: Bool:D $t, *%_) ($: Regex:D $test, :$end, *%a) ($: Callable:D $test, :$end, *%a is copy) ($: Mu $test, :$end, *%a))» | ||
psch | (there is only one 'first' in Array.^mro fwiw :P ) | 17:31 | |
seatek: so yeah, we know from the (lack of) arguments whether we call to smartmatch or not | |||
s/call/have/ | 17:32 | ||
perlpilot++ # said the same thing too | |||
17:33
wamba joined
|
|||
hackedNODE | m: ^1e300 .sum.say # another great MMD example :) | 17:34 | |
camelia | rakudo-moar c6c0e6: OUTPUT«5000000000000000525047602552044216270793933093550278169323451328159195055357092294442768790241055629545023145306903910785744345070153185134439050762136888750179425419080412754071315685751771726394745487267097512353836816964499664042956479406857844701441222…» | ||
perlpilot | btw, I just rand 10_000_000 calls to @a.head, @a.first and @a[0] (because, why not?) and it seems that first took 49s, head 47s, and @a[0] 21s So ... if you're really into micro optimization and need the first item of an array, use the normal indexing method :-) | ||
El_Che | lizmat: on what rekudo version did you add the json error output? Talking upstream about the vim syntax support for perl 6 (to integrate the changes from my plugin, now regex based) | 17:35 | |
psch | perlpilot: what about calling AT-POS directly? | ||
seatek | perlpilot, you've brought order back to my little universe | ||
perlpilot++ | |||
hackedNODE | El_Che: 2016.09 | ||
El_Che: this's the commit: github.com/rakudo/rakudo/commit/aa...5146f19da6 | 17:36 | ||
seatek | psch++ | ||
psch | (or heck, why not nqp::atpos(nqp::getattr(nqp::decont(@a), 'Positional', $!storage), $idx) ha ha) | ||
honestly though, don't do that :) | |||
seatek | hackedNODE++ | ||
lizmat | El_Che: 23rd of August, so it's probably in 206.09 | ||
seatek | thanks guys | ||
hackedNODE | And another addition to the feature shortly after: github.com/rakudo/rakudo/commit/82...f82a88931a | ||
lizmat | 2016.09 | ||
El_Che | thx, I'll add it to the ticket | 17:37 | |
seatek | this object-oriented approach, clear at the deepest levels even... has it proven to be good at keeping order, or has it proven to be just as fragile, only in different ways? | 17:38 | |
perlpilot | psch: AT-POS -> 14s | 17:39 | |
:-) | |||
seatek: uh ... no? | 17:40 | ||
El_Che | he wants to add perl6 support, but I wonder if it's better to just start with 20016.09 and a new plugin | ||
hackedNODE | 20016? :) Talk about a 100-year language! : D | ||
I hope I'm still alive to do the release. | 17:41 | ||
17:41
itaipu joined
|
|||
seatek | perlpilot, yeah it's pretty much an impossible question | 17:41 | |
El_Che | hackedNODE: the code I have ofr vim syntax checkingis regex based | ||
the new rakudo support json output (lizmat++) | |||
so it will less fragile | 17:42 | ||
perlpilot | seatek: Have you read TimToady's waterbed theory of language design? | ||
El_Che | on the other hand, the format is not set on stone | 17:43 | |
hackedNODE | perlpilot: I haven't whereisit? | ||
seatek | perlpilot, no, I'm sadly mostly just a language *user* | 17:44 | |
perlpilot, but i'll look for that for some lunch reading | |||
harmil_wk | Is there a way to construct an anonymous list of pairs where the keys are the keys from an existing hash and the values are aliased to the matching values of the original (not copied)? | 17:45 | |
perlpilot | There's an early version at www.perl.com/pub/2003/06/25/perl6es...ials.html, but I'm sure TimToady has something better elsewhere. | ||
harmil_wk | I could do it with a temporary named hash, but not sure if it's possible without. | ||
seatek | perlpilot, couldn't wait.. ah i see. yes. that's what i've found with everything that's supposed to make everything wonderful | ||
perlpilot, that must be a... challenging balancing act | 17:47 | ||
timotimo | wow, holy crap, the google pixel is *crazy* expensive in europe compared to the us | ||
psch | harmil_wk: a subset of keys or all the keys? | ||
harmil_wk | psch: all the keys | 17:48 | |
psch | m: my %h = a => 1, b => 2; %h.pairs.cache.grep(*.key eq 'a')[0].value = 3; say %h.perl | ||
camelia | rakudo-moar c6c0e6: OUTPUT«{:a(3), :b(2)}» | ||
psch | harmil_wk: i mean, i might be totally missing the point though :) | 17:49 | |
harmil_wk | I think so... not sure. | ||
lizmat | .u beer | ||
yoleaux | U+1F37A BEER MUG [So] (🍺) | ||
U+1F37B CLINKING BEER MUGS [So] (🍻) | |||
harmil_wk | I was asking because this seemed to be a bit clunky: github.com/rakudo/rakudo/blob/nom/....nqp#L1194 | 17:50 | |
lizmat | m: my $a = "🍺"; $a++; say $a | ||
camelia | rakudo-moar c6c0e6: OUTPUT«🍻» | ||
harmil_wk | And was wondering if there was a way without the temporary variable to do the same. | ||
lizmat | (demoing at amsterdam pm meeting) | ||
psch | harmil_wk: i don't think you can get it easier than that in nqp, no | ||
(the fact that any perl6-ish solution would have lots more overhead aside) | 17:51 | ||
harmil_wk | Huh. Thanks. | ||
hackedNODE | timotimo: so what does it cost? | 17:53 | |
Looks highly unoriginal in both name and design. | 17:54 | ||
timotimo | the fingerprint reader on the back seems like an orinigal thing | ||
not that i like a fingerprint reader at all | |||
hackedNODE | Exactly lol. | 17:55 | |
$1,179 (CAD).... fuck that lol | |||
timotimo | 869 euros if you want 128gb storage, 759 euros otherwise | ||
759 euros equals 850 dollars | 17:56 | ||
psch | only on the stock market | ||
for consumer goods it's always different | |||
17:56
mempko joined
|
|||
psch | australia suffers worst for that i guess | 17:56 | |
timotimo | "Starting at $649 in the US" | ||
hackedNODE | My 2-year old $700CAD Note 4 has better specs across the board, if you ignore the extra gig of RAM. Does google plan to compete with Apple under the "we have a phone jack" banner? XD | 17:58 | |
masak | so... the .WHERE of an object can change due to GC moves, yes? | 17:59 | |
hackedNODE | yes | ||
masak | what do I use that doesn't change? :) | ||
hackedNODE | .WHICH? | ||
I guess for what is a fair question :) | |||
perlpilot just wrote some P5 like: $a = $b->thing if defined $b; only $a and $b were much longer. | 18:00 | ||
Would have been so much simpler with P6 | |||
masak | debug output; need to trace some pretty hairy lexical lookup in 007 | ||
18:01
rgrinberg left
|
|||
lizmat | masak: .WHICH contains the non-changing objectid | 18:01 | |
masak: if you wanna go nqp, you can use nqp::objectid | |||
hackedNODE | m: my $x = 4; my $y = 4; my $x2 = 1000; my $y2 = 1000; dd [$x.WHICH, $y.WHICH, $x2.WHICH, $y2.WHICH]; | ||
camelia | rakudo-moar c6c0e6: OUTPUT«[ObjAt.new("Int|4"), ObjAt.new("Int|4"), ObjAt.new("Int|1000"), ObjAt.new("Int|1000")]» | ||
masak | ok, great | ||
seatek | perlpilot, that's a great piece you linked me to - thank you. | ||
perlpilot | seatek: you're welcome | 18:05 | |
seatek | A clearly defined set of rules will never match the power of a feature that "just seems right." | ||
That's the waterbed in large part it seems to me | |||
yet objects require strict rules or else troublesome dependencies start to happen | 18:06 | ||
that's the amazing bit to me | |||
it must be some pretty wild design at the "atomic" level. Hmm. This VM is kinda making sense now. | 18:09 | ||
mst | perlpilot: show me the code and let's see if you confused something :) | ||
masak | "waterbed theory" is also mentioned once in A05 | ||
psch | seatek: well, it mostly starts with knowhow (scnr) | ||
m: say Any.HOW.HOW.HOW.HOW.^name # ha ha | 18:10 | ||
camelia | rakudo-moar c6c0e6: OUTPUT«KnowHOW» | ||
psch | seatek: well, the object model at least... :) | 18:11 | |
seatek | psch, :) :) | ||
18:11
cdg left
|
|||
hackedNODE | mst: the if defined for method calls is pretty common in Perl 5 tho. While Perl 6 has a safe call operator | 18:13 | |
18:14
hankache left
|
|||
hackedNODE | m: dd Mu.?grep: 42; | 18:14 | |
camelia | rakudo-moar c6c0e6: OUTPUT«Nil» | ||
mst | hackedNODE: the if defined for method calls is common if you don't know perl5 well enough to avoid it, yes | ||
hackedNODE | :( | ||
mst | hackedNODE: however Safe::Isa largely eliminates the need, and there's alternatives for other things | ||
as usual, many criticisms of perl5 are due to insufficient knowledge of perl5 | 18:15 | ||
though I totally agree perl6 makes it easier to find the right thing | |||
hackedNODE | Yes, there's module for everything. Until that module is written by a crazy person and another module de jour takes place. | ||
masak | mst: I have an honest question about Perl 5 and insufficient knowledge. if I suspect there are a lot of more-or-less well-known CPAN modules I ought to know about (so I don't re-invent the wheel or use a lesser Perl 5 than I should), where should I start looking to learn more? | 18:16 | |
hackedNODE | masak: Task::Kensho | 18:17 | |
mst | which we should do a round of updates to shortly | ||
also the mstpan | |||
masak | ooh | ||
I knew about Task::Kensho, but not about mstpan | |||
hackedNODE looks at Safe::Isa | 18:18 | ||
18:18
Jonis joined
|
|||
hackedNODE | It's hard to convince me that `use Safe::Isa; ...->$_call_if_object` is on equal footing with just `.?` | 18:19 | |
mst | I wasn't trying to convince you of that | 18:20 | |
masak .oO( don't you come here trying to tell me what you were or were not trying to tell me! ) :P | 18:21 | ||
18:24
AlexDaniel joined
|
|||
dogbert17 | o/ #perl6 | 18:26 | |
hackedNODE | \o | ||
masak | yo dogbert17 | ||
dogbert17 | have a possible mystery for you | ||
psch | ooh | ||
dogbert17++ | |||
masak | the butler! the butler did it! | 18:27 | |
hackedNODE | :) | ||
dogbert17 | m: my int $i = 2482111348; say $i; $i = $i div 2; say $i #what's happening here? | ||
camelia | rakudo-moar c6c0e6: OUTPUT«2482111348-906427974» | ||
psch | no, the gardener with the aerosol can! | ||
masak | dogbert17: what, don't you like negative numbers? :P | ||
psch | m: say 2482111348.base(2) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«10010011111100100000001101110100» | ||
dogbert17 | masak: they have their charm :-) | 18:28 | |
psch | m: say 2482111348.base(2).comb(/\d/).chars | ||
camelia | rakudo-moar c6c0e6: OUTPUT«63» | ||
psch | that is mysterious | ||
dogbert17 | yay | ||
psch | m: say -906427974.base(2).comb(/\d/).chars | ||
camelia | rakudo-moar c6c0e6: OUTPUT«-59» | ||
perlpilot | dogbert17: you could have saved some characters and just said "bug" instead of "mystery" :) | ||
masak | m: say 2482111348.base(2).chars | ||
camelia | rakudo-moar c6c0e6: OUTPUT«32» | ||
psch | masak++ # i'm being silly | ||
shoulda gone .elems, in hindsight | 18:29 | ||
dogbert17 | so an int is 32 bits then? | ||
masak | m: say (-906427974).base(2).chars | ||
camelia | rakudo-moar c6c0e6: OUTPUT«31» | ||
psch | the speculated answer is "it's platform dependent" | ||
not sure if we're actually going with that for roast though | |||
masak | conceptually, they're arbitrary-precision | ||
psch | masak: int is? | ||
masak: i thought that was Int | |||
masak | oh, wait | ||
Xliff | say 8675309.base(3) | ||
m: say 8675309.base(3) | 18:30 | ||
camelia | rakudo-moar c6c0e6: OUTPUT«121022202021202» | ||
masak | didn't see the lowercase `int` there :) | ||
hackedNODE | m: my int $i = 2482111348; say $i / 2; | ||
camelia | rakudo-moar c6c0e6: OUTPUT«1241055674» | ||
dogbert17 | m: my int64 $i = 2482111348; say $i; $i = $i div 2; say $i # a larger int I think | ||
camelia | rakudo-moar c6c0e6: OUTPUT«2482111348-906427974» | ||
hackedNODE | s: &infix:<div>, \(my int $i = 2482111348, 2) | ||
SourceBaby | hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/c6c0...nt.pm#L264 | ||
psch | m: my uint $i = 2482111348; say $i; $i = $i div 2; say $i | 18:31 | |
camelia | rakudo-moar c6c0e6: OUTPUT«2482111348-906427974» | ||
psch | j: my uint $i = 2482111348; say $i; $i = $i div 2; say $i | ||
camelia | rakudo-jvm 2a1605: OUTPUT«24821113481241055674» | ||
psch | haha! jvm backend wins again! | ||
hackedNODE | m: my int $a = 2482111348; my $b = 2; nqp::div_I(nqp::decont($a), nqp::decont($b), Int) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Could not find nqp::decont, did you forget 'use nqp;' ?at <tmp>:1------> 038; my $b = 2; nqp::div_I(nqp::decont($a)7⏏5, nqp::decont($b), Int)» | ||
hackedNODE | m: use MONKEY-GUTS; my int $a = 2482111348; my $b = 2; dd nqp::div_I(nqp::decont($a), nqp::decont($b), Int) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«1241055674» | ||
masak | "XML::Simple claims to round trip ... but only in the sense that if you jump off a tall building with an overly long bungee cord, your mangled remains will probably end up somewhere back near the top." -- mst++ :) | 18:32 | |
hackedNODE | m: use MONKEY-GUTS; my int $a = 2482111348; my $b = 2; dd nqp::div_i($a, $b) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«-906427974» | ||
hackedNODE | m: use MONKEY-GUTS; my int $a = 2482111348; my $b = 2; dd nqp::div_i($a, nqp::decont($b)) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«-906427974» | ||
hackedNODE | Are you tired of my spam, or should I continue? :D | 18:33 | |
dogbert17 | I'm not tired :) | ||
psch | it's not kinda "int64 isn't, also signedness" i think? :S | ||
masak still thinks the butler did it | |||
psch starts to agree | 18:34 | ||
Xliff | query camelia | ||
psch | although the gardener might be more involved with native(ly growing plants ha ha) | ||
hackedNODE | It's kinda weird that the candidate SourceBaby points to actually works. | ||
And the broken one isn't supposed to fit | |||
Xliff | Well, looks like someone beat me to CArray.STORE. It has taken me forever to get around to it. | 18:35 | |
psch | m: sub f(Int $) { "Int" }; sub f(int $) { "int" }; my int $x = 0; say f $x | ||
camelia | rakudo-moar c6c0e6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Redeclaration of routine 'f' (did you mean to declare a multi-sub?)at <tmp>:1------> 3Int $) { "Int" }; sub f(int $) { "int" }7⏏5; my int $x = 0; say f $x expecting any of: horizo…» | ||
lucasb_ | what? the MMD for int vs Int? I don't think they are always reliable | ||
psch | m: multi f(Int $) { "Int" }; multi f(int $) { "int" }; my int $x = 0; say f $x | ||
camelia | rakudo-moar c6c0e6: OUTPUT«int» | ||
Xliff | m: use NativeCall; my @a = CArray[int32].new; @a = Bool.roll(100); say @a.elems | ||
psch | there was a bug there once but it was also fixed | ||
camelia | rakudo-moar c6c0e6: OUTPUT«100» | ||
psch | maybe not quite | ||
Xliff | Or maybe not. | 18:36 | |
hackedNODE | lucasb_: what does that mean? What's the point of unreliability? | ||
lucasb_ | m: multi f(Int) {'I'}; multi f(int) {'i'}; say f(1) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«i» | ||
lucasb_ | m: multi f(Int) {'I'}; multi f(int) {1+2}; say f(1) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«I» | ||
psch | m: multi f(Int $) { "Int" }; multi f(int $) { "int" }; my int $x = 0; say f $x | ||
camelia | rakudo-moar c6c0e6: OUTPUT«int» | ||
psch | ah nvm | ||
seatek | All I know is that my first day playing with P6 recently, I threw away ever using "int" because it was doing crazy stuff and used "Int" instead | 18:37 | |
lucasb_ | just changed the inside expression and the dispatch stopped matching | ||
hackedNODE | lucasb_: that's an optimizer bug | ||
If you turn it off it works fine | 18:38 | ||
lucasb_ | ah, I didn't know that. thanks hackedNODE++ | ||
dogbert17 | hackedNODE++ | ||
hackedNODE | Would be nice if camelia had an option to run with optimizer off | ||
psch dimly remembers jnthn++ fixing something along those lines back somewhen... | |||
hackedNODE | ...by which I mean I'm too lazy to do it myself and hoping someone else will do it for me :P | ||
psch | i wonder if the EvalServer actually supports that | 18:39 | |
i think it should, but i'm not sure | |||
timotimo | it ought to | ||
hackedNODE | Ohooo | ||
timotimo | if not, it should be easy to implement | ||
hackedNODE | dogbert17: yours is also an optimizer bug | ||
Optimzier bugs for everyone \o/ | 18:40 | ||
psch | yeah we got a lot of those recently don't we | ||
18:40
rgrinberg joined
|
|||
hackedNODE | That's good. It means they're migrating further down the end :) | 18:40 | |
dogbert17 | interesting, I used int to speed up a problem I discussed with timotimo yesterday when I noticed that the results defered between Int and int | ||
s/defered/differed/ | 18:41 | ||
the int version was quite a bit faster but alas incorrect | |||
timotimo | damn | ||
dogbert17 | timotimo: optimizer bug according to hackedNODE | 18:42 | |
18:42
labster joined
|
|||
timotimo | right | 18:43 | |
hackedNODE | Yeah, and I think what lucasb_ showed is the same bug. The int candidate gets called when an Int is given. | ||
So the int, int div candidate gets called. | |||
m: my int $a = 2482111348; my int $b = 2; say $a div $b; | |||
camelia | rakudo-moar c6c0e6: OUTPUT«-906427974» | ||
timotimo | that should only happen if the numbers are in range, though | ||
hackedNODE | Why does that ^ give a negative numbers though? | ||
timotimo | o_O | ||
m: say 2482111348.base(16) | |||
camelia | rakudo-moar c6c0e6: OUTPUT«93F20374» | ||
hackedNODE | m: use MONKEY-GUTS; my int $a = 2482111348; my int $b = 2; say nqp::div_i($a,$b); | 18:44 | |
camelia | rakudo-moar c6c0e6: OUTPUT«-906427974» | ||
timotimo | m: say (-906427974).base(16) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«-3606FE46» | ||
masak fixes a pretty hairy bug by switching on MONKEY-SEE-NO-EVAL and using EVAL | 18:45 | ||
hackedNODE | m: "say 'Stop absuing the monkeys!'".EVAL | ||
camelia | rakudo-moar c6c0e6: OUTPUT«Stop absuing the monkeys!» | ||
perlpilot | "fixes"? or "sweeps under the rug"? ;) | ||
masak | by the way, I still think the error message for EVAL is a tad too hysterical. three exclamation marks. "a very dangerous function!!!" | ||
18:46
sufrostico left
|
|||
masak | perlpilot: yes, there is technical debt in there. yes, I will eventually get around to doing it differently :P | 18:46 | |
hackedNODE | :D | ||
masak | but this is a local, short-term improvement (that just happens to involve EVAL) | ||
dogbert17 | hackedNODE: should I RT this? | ||
hackedNODE | dogbert17: yes, please. | 18:47 | |
perlpilot | Hey, I won't judge. I'm just trying to make sure about your grasp of reality :) | ||
18:47
mempko left
|
|||
dogbert17 | ok | 18:47 | |
perlpilot | dogbert17: did you look to see if there was already an RT ticket for it? You might do a quick search first, but when in doubt, rakudobug it. | 18:48 | |
dogbert17 | perlpilot: I'll take a look | 18:49 | |
perlpilot: RT #128655 looks a bit similar | 18:51 | ||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=128655 | ||
masak | perlpilot: github.com/masak/007/commit/a39a44...1b5162459e | 18:52 | |
lucasb_ | yes, looks the ticket looks related | 18:53 | |
idk why the int/Int distinction interacts with multi's | |||
m: sub f(int) {1+2}; say f(1) | |||
camelia | rakudo-moar c6c0e6: OUTPUT«3» | ||
lucasb_ | m: multi f(int) {1+2}; say f(1) | ||
camelia | rakudo-moar c6c0e6: OUTPUT«Cannot resolve caller f(Int); none of these signatures match: (int) in block <unit> at <tmp> line 1» | ||
lucasb_ | also... for anyone how likes to write the docs... I'd like to suggest the inclusion of a question in the FAQ | 18:54 | |
hackedNODE | dogbert17: yeah, seems to be the same thing. Maybe just comment on it, mentioning this happens with any sub with int/Int multies, not just bitwise ops, so the quickfix described in the ticket isn't applicable. | ||
lucasb_ | "A literal integer like 1234 is an 'int' or an 'Int'?" | ||
awwaiid | m: 123.WHAT.say | 18:55 | |
camelia | rakudo-moar c6c0e6: OUTPUT«(Int)» | ||
dogbert17 | hackedNODE: and how do I comment on that bug? | ||
awwaiid | ah, for faq | ||
lucasb_ | I said FAQ because I myself already asked this before... but forgot the answer :D | ||
dogbert17 | do I mention the RT # in the mail subject? | ||
lucasb_ | the answer probably is "It depends" | 18:56 | |
awwaiid | hehe | ||
hackedNODE | dogbert17: do you have the "Reply Comment" buttons on right of page? | ||
dogbert17 | too easy :) | ||
pressing "Reply Comment" gives "This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure. For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org " | 18:58 | ||
hackedNODE | dogbert17: did you log in? | ||
dogbert17 | with what credentials? | ||
hackedNODE | dogbert17: if you type up what you wanted to comment with I can post it on your behalf | ||
dogbert17: with your RT account. | 18:59 | ||
I guess you don't have it? :D | |||
dogbert17 | :D | ||
hackedNODE | And I think even if you had one, commenting on just any ticket requires elevated privileges | ||
18:59
FROGGS left
|
|||
dogbert17 | I'll whip something up and send you a gist | 19:00 | |
19:00
girafe joined
|
|||
perlpilot | masak: rather than EVAL, could you wrap that in a sub {} which you immediately evaluate? | 19:01 | |
masak | perlpilot: no, I tried that. | ||
19:02
spider-mario left
|
|||
masak | perlpilot: the problem is that `class` is not a closure. it doesn't close over its environment. | 19:02 | |
19:02
spider-mario joined
|
|||
masak | it evaluates at compile time, and after that it's just not very fun at parties. | 19:02 | |
perlpilot | oh, I see. I was thinking the sub {} would make a closure for you, but by then it's too late | 19:03 | |
masak | indeed | ||
perlpilot wonders if you can parameterize anonymous classes | 19:04 | ||
masak | no, only roles | ||
and I tried that too | |||
perlpilot | heh | ||
masak | but even that happens too early | ||
or at least I couldn't find the right invocation to make it happen late enough | |||
19:05
sjoshi joined
|
|||
masak | but EVAL is a way to make things happen late | 19:05 | |
just as BEGIN makes things happen early | 19:07 | ||
19:14
ocbtec left
19:16
domidumont left
19:17
labster left
19:20
dalek left
19:21
dalek joined,
ChanServ sets mode: +v dalek
|
|||
[Coke] | m: use MONKEY; EVAL 'use MONKEY; ' ~ ('EVAL ' x 2000) ~ 3 | 19:22 | |
camelia | ( no output ) | ||
[Coke] | m: use MONKEY; say EVAL 'use MONKEY; ' ~ ('EVAL ' x 2000) ~ 3 # not as late as possible, but pretty late | 19:23 | |
camelia | rakudo-moar c6c0e6: OUTPUT«3» | ||
masak boggles | 19:24 | ||
wait, you have to `use MONKEY;` inside the EVAL string, too? | 19:25 | ||
surely by that time you're already pretty monkied? | |||
masak .oO( this is a simian compunit ) | |||
[Coke] | yup, required. | ||
mst | monkey C, monkeys du | 19:26 | |
[Coke] | monkey C, monkey Mu | ||
gfldex | m: my int $i; dd $i; $i = Nil; | 19:28 | |
camelia | rakudo-moar c6c0e6: OUTPUT«0Cannot unbox a type object in block <unit> at <tmp> line 1» | ||
gfldex | m: my int $i; dd $i; BEGIN say 'bird'; $i = Nil; | 19:29 | |
camelia | rakudo-moar c6c0e6: OUTPUT«bird0Cannot unbox a type object in block <unit> at <tmp> line 1» | ||
gfldex | ENODOC++ | ||
dalek | c: a6c627c | gfldex++ | doc/Type/Nil.pod6: explain native type and Nil |
19:33 | |
gfldex | ENODOC-- | ||
19:33
wamba left
|
|||
gfldex | m: my int $i; $i = Nil; | 19:33 | |
camelia | rakudo-moar d8309d: OUTPUT«Cannot unbox a type object in block <unit> at <tmp> line 1» | ||
gfldex | that's LTA. If there is a Nil spillage somewhere, that error message can be fairly confusing. | ||
19:37
cpage__ left
19:38
_slade_ left,
firefish5000 joined,
mcmillhj left
|
|||
[Coke] | what's a better error message? | 19:40 | |
psch | m: my int $x is default(0) = Nil; say $x | 19:42 | |
camelia | rakudo-moar d8309d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Can't use trait 'is default' on a native.at <tmp>:1------> 3my int $x is default(0)7⏏5 = Nil; say $x expecting any of: constraint» | ||
timotimo | it could tell that it's a Nil there | ||
via the debugname | |||
19:42
labster joined
|
|||
psch | well, native types cannot have defaults nor "no value", so assigning Nil to them is meaningless | 19:42 | |
not sure how that translates to an error message though | 19:43 | ||
timotimo | working on it | ||
19:43
_slade_ joined
|
|||
firefish5000 | Good day! Its been a while since I have fixed my perl6... just to be sure, there is no no longer a 'for' method for lists/arrays correct? | 19:44 | |
psch | m: Array.can('for').say | 19:45 | |
camelia | rakudo-moar d8309d: OUTPUT«()» | ||
psch | m: Positional.can('for').say | ||
camelia | rakudo-moar d8309d: OUTPUT«()» | ||
moritz | firefish5000: no, it's spelled 'map' again :/ | ||
timotimo | just pushed a patch to moarvm that makes the error message more informative | ||
hackedNODE | \o/ | 19:46 | |
psch | j: my int $i; $i = Nil; | ||
camelia | rakudo-jvm 2a1605: OUTPUT«Cannot unbox a type object in block <unit> at <tmp> line 1» | 19:47 | |
firefish5000 | Ok, thanks moritz, all of my old code had '.for', I love dot notation. Looks like 's/\.for/\.map' works well! | 19:48 | |
Unfortunatly my code is still horribly buggy, I finaly got it to compile but it does the exact opisit of what its suppose to do.... | 19:49 | ||
lucasb_ | drop the R metaoperator :) | 19:50 | |
timotimo | probably needs a bit more explicit flattening | ||
firefish5000 | I am not sure if that was aimed at me, but it does seem to need more explicit flattening, bu single value returned is now a 4 levels deep array | 19:52 | |
[Coke] suspects this code is over a year old. | |||
lucasb_ | what was the purpose of the .for method? to have a .map that didn't accumulate it's result? | 19:53 | |
timotimo | yeah, definitely pre-GLR | ||
firefish5000 | lol, 1.5-3 years I think. Supposedly I last worked on it in Febuary of last year | 19:54 | |
moritz | lucasb_: it as a .map with some (non-)flattening behavior that .map was going to lose | ||
*was | |||
19:55
mcmillhj joined
|
|||
lucasb_ | moritz: ah, ok. thanks | 19:55 | |
20:00
mcmillhj left,
kaare_ left
|
|||
skids | nativetypes do "have a default" in that they have a hard-coded one, just cannot have the "default" trait applied. Whether assigning Nil to them should be legal... and whether they should have a .default method... I dunno. | 20:04 | |
m: my int32 $a; $a.say; | |||
camelia | rakudo-moar d8309d: OUTPUT«0» | ||
20:05
mcmillhj joined
|
|||
lucasb_ | m: my num $x; say $x.perl | 20:05 | |
camelia | rakudo-moar d8309d: OUTPUT«NaN» | ||
lucasb_ | interesting. I was expecting 0.0 as the default | ||
20:14
setty2 left
20:15
andrzejku joined
20:17
labster left,
mohae_ left
|
|||
andrzejku | hello my friends :) | 20:17 | |
20:18
mohae joined
20:19
lucasb_ left
20:26
nyarmith joined
20:27
sjoshi left
|
|||
[Coke] | o/ | 20:28 | |
20:29
nadim_ left
|
|||
gfldex | can zef setup a new CompUnit::Repository ? | 20:30 | |
20:36
andrzejku left
|
|||
gfldex | it can not | 20:39 | |
how does one create a CompUnit::Repository? | 20:40 | ||
20:40
ptolemarch left
|
|||
gfldex | zef --install-to=home insall Any::Module::You::Like # that will install a repro in $HOME/.perl6 | 20:44 | |
maybe I should first read the code and then not ask questions? :-> | |||
20:45
mcmillhj left
20:48
mcmillhj joined
20:55
labster joined
20:59
Dunearhp left,
Dunearhp joined
21:06
canopus left
|
|||
seatek | m: sub del(Int :$id where {$id > 0}) { $id }; say del(id => 2); | 21:08 | |
camelia | rakudo-moar d8309d: OUTPUT«2» | ||
21:08
labster left
|
|||
seatek | m: sub del(Int :$id? where {$id > 0}) { $id }; say del(id => 2); | 21:09 | |
camelia | rakudo-moar d8309d: OUTPUT«2» | ||
21:09
lizmat left
|
|||
seatek | m: sub del(Int :$id? where {$id > 0}) { $id }; say del(); | 21:09 | |
camelia | rakudo-moar d8309d: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new? in sub del at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
seatek | It must be my sprained brain | ||
m: sub del(Int :$id? where {$id > 0}) { 0 }; say del(); | 21:10 | ||
camelia | rakudo-moar d8309d: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new? in sub del at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
seatek | does using a "where" clause in the signature make a parameter impossible to be optional? | ||
21:11
mcmillhj left,
canopus joined
|
|||
AlexDaniel | m: sub del(Int :$id? where {not defined $id or $id > 0}) { 0 }; say del(); | 21:12 | |
camelia | rakudo-moar d8309d: OUTPUT«0» | ||
21:12
rindolf left
|
|||
seatek | ok that's weird but i understand - thank you | 21:13 | |
AlexDaniel | seatek: it is weird indeed | ||
seatek | AlexDaniel++ | ||
AlexDaniel | I am not sure if where {} check should be run if the parameter is optional | 21:14 | |
seatek | i think it absolutely should not | ||
AlexDaniel | seatek: can you create a ticket for that? | ||
seatek | i have never made a ticket here -- would that be for rakudo? | 21:15 | |
somebody said earlier than, when in doubt, open for Rakudo.. but I felt pity for Rakudo when I heard that, so I'm a little hesitant ;) | 21:16 | ||
AlexDaniel | seatek: no it's right | 21:17 | |
huggable: bug | |||
huggable | AlexDaniel, nothing found | ||
AlexDaniel | huggable: bug report | ||
huggable | AlexDaniel, nothing found | ||
gfldex | it must be run or you could not check for mutual exclusive parameters | ||
AlexDaniel | huggable: rakudobug | ||
huggable | AlexDaniel, [email@hidden.address] or use perl6 query on rt.perl.org ; see github.com/rakudo/rakudo/#reporting-bugs | ||
21:17
cpage__ joined
|
|||
AlexDaniel | seatek: this one ↑ | 21:18 | |
21:18
skids left
|
|||
gfldex | m: sub f(Int :$a?, Int :$b? where { $a.defined ^^ $b.defined }){}; f(:a(10)) | 21:19 | |
camelia | ( no output ) | ||
gfldex | m: sub f(Int :$a?, Int :$b? where { $a.defined ^^ $b.defined }){}; f(:a(10), :b(10)) | ||
camelia | rakudo-moar d8309d: OUTPUT«Constraint type check failed for parameter '$b' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
seatek | gfldex, You saying that you have to run the where clause even on optional parameters? | ||
gfldex | m: sub f(Int :$a?, Int :$b? where { $a.defined ^^ $b.defined or die 'either use :a or :b, but not both'}){}; f(:a(10), :b(10)) | ||
camelia | rakudo-moar d8309d: OUTPUT«either use :a or :b, but not both in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
gfldex | yes | 21:20 | |
or that example would not be possible | |||
seatek | then it isn't an optional parameter | ||
there's some kind of "pay the devil" in there | |||
gfldex | all named parameters are optional | 21:21 | |
AlexDaniel | so now you have a constraint on $b that checks both $a and $b | ||
which is even weirder | 21:22 | ||
seatek | all named parameters are optional, but when you have a named parameter with a where clause, you have to remember to check again if it's there or not yourself | ||
gfldex | m: sub f(Int $i? where { $_ ~~ Int || $_ > 10 }){}; f | 21:23 | |
camelia | ( no output ) | ||
seatek | so it's optional, but you better make sure if it's there or not | ||
gfldex | a where clause must be able to supersede a type constraint | ||
m: sub f(Int $i? where { $_ ~~ Nil || $_ > 10 }){}; f | 21:24 | ||
camelia | rakudo-moar d8309d: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new? in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
seatek | this is that damn waterbed | ||
gfldex | m: sub (|(:$a, :$b) where { $a.defined ^^ $b.defined } ){} # that doesn't work and that's why any where clause has to be executed | 21:25 | |
camelia | rakudo-moar d8309d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Obsolete use of | or \ with sigil on param (:$a, :$b)at <tmp>:1------> 3sub (|(:$a, :$b)7⏏5 where { $a.defined ^^ $b.defined } ){} » | ||
21:26
devmikey joined
|
|||
gfldex | a where-clause is a guard against false assignment. If no argument is there to bind to, the compiler invents a value for it and it picks Any | 21:27 | |
because Any is the default default | |||
so there is always a value to be checked against, what the where-clause does | 21:28 | ||
21:31
stmuk_ left
|
|||
seatek | I can accept it. But it will require a chocolate break to completely. | 21:32 | |
21:33
stmuk_ joined
|
|||
seatek | Where I'll be pondering the detailed, lesser-used semantics against the common intuitive thinking | 21:34 | |
gfldex | ENODOC btw | 21:35 | |
seatek | what's ENODOC? | 21:37 | |
dalek | c: c84bbed | gfldex++ | doc/Type/Signature.pod6: tell that where clauses are executed on not provided optional arguments |
21:39 | |
gfldex | ERROR NO DOCUMENTATION | ||
and since my brain is a sieve with a fairly wide mesh, I tend to fix those to help my future self | 21:40 | ||
seatek | Thank you for that! I'd put giant flashing warning lights there that say, OPTIONAL PARAMETERS ARE NOT OPTIONAL AND WILL RESULT IN A COMPILER ERROR IF YOU USE A WHERE CLAUSE AND DO NOT CHECK IF THAT OPTIONAL PARAMETER IS DEFINED | 21:42 | |
it's much clearer to a user | |||
gfldex | but you are writing test for your software don't you? So you can't possibly miss that problem! | 21:43 | |
seatek | it's not an easy one to find | ||
there error message is useless | |||
21:43
labster joined
|
|||
seatek | Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new | 21:44 | |
gfldex | imagine you would have to write a book about Perl 6 :-> | ||
seatek | oh yeah, I forgot to check if my optional parameter was checked | ||
gfldex | the error message is LTA indeed, feel free to rakudobug | ||
21:45
bjz left
|
|||
seatek | I hate the where clause now. I'm going to boycott it everywhere. ;) | 21:47 | |
gfldex | m: subset S of Int where * > 10; sub f(S $i?){}; f; | 21:49 | |
camelia | rakudo-moar d8309d: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new? in block <unit> at <tmp> line 1» | ||
gfldex | that kinda sucks | ||
m: subset S of Int where dd *; sub f(S $i?){}; f; | |||
camelia | rakudo-moar d8309d: OUTPUT«**Constraint type check failed for parameter '$i' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
gfldex | m: subset S of Int where { dd $_ }; sub f(S $i?){}; f; | ||
camelia | rakudo-moar d8309d: OUTPUT«Int $topic = IntInt $topic = IntConstraint type check failed for parameter '$i' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
gfldex | that should be Nil | 21:50 | |
so there is a bug | |||
dalek | c: 0f2e64e | (David Warring)++ | META.info: add Pod::To::HTML dependency It's used by ./htmlify.p6 |
21:51 | |
21:51
bjz joined
21:52
dwarring joined,
bjz left
|
|||
gfldex | well, maybe not | 21:52 | |
m: f(Int $i = Int){ dd $i }; f; | 21:53 | ||
camelia | rakudo-moar d8309d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in argument list; couldn't find final ')' at <tmp>:1------> 3f(Int7⏏5 $i = Int){ dd $i }; f; expecting any of: infix infix stopper» | ||
gfldex | m: sub f(Int $i = Int){ dd $i }; f; | ||
camelia | rakudo-moar d8309d: OUTPUT«Int» | ||
gfldex | that's what a optional parameter actually is | 21:54 | |
m: sub f(Int $i = Nil){ dd $i }; f; | 22:00 | ||
camelia | rakudo-moar d8309d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Default value 'Nil' will never bind to a parameter of type Intat <tmp>:1------> 3sub f(Int $i = Nil7⏏5){ dd $i }; f; expecting any of: constraint» | ||
masak | 'night, #perl6 | 22:01 | |
22:12
TimToady left,
labster left
22:13
TimToady joined
22:14
bjz joined
|
|||
seatek | gfldex, i just went for a walk with an english muffin. you're right i think. the ability to check parameters, even optional ones, in the where clause, outweighs the clarity of "optional parameters" being truly, completely optional when where clauses are there. you're absolutely right, and i'm glad it's that way. but it will be point of pain for many i am sure. | 22:17 | |
gfldex | i still think the topic of a where clause on a not given optional parameter should be Nil and not the type object. That way you got a chance to make the distinction within the where clause. | 22:19 | |
.tell TimToady please have a look at the following (and above) irclog.perlgeek.de/perl6/2016-10-04#i_13336963 | 22:20 | ||
yoleaux | gfldex: I'll pass your message to TimToady. | ||
22:20
kurahaupo joined
|
|||
gfldex | a quick grep in roast goes not find a test for optional parameters with where clauses. So that might be a blind spot of Perl 6. | 22:23 | |
seatek | gfldex, i like the idea of Nil better too, but i don't have enough experience in these matters to know if a type might be better -- but i can't image why it would be.. ?? | ||
22:23
wtw_ joined
|
|||
seatek | gfldex, it's a very frustrating blind spot because it's very unintuitive unless you know about it ahead of time | 22:24 | |
gfldex | that's why I doced it :) | ||
i'm trying to install all modules from the eco system. It took zef about 30min to decide in what order to install those modules. | 22:26 | ||
TimToady | m: subset S of Int where { not .DEFINITE or $_ > 5 }; sub f(S $i?){}; f; | ||
camelia | ( no output ) | ||
yoleaux | 22:20Z <gfldex> TimToady: please have a look at the following (and above) irclog.perlgeek.de/perl6/2016-10-04#i_13336963 | ||
22:27
labster joined
|
|||
TimToady | m: subset S of Int where { not .DEFINITE or $_ > 5 }; sub f(S $i?){}; f 10; | 22:27 | |
camelia | ( no output ) | ||
TimToady | m: subset S of Int where { not .DEFINITE or $_ > 5 }; sub f(S $i?){}; f 0; | ||
camelia | rakudo-moar d8309d: OUTPUT«Constraint type check failed for parameter '$i' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
TimToady | that's how you have to write it currently | ||
gfldex | TimToady: is .DEFINITE official? | 22:28 | |
TimToady | that's what :D means | ||
and that's pretty official... | 22:29 | ||
m: say Failure.new.defined | |||
camelia | rakudo-moar d8309d: OUTPUT«False» | ||
TimToady | m: say Failure.new.DEFINITE | ||
camelia | rakudo-moar d8309d: OUTPUT«True» | ||
gfldex | m: class C { method DEFINITE { False } }; sub f($a:D){}; f C.new; | 22:31 | |
camelia | rakudo-moar d8309d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Invalid typename 'D' in parameter declaration.at <tmp>:1------> 3 method DEFINITE { False } }; sub f($a:D7⏏5){}; f C.new;» | ||
TimToady | m: subset S of Int where { not .DEFINITE or $_ > 5 }; sub f(S $i = 10){}; f; | ||
camelia | ( no output ) | ||
gfldex | m: class C { method DEFINITE { False } }; sub f(Any:D $a){}; f C.new; | ||
camelia | ( no output ) | ||
TimToady | .DEFINITE is really an operator like .WHAT | 22:32 | |
m: class C { method DEFINITE { True } }; sub f(Any:D $a){}; f C; | 22:33 | ||
camelia | rakudo-moar d8309d: OUTPUT«Parameter '$a' requires an instance of type Any, but a type object was passed. Did you forget a .new? in sub f at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
TimToady | so you can't override it like a method | ||
iirc it actually means nqp::isconcrete or so | 22:34 | ||
gfldex | i wonder if it should warn when you try to overload those pseudo-methods | 22:35 | |
22:35
Praise joined
|
|||
timotimo | i think we have a p6concrete or something | 22:35 | |
TimToady | nah, for p6 you just call the .defined method | 22:36 | |
22:36
skids joined
|
|||
gfldex | m: class C { method WHAT { 'wrong' } }; C.new.WHAT.say; | 22:37 | |
camelia | rakudo-moar d8309d: OUTPUT«(C)» | ||
22:37
kurahaupo left
|
|||
TimToady | same deal there, yeah | 22:37 | |
dalek | c: a780b0f | gfldex++ | doc/Language/mop.pod6: WHAT and DEFINITE are pseudo-methods |
22:38 | |
gfldex | any complains can be thwarted with RTFM :) | ||
TimToady | thing is, "where" currently means "here's an invariant that must hold in this routine" | 22:39 | |
and we uphold type invariants on optional params by supplying a type object | 22:40 | ||
22:40
cdg joined
|
|||
TimToady | m: sub f(Int $a?){ say $a ~~ Int }; f; | 22:41 | |
camelia | rakudo-moar d8309d: OUTPUT«True» | ||
gfldex | what do you think about providing Nil to the where clause for unspecified optionals? | ||
TimToady | Nil would break that invariant view of things | ||
type objects are how we indicate a Maybe type without a value, basically | 22:45 | ||
22:46
acrussell left,
nadim_ joined
22:50
lostinfog left
|
|||
seatek | what would you think about calling "optional" parameters, "removeable" parameters instead? that might trigger people to think and look more about it, rather than becoming frustrated. thing is, it's just when where's are attached | 22:51 | |
TimToady | I don't think using a more obscure word helps here | 22:53 | |
we do allow Nil and Failure to leak out of typed functions, but it seems like a new level of danger to let them leak in | 22:54 | ||
22:55
RabidGravy left
|
|||
TimToady | m: sub f(Int:D $a where * > 0 = 10){ say $a ~~ Int }; f; | 22:56 | |
camelia | rakudo-moar d8309d: OUTPUT«True» | ||
TimToady | that's the normal way of not breaking an invariant on an optional parameter, and I'm not sure trying to dwim on $a? by breaking the invariant is gonna be all that helpful | 22:57 | |
it's certainly possible we could have better error messages though | |||
22:57
nyarmith left
|
|||
seatek | that would go miles | 22:58 | |
TimToady | course, if you're the first person to run into this, then that says something too :) | ||
seatek | my first thought was, perl is broke! because it's an optional parameter, that obviously isn't being treated like an optional parameter | 22:59 | |
TimToady | .oO(making invariants vary is hard, let's go shopping) |
23:00 | |
seatek | i've learned so much about the internals here, listening to you guys go into why it's actually like that from this little thing :) | 23:01 | |
ok :) | |||
23:01
bjz left
|
|||
TimToady | well, we're all still learning, when it comes down to it... | 23:02 | |
seatek | yeah, i was just talking with someone about specialized knowledge vs generalized, and how one can become unable to see the other so easily | 23:03 | |
that's what i've always loved bout the perls, actually, (thanks timtoady :) ) | |||
i trust what you guys are doing | 23:04 | ||
23:04
Zero_Dogg left
|
|||
TimToady | the downside of every feature serving multiple purposes is that if you make something dwim for one purpose, it often compromises the other purposes | 23:04 | |
seatek | that waterbed | 23:05 | |
yeah | |||
TimToady | it might be possible to have a non-invariant constraint, a "where-if-there" or so, modulo syntactic sugar | ||
but we'd have to weigh how much mind-space such a feature would take wrt its benefitis | 23:06 | ||
"benefititis" :) | |||
dalek | c: 24bfc7d | (Francis Grizzly Smit)++ | doc/Type/Int.pod6: Fixed a small bug in the doc |
23:07 | |
c: d51e018 | (Francis Grizzly Smit)++ | / (2 files): Merge branch 'master' of github.com:perl6/doc so that my small change to the docs can go through |
|||
seatek | well, coming from someone who got irritated by it, i'd say it's not worth it, now that i understand it. but if i didn't bother to understand it, i might be raving about how awful that was to be LIED to ;) | ||
but there's always RTFM | 23:08 | ||
and its in there | |||
TimToady | maybe it can serve as a shibboleth to weed out the rage quitters :) | ||
seatek | :) :) i like that. sure :) | 23:09 | |
23:09
cdg left
|
|||
TimToady | much like Camelia weeds out the anti-joy curmudgeons :) | 23:10 | |
skids | One of the other places we've seen complaints about this behavior is in layering subclass methods. | 23:22 | |
But the information IS available: | 23:23 | ||
m: sub f (|c ($i, Int $j?)) { |c.perl.say; c[0,1].perl.say; $i.perl.say }; f(1) | |||
camelia | rakudo-moar d8309d: OUTPUT«\(1)(1, Nil)1» | ||
skids | Just ugly to get at. | ||
So maybe syntactic relief for juggling Captures would help. | 23:24 | ||
...starting with a way to elide the |c in the signature just to get the full arglist, if we don't already have one. | 23:26 | ||
23:27
girafe left
|
|||
skids | |_ maybe. | 23:28 | |
But hopefully without any lexpad overhead. | 23:29 | ||
23:29
sufrostico joined
23:30
lizmat joined
|
|||
timotimo | oops, what a brilliant way to fail; the GOP website just posted a bunch of articles on line, starting with the "results of tonight's VP debate" | 23:33 | |
skids | lol. | ||
timotimo | another article starts with: Americans from all across the country tuned in to watch the one and only Vice Presidential debate. During the debate we helped fact check and monitor the conversation in real time @GOP. The consensus was clear after the dust settled, Mike Pence was the clear winner of the debate. | ||
it'd be fantastic if hillary's VP read those articles and had perfect preparation for what this pence person was supposed to bring to the table | 23:34 | ||
skids | Well, OK, no need to hold the debate then. | ||
timotimo | Mike Pence’s top moments from the debate: | 23:35 | |
Economy | |||
Highlighting Hillary’s scandals | |||
SmokeMachine____ | m: role A {method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {method a{say "B"; nextwith(:bla)}}; class C does B {}; C.a | ||
camelia | rakudo-moar d8309d: OUTPUT«B» | ||
timotimo | SmokeMachine____: i think the :$bla candidate isn't in the dispatcher when you "nextwith" | 23:36 | |
so you'd want to "callwith" instead | |||
SmokeMachine____ | m: role A {method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {method a{say "B"; callwith(:bla)}}; class C does B {}; C.a | ||
camelia | rakudo-moar d8309d: OUTPUT«B» | ||
SmokeMachine____ | timotimo: the same result... :( | 23:37 | |
timotimo | hm | ||
maybe it was another of those | |||
oh, you don't have a multi | |||
i thought you had a multi method there, but those are only methods | |||
23:38
shin_ joined
|
|||
SmokeMachine____ | with multi nextwith, callwith and samewith only call the A version... | 23:39 | |
23:39
BenGoldberg joined
|
|||
SmokeMachine____ | m: role A {multi method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {multi method a{say "B"; callwith(:bla)}}; class C does B {}; C.a | 23:39 | |
camelia | rakudo-moar d8309d: OUTPUT«A» | ||
SmokeMachine____ | m: role A {multi method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {multi method a{say "B"; nextwith(:bla)}}; class C does B {}; C.a | ||
camelia | rakudo-moar d8309d: OUTPUT«A» | ||
SmokeMachine____ | m: role A {multi method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {multi method a{say "B"; samewith(:bla)}}; class C does B {}; C.a | ||
camelia | rakudo-moar d8309d: OUTPUT«A» | ||
SmokeMachine____ | timotimo: ^^ | 23:40 | |
23:40
bjz joined
|
|||
skids | Optional nameds aren't considered in MMD, no? | 23:40 | |
timotimo | well, ideally you'd make :$bla! | ||
that's right | |||
SmokeMachine____ | m: role A {method a(:$bla){say "A"; say "bla" if $bla}}; role B does A {method a{say "B"; self.A::a(:bla)}}; class C does B {}; C.a | 23:41 | |
camelia | rakudo-moar d8309d: OUTPUT«BNo concretization found for A in any concretization at gen/moar/m-Metamodel.nqp line 3151 in any find_method_qualified at gen/moar/m-Metamodel.nqp line 1117 in method a at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
timotimo | interesting. so that only works with classes, not with roles? | ||
SmokeMachine____ | what means concretization? | 23:42 | |
timotimo | "more explicit selection" or something? | ||
SmokeMachine____ | timotimo: im not sure... | ||
skids | A class or punned class. | ||
SmokeMachine____ | thanks | 23:43 | |
is that right to that does not work? | 23:44 | ||
How could I do that work? | |||
skids | Do you need A's a to ave an optiona :bla or coud it be mandatory? | ||
23:45
skids left,
skids joined
|
|||
skids | Grr. something turned mouse gestures on. | 23:45 | |
23:45
lucasb_ joined,
BenGoldberg left
|
|||
SmokeMachine____ | I need to call B::a and it calls A::a with a argument (that argument is optional in A) | 23:46 | |
A is JSON::Class and :bla is :skip-null | |||
timotimo | you can try "role B is A" | ||
instead of "role B does A" | |||
SmokeMachine____ | I can't... A is JSON::Class... JSON::Class is a role... an I "is" a role? | 23:47 | |
timotimo | try it | ||
SmokeMachine____ | just worked! | 23:48 | |
m: role A {method a(:$bla){say "A"; say "bla" if $bla}}; role B is A {method a{say "B"; nextwith(:bla)}}; class C does B {}; C.a | |||
camelia | rakudo-moar d8309d: OUTPUT«BAbla» | ||
SmokeMachine____ | thank you guys! | ||
23:48
BenGoldberg joined
|
|||
timotimo | YW | 23:49 | |
23:49
vytas left
23:50
bjz left
|
|||
shin_ | Hi all... i have to solve a problem but i'm not sure how to build it with the perl6 primitives. | 23:54 | |
my %a = ('shell',True , 'weight',1 , 'origin','animal'); my %t = ('shell',False , 'weight',{ "some code that reduces the value by 5%" }); | 23:55 | ||
23:55
vytas joined
|
|||
shin_ | %a is a collection of `attributes`, %t does a `transformation` that modifies the `attributes` that are known to it (we can call this example, 'crack the egg'). | 23:55 | |
My objective is to build a class for applying the code in %t to values on %a | |||
in this case, %a-after-t = ('shell',False , 'weight',0.95 , 'origin','animal'); | 23:56 | ||
timotimo | so like { $_ * 0.95 } ? | ||
shin_ | the question: How should i model the *code* part? All code parts are meant to modify one and only one value, but can query other attributes? | ||
and, how could i persist such thing in a file to reuse later? | 23:57 | ||
lucasb_ | say { $_ * 5/100 }(10) | ||
timotimo | persisting code is a lot harder | ||
lucasb_ | what do you mean by persisting? isn't it just a matter of writing this rules in the form of code in a source file? :) | 23:59 | |
shin_ | should i create a SDL and a parser then? Also, the idea is also that the code inside any atribute can look 'outside', not to produce side effects, but to know other importat info to use in the transformation. |