»ö« 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. |
|||
Skarsnik | m: my uint32 $u32; $u32 = -4; say $u32; | 00:00 | |
camelia | rakudo-moar 6a8278: OUTPUT«4294967292» | ||
Skarsnik | m: my uint32 $u32 = 0; $u32 -= 5; say $u32; | ||
camelia | rakudo-moar 6a8278: OUTPUT«4294967291» | ||
Skarsnik | I think all intxx and uintxx are not equal on constraint | 00:01 | |
tbrowder | p6: my uint64 $n = 232; say sprintf "%0x", $n | ||
camelia | rakudo-moar 6a8278: OUTPUT«e8» | ||
Skarsnik | m: my uint64 $u64 = 0; $u64 -= 5; say $u64; | ||
camelia | rakudo-moar 6a8278: OUTPUT«-5» | ||
Skarsnik | probably a bug | ||
tbrowder | say UINT_MAX | ||
p6: say UINT_MAX | 00:02 | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: UINT_MAX used at line 1» | ||
tbrowder | p6: say UINT32_MAX | 00:03 | |
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: UINT32_MAX used at line 1» | ||
tbrowder | p6: my uint32 $n = 0xffffffffffffffff; say $n | 00:05 | |
camelia | rakudo-moar 6a8278: OUTPUT«4294967295» | ||
tbrowder | p6: my $uint32-max= 0xffffffffffffffff; my $x = -4; my $xuint = $uint32-max + $x + 1; say sprintf "%x", $xuint | 00:09 | |
camelia | rakudo-moar 6a8278: OUTPUT«fffffffffffffffc» | ||
tbrowder | okay, i think i may know how to do it | 00:10 | |
00:12
pierre_ joined,
MilkmanDan left
00:15
gfldex left
00:19
ItayAlmog left
|
|||
timotimo | oh hey Skarsnik | 00:21 | |
00:25
kurahaupo left
00:40
pierre_ left,
pierre_ joined,
pierre_ left
00:42
MilkmanDan joined
01:00
BenGoldberg joined
01:03
Skarsnik left
01:07
mempko left
01:08
johnjohn101 joined
01:12
MilkmanDan left
01:20
SmokeMachine____ joined
01:23
MilkmanDan joined,
mithaldu_ joined
01:24
Lucas_One joined
01:26
BuildTheRobots joined
01:28
pierre_ joined
01:29
kipd joined
01:33
olinkl joined
01:36
sufrostico left,
notbenh_ joined
01:37
AngeloMichael joined
01:39
pierre_ left
02:01
dj_goku left
02:12
zacts_pi joined,
zacts_pi is now known as zacts
02:14
pierre_ joined
02:45
zacts left,
noganex_ joined
02:49
noganex left
02:54
Ben_Goldberg joined
02:55
BenGoldberg left,
pierre_ left
03:23
dj_goku joined,
dj_goku left,
dj_goku joined
|
|||
skids | m: my $f = Channel.new; start { react { whenever $f { .say; $f.close; } }; "done".say }; sleep 1; $f.send(42); sleep 1;' | 03:34 | |
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in single quotes; couldn't find final "'" at <tmp>:1------> 3".say }; sleep 1; $f.send(42); sleep 1;'7⏏5<EOL> expecting any of: single quotes …» | ||
skids | m: my $f = Channel.new; start { react { whenever $f { .say; $f.close; } }; "done".say }; sleep 1; $f.send(42); sleep 1; | ||
camelia | rakudo-moar 6a8278: OUTPUT«42done» | ||
skids | m: my $f = Channel.new; my $g = Channel.new; start { react { whenever $f { .say; $g.close; }; whenever $g { .say } }; "done".say }; sleep 1; $f.send(42); $g.send(1); sleep 1; | ||
camelia | rakudo-moar 6a8278: OUTPUT«421» | ||
dj_goku | anyone else noticing a lot of fuzzy testing lately? | 03:46 | |
I think I have seen 3-4 posts on reddit/hacker news about people fuzzing an app or language. | 03:47 | ||
timotimo | hack.p6c.org/~timo/ :P | 03:48 | |
dj_goku | lol nice | 03:51 | |
timotimo: prior to the recent trend | 03:52 | ||
timotimo | oh, yes | ||
that's true | |||
dj_goku | timotimo: is there a reason this isn't done periodically? | ||
btw all I see is numbers not sure what it all means. | |||
timotimo | hehe | 03:53 | |
yeah, it doesn't mean terribly much | |||
if i really "meant it", i'd write a custom harness that makes it unnecessary to launch a full moar process for each single test case | |||
also, this fuzzing is only for loading (and other fuzzing runs for running) .moarvm files | 03:54 | ||
with a start-up time of about 0.1 seconds, it's kind of hard to fuzz rakudo with strings for programs | |||
though perhaps i'll give that a try some time :D | |||
dj_goku | :D | 03:56 | |
04:03
Xliff joined
|
|||
timotimo | here's something mildly interesting | 04:04 | |
bind_key is somewhat expensive during startup | |||
(from MVMHash) | 04:05 | ||
28 strings have more than 100 occurences during startup | |||
04:06
johnjohn101 left
|
|||
timotimo | the "long tail" after that is 5389 different strings | 04:06 | |
04:06
bjz_ left
|
|||
timotimo | 1778 of those only occur once | 04:06 | |
now, it doesn't seem like we're storing the hash code in a string object after calculating it | 04:07 | ||
04:08
bjz joined
|
|||
dj_goku | all greek to me. :D | 04:08 | |
04:08
Cabanossi left
|
|||
timotimo | oh, huh | 04:10 | |
04:10
Cabanossi joined
|
|||
timotimo | seems like perhaps we *are* using the cached hash code ... somehow | 04:11 | |
but we're not using the hash code for MVMHash ?!? | 04:12 | ||
04:23
khw left
04:25
DrForr_ joined
|
|||
timotimo | callgrind seems to think we spend most of our time allocating bits of memory through malloc, then deserialization (first place being serialization_read_int, second place being serialization_read_ref), then validating static frames, then binding data to hash keys, then doing running in the interpreter itself, then allocating stuff in the old generation, then allocating stuff in the garbage collector "in | 04:26 | |
general", then more validation of bytecode, then more deserialization | |||
but going by inclusive, the work_loop function (which is what does deserialization) really is a very expensive thing | 04:27 | ||
even though validate_static_frame is one of the more expensive functions "self"-wise, it's very low in the ranking when it comes to inclusive timings | 04:28 | ||
04:29
pierre_ joined
04:31
DrForr_ left
|
|||
MasterDuke | timotimo: have you ever re-run your coverage report? | 04:33 | |
04:34
bjz left
04:35
pierre_ left
04:39
mempko joined
|
|||
timotimo | not recently. i'm farther past bedtime than i've been in many, many weeks. remind me again after i've had some sleep? :) | 04:40 | |
04:41
darutoko joined
|
|||
MasterDuke | will do. and speaking of coverage and fuzzing and such, has anybody seen if coverity or pvs-studio will do a free analysis of MoarVM? they've done a bunch of other open-source stuff projects (e.g., WINE, Libre Office) | 04:42 | |
04:45
ufobat joined
04:46
cyphase left
04:51
cyphase joined
04:53
NlkIoUxhGD joined
04:58
setty1 joined
05:13
skids left
05:16
nadim joined
05:28
nadim left
05:30
NlkIoUxhGD left
05:36
firstdayonthejob joined
05:43
uDMCIOLLth joined
|
|||
timotimo | MasterDuke: irclog search reveals that we've had a few changes in moar due to coverity scans already | 06:01 | |
06:02
domidumont joined
|
|||
timotimo | moritz: requesting support for "literal" matches; i can't search for "coverity" in #perl6 | 06:02 | |
moritz: because it finds everything that has "cover" in it, apparently | |||
MasterDuke: github.com/MoarVM/MoarVM/commit/688eecdd22 - example | 06:03 | ||
06:06
domidumont left
06:07
domidumont joined
06:08
firstdayonthejob left
06:15
mempko left
|
|||
timotimo | .tell [ptc] were you the one who got coverity for moarvm? | 06:17 | |
yoleaux | timotimo: I'll pass your message to [ptc]. | ||
06:18
firstdayonthejob joined
|
|||
timotimo | MasterDuke: scan.coverity.com/projects/paultcochrane-moarvm | 06:20 | |
last analyzed was sep 02 2015, but i guess you can just hit the "add me to project" button if you want to put a new scan up, MasterDuke? | 06:21 | ||
06:24
CIAvash joined
06:28
wamba joined
06:33
rindolf joined
06:37
benjikins joined
06:40
krunen is now known as krunen_
06:44
nadim joined
|
|||
ufobat | what does the * in '... method new($x){ self.bless(*, :$x)} ...' mean? | 06:52 | |
timotimo | it means your code is out of date and needs you to remove the "*, " from it :) | ||
ufobat | and what did it mean? :) | 06:53 | |
benjikins | How do I check if a string contains any element in an array | ||
in the shortest possible way | |||
timotimo | it meant nothing | ||
ufobat | yay :D | ||
timotimo | benjikins: you can try $mystring.contains(any(@foobar)) | ||
benjikins | I didn't realize I could use any that way | ||
thank you | |||
timotimo | m: my @pieces = <hello world how are you>; say "oh well this is weird".contains(any(@pieces)) | ||
camelia | rakudo-moar 6a8278: OUTPUT«any(False, False, False, False, False)» | ||
timotimo | m: my @pieces = <hello world how are you>; say so "oh well this is weird".contains(any(@pieces)) | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
timotimo | m: my @pieces = <hello world how are you>; say so "oh well this is world".contains(any(@pieces)) | 06:54 | |
camelia | rakudo-moar 6a8278: OUTPUT«True» | ||
timotimo | m: my @pieces = <hello world how are you>; say "oh well this is world".contains(any(@pieces)) | ||
camelia | rakudo-moar 6a8278: OUTPUT«any(False, True, False, False, False)» | ||
timotimo | junctions are cool that way. | ||
06:58
aindilis joined
06:59
labster left
07:07
leont joined
07:10
[particle]1 joined
07:11
sQuEE joined,
aindilis` joined,
peteretep_ joined
07:12
Ulti_ joined
07:13
Jonis_ joined
07:14
nemo_ joined,
ranguard_ joined,
rudi_s_ joined,
bonsaikitten joined,
zoosha_ joined,
mr-fooba_ joined,
luis` joined,
El_Che_ joined,
erdic_ joined
07:15
ribasushi_ joined
07:16
xiaomiao left,
mr-foobar left,
nemo left,
ranguard left,
Ulti left,
faubi left,
aindilis left,
cgfbee left,
erdic left,
raydiak left,
bitmap_ joined,
erdic_ is now known as erdic
07:17
bitmap_ is now known as bitmap,
bhm left,
konobi left,
shadowpaste joined
07:18
raydiak joined,
peteretep_ is now known as peteretep,
bhm joined,
konobi joined
07:19
konobi is now known as Guest6604,
markk joined,
faubi joined,
cgfbee joined
07:21
sergot joined
07:22
Ben_Goldberg left,
RabidGravy joined
07:24
krunen joined
07:25
canopus left,
smls joined
|
|||
smls | m: say "aaa {("bbb" for ^3)} ccc" | 07:26 | |
yoleaux | 26 Aug 2016 21:58Z <tbrowder> smls: thanks! the "+$0" did the trick | ||
camelia | rakudo-moar 6a8278: OUTPUT«aaa bbb bbb bbb ccc» | ||
smls | m: say "aaa {"bbb" for ^3} ccc" | ||
camelia | rakudo-moar 6a8278: OUTPUT«Use of Nil in string context in block <unit> at <tmp> line 1aaa ccc» | ||
smls | ^^ Why does the for loop not return a value without parens there? | ||
07:27
ufobat left
|
|||
smls | m: say "aaa {"bbb" if 1} ccc" | 07:27 | |
camelia | rakudo-moar 6a8278: OUTPUT«aaa bbb ccc» | ||
smls | ^^ works for `if` but not `for` | ||
TimToady | loops at statementlist level are autosunk because people don't expect them to suddenly be lazy | 07:30 | |
yoleaux | 25 Aug 2016 11:10Z <ab6tract> TimToady: do you by any chance have the notes for your ballistic programming talk(s) online? | ||
smls | TimToady: Ah, so {} in strings is statement-list context like a sub | 07:31 | |
TimToady | m: say "aaa {do "bbb" for ^3} ccc" | ||
camelia | rakudo-moar 6a8278: OUTPUT«aaa bbb bbb bbb ccc» | ||
07:31
canopus joined
|
|||
TimToady | do also works | 07:32 | |
smls | oh, didn't know one could `do` a statement modifier | ||
TimToady | it's just a block, so there's a sequence of statements expected | ||
do is a statement prefix | |||
and modifier is part of a statement | |||
it actually parses do ("bbb" for ^3) | 07:33 | ||
07:39
leont left
|
|||
smls | TimToady: In the case of {} in strings, it wouldn't make the loop lazy though | 07:46 | |
07:47
labster joined
|
|||
smls | as it is immediately stringified | 07:47 | |
and I don't thing there's a use-case where you'd *want* to interpolate Nil into a string, as it just throws a warning | 07:48 | ||
07:55
edehont joined
07:58
benjikins left
07:59
gfldex joined
08:00
espadrine joined
08:03
xtt joined
08:04
nadim left
08:05
vendethiel left
08:07
leont joined
08:08
xtt left
|
|||
moritz | \o | 08:09 | |
timotimo | o/ moritz | ||
i highlighted you instead of .tell; is that okay? | |||
moritz | timotimo: it's OK; an issue on github.com/moritz/ilbot/issues would have been even better :-) | 08:11 | |
timotimo | ah, i didn't realize the ilbot repo would also be the right spot for the html pages | ||
smls | Does anyone know a "try Perl 6 online" thing that runs Perl 6.c? | ||
ideone.com runs ancient parrot-based rakudo | 08:12 | ||
timotimo | did you see the pull request MasterDuke made to your ilbot repo? | ||
moritz | timotimo: the problem is that the search index I use goes through a stemmer, so a substring search on unstemmed words isn't easily possible | ||
smls | dev.perltuts.com/try runs 2015.11 | ||
timotimo | there's the thing that perl6.party uses, but i forgot its name | ||
moritz | timotimo: I'd have to maintain a second search index | ||
timotimo: yes, github.com/moritz/ilbot/issues/47 has the discussion | 08:13 | ||
timotimo | i didn't see it | 08:14 | |
MasterDuke: seems like a simple fix ought to be possible to make that pull request mergable | |||
smls: glot.io/ - that one supports perl6 and has a new-ish version available | 08:15 | ||
smls | thanks | ||
timotimo | a 2016.04 moar rakudo | ||
08:20
edehont left
08:38
RabidGravy left
|
|||
Woodi | open source vs lawyers approach in Linux from yesterday: lists.linuxfoundation.org/pipermai...03580.html | 08:42 | |
08:42
mvorg joined
|
|||
Woodi | looks open source is a not bit like traditional academia :) | 08:43 | |
08:48
domidumont left
|
|||
Woodi | btw. SSE4.2 have "Four string/text processing instructions providin | 08:49 | |
...g a rich set of primitives" | |||
...for eg. XML parsing in few CPU instructions ? :) | 08:50 | ||
08:52
leont left
09:03
ufobat joined
09:11
ufobat left
09:25
kjs_ joined
09:30
dataangel left
09:32
pecastro joined
09:58
telex left
10:00
telex joined,
Ven joined
10:02
TEttinger left
10:29
rindolf left
10:33
pierre_ joined,
rindolf joined
10:34
labster left
10:41
mcmillhj joined
10:46
pierre_ left,
mcmillhj left
10:47
pierre_ joined
11:10
dalek left
11:11
dalek joined,
ChanServ sets mode: +v dalek
|
|||
timotimo | MasterDuke: the coverity scans are only up to date because i just submitted a new scan :) | 11:13 | |
MasterDuke | oh, ha | 11:14 | |
nice it was that easy | 11:15 | ||
timotimo | well, yeah. just had to ping [ptc] so he could add me to the project | 11:17 | |
11:18
kjs_ left
|
|||
MasterDuke | also, moritz++ cherry-picked the second commit in my ilbot PR. i'm still trying to find a better modification to the regex than my first commit that doesn't blow it up to an absurd size | 11:18 | |
11:20
espadrine left,
ufobat joined
|
|||
timotimo | [ptc]: did you realize that "ptc" could also be short for "pretty cool"? | 11:21 | |
[ptc] | timotimo: hehe :-) | 11:22 | |
yoleaux | 06:17Z <timotimo> [ptc]: were you the one who got coverity for moarvm? | ||
timotimo | %) | 11:23 | |
11:23
mcmillhj joined
11:24
iH2O joined
|
|||
MasterDuke | timotimo: since evidence suggests you're awake now, this is me reminding you to re-run your coverage report | 11:25 | |
timotimo | oh | ||
11:28
mcmillhj left
11:30
Ven left
11:40
nemo_ is now known as nemo
11:41
iH2O left
|
|||
domm | what would I use to get something like Term::ReadKey ReadMode 2 in Perl 6 (i.e. a prompt without echo, eg for passwords)? | 11:45 | |
oh, and greetings from the train from Budapest to Vienna | |||
mst | domm: this is probably not the right answer, but due to ReadKeybeing XS, when writing fatpackable code I just do system('stty -echo'); ... system('stty echo'); | 11:47 | |
so you can always stick that in with a '# blame mst' and replace it with the right answer when somebody provides it | |||
11:47
antipsychiatry joined
|
|||
gfldex | domm: see gist.github.com/gfldex/7d716436aa8...abd7106c3d | 11:48 | |
11:48
aries_liuxueyang left
|
|||
gfldex | mst: right answer ^^^ :) | 11:48 | |
mst | \o/ | 11:49 | |
11:49
antipsychiatry left,
kurahaupo joined,
mcmillhj joined
|
|||
gfldex | domm: please note that '/dev/tty' may prove difficult on windows | 11:49 | |
timotimo | gfldex: if you had a supply block there, you could have a phaser for when the supply gets closed, so that the "max" logic could wander into the whenever! :) | 11:50 | |
but the ENTER and LEAVE is nice, too | |||
domm | thx | ||
mst | wow but Term::termios has a bizarre calling convention | ||
domm | it's a private tool I use, so /dev/tty is no problem | ||
gfldex | mst: it surely does | 11:51 | |
it's a fairly thin layer on the c-stuff that shows its age | |||
mst | the C calling convention for getattr() and setattr() is not bizarre, just old-school C | 11:52 | |
I'm perfectly familiar with this | |||
timotimo | time to build Term::termios:api<2> :) | ||
mst | it's the way it's been translated that's making my eyes cross ;) | ||
gfldex | CLI::Promt::Password may actually what most ppl look for | 11:53 | |
11:54
mcmillhj left
11:55
smls left
|
|||
domm | I can try to implement CLI::Prompt::Password, but probably only next week (at Alpine Perl, with the help of Liz and nine) | 11:55 | |
11:57
kaare_ left
|
|||
mst | I'm guessing by the way gfldex said that that there is one somewhere? | 11:57 | |
gfldex | there is github.com/titsuki/p6-Terminal-Readsecret what comes with a dep. to readsecret. No idea if that is portable. | 11:59 | |
mst | ah, ok | 12:01 | |
domm | good enough for me for now | ||
12:03
Ven joined
|
|||
domm | another question: how can I convert a Buf (as returned by Digest::MD5.md5_buf) into an Int? | 12:05 | |
mst | can you not .Hex.Int it or something? | 12:07 | |
domm | reason: I calc a md5-sum (actually I'd prefer SHA1, but could not find it), convert the first few bytes to int, and seed the random number generator with that | ||
12:07
cpage_ joined
|
|||
domm | mst: I tried, but was offline and did not get any results | 12:07 | |
But not sure if i tried .Hex.Int | |||
mst | I may bbe imagining it | 12:08 | |
domm | Method 'Hex' not found for invocant of class 'Buf' | ||
mst | but it seems like you're trying to go buf -> hex -> int | ||
MasterDuke | the docs suggest 'use experimental :pack;' and then the unpack method | 12:09 | |
domm | .Int returns the number of bytes in the buffer | ||
MasterDuke: ok, thanks, I'll try that | |||
(as I said I was offline and could only grep the source/docs for stuff, and google > grep) | |||
nice, this works | 12:12 | ||
and it seems that my offline docs are rather old.. | |||
MasterDuke | the docs have seen a lot of action the last couple months: github.com/perl6/doc/graphs/commit-activity | 12:19 | |
12:26
jameslenz left,
ufobat left
12:28
jameslenz joined
|
|||
domm | use experimental :pack; use Digest::MD5; my $d = Digest::MD5.new; $d.md5_buf(<"The","European","Perl","Conference">).unpack("CCCCCC").reduce: * ~ * | 12:33 | |
not exactly what I'm doing, but it works - thanks! | 12:34 | ||
ah, and one last questions: how can do the folling Perl 5 code in 6 | 12:35 | ||
sub foo { say "foo" }; my $name = 'foo'; $foo->(); &$foo; | |||
ah, soory | 12:36 | ||
sub foo { say "foo" }; my $name = 'foo'; $name->(); &$name; | |||
12:37
mcmillhj joined
|
|||
domm | perl -E 'sub foo { say shift }; my $name = "foo"; $name->("A"); &$name("B")' | 12:37 | |
dalek | href="https://modules.perl6.org:">modules.perl6.org: 1d2db63 | (Tom Browder)++ | templates/root/index.html.ep: correct grammar |
12:40 | |
12:42
rudi_s_ is now known as rudi_s,
mcmillhj left
|
|||
dalek | rl6-most-wanted: 8501b88 | (Tom Browder)++ | most-wanted/modules.md: add new module WIP |
12:48 | |
rl6-most-wanted: 559712a | (Tom Browder)++ | most-wanted/modules.md: fix typo |
12:50 | ||
12:52
mra90 joined
12:53
mra90 left
|
|||
MasterDuke | m: class A { method foo { say "foo" } }; my $name = "foo"; A."$name"() | 12:57 | |
camelia | rakudo-moar 6a8278: OUTPUT«foo» | ||
MasterDuke | domm: ^^^ for methods at least | ||
13:01
wamba left
|
|||
tbrowder | ref modules: I've been trying to use Digest::xxHash, which uses naticecast, and see that somehow p6 translates uint64 into a bigint. how can we preserve the unsignedness in p6? | 13:02 | |
gfldex | m: sub foo(){ 'oi!' }; my $foo = '&foo'; say ::($foo).(); | 13:04 | |
camelia | rakudo-moar 6a8278: OUTPUT«oi!» | ||
gfldex | domm: ^^^ | ||
m: sub foo(){ 'oi!' }; my $foo = '&foo'; say ::($foo)(); | |||
camelia | rakudo-moar 6a8278: OUTPUT«oi!» | ||
MasterDuke | m: sub foo(){ 'oi!' }; my $foo = 'foo'; say ::("&$foo")(); | 13:06 | |
camelia | rakudo-moar 6a8278: OUTPUT«oi!» | ||
MasterDuke | tbrowder: there are a couple tickets (e.g., RT #124294, RT #127210, RT #127144) about uint types, it looks like they aren't quite working as people expect | 13:12 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=124294 | ||
Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127210 | |||
Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127144 | |||
masak | hi, #perl6 | 13:13 | |
domm | gfldex: thanks, again | 13:22 | |
pierre_ | m: say "Bonjour!" | 13:30 | |
camelia | rakudo-moar 6a8278: OUTPUT«Bonjour!» | ||
pierre_ | i have a small misunderstanding with defined | 13:31 | |
and Nil, or any | |||
m: say Nil.defined | |||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
pierre_ | Nil is not defined, which is expected | ||
however, if i use Nil as a key in a hash, and then | |||
let me show | |||
13:31
MilkmanDan left
13:32
MilkmanDan joined,
Ven left
|
|||
pierre_ | m: my %h = Nil => 'should not be defined'; for %h.kv -> $k, $v { say $k;say $k.defined; } | 13:32 | |
camelia | rakudo-moar 6a8278: OUTPUT«NilTrue» | ||
pierre_ | is that normal ? | ||
gfldex | pierre_: Nil is not _the_ undefined value. Using Nil by hand will almost always result in bugs. | ||
see: docs.perl6.org/type/Nil and docs.perl6.org/language/typesystem...efinedness | 13:33 | ||
pierre_ | yes,, i do not plan to use Nil | ||
it's for a test case | |||
13:33
wphtech joined
|
|||
jnthn | I think the confusion here though is that some-identifier => blah will auto-quote the left hand side as a string | 13:33 | |
m: say (Nil => 'what').perl | |||
camelia | rakudo-moar 6a8278: OUTPUT«:Nil("what")» | ||
pierre_ | i have a function, that i want to test against several values | ||
gfldex | my %h = Nil => 'should not be defined'; dd %h; | 13:34 | |
jnthn | m: say (Nil => 'what').key.WHAT | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Str)» | ||
gfldex | m: my %h = Nil => 'should not be defined'; dd %h; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Hash %h = {:Nil("should not be defined")}» | ||
pierre_ | oh, :) | ||
make sense | |||
gfldex | m: my %h{Any} = Nil => 'should not be defined'; dd %h; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Hash[Any,Any] %h = (my Any %{Any} = :Nil("should not be defined"))» | ||
pierre_ | so if i want to store | ||
13:34
wphtech left
|
|||
gfldex | m: my %h{Any}; %h{Nil}= 'should not be defined'; dd %h; | 13:35 | |
camelia | rakudo-moar 6a8278: OUTPUT«Hash[Any,Any] %h = (my Any %{Any} = (Nil) => "should not be defined")» | ||
gfldex | m: my %h{Any}; %h{Nil}= 'should not be defined'; %h.keys.say | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Nil)» | ||
gfldex | m: my %h{Any}; %h{Nil}= 'should not be defined'; %h.keys.put | ||
camelia | rakudo-moar 6a8278: OUTPUT«Use of Nil in string context in block <unit> at <tmp> line 1» | ||
pierre_ | right | ||
pair is auto quoting | |||
just for the context, here is what i wanted to do | 13:36 | ||
m: sub f( Any $obj) { return 'undef' unless $obj.defined; return 'true' if $obj == True; return 'false';} ; my %h = True => 'true', False => 'false', Nil => 'undef'; | 13:38 | ||
camelia | ( no output ) | ||
pierre_ | and use %h to run my tests, by adding entries there | 13:39 | |
13:41
TheGrimFandango joined
|
|||
TheGrimFandango | hi | 13:41 | |
pierre_ | i will then use an array and take element 2 by 2 | ||
m: my @a = Nil, 'should be undef'; for @a -> $k, $v { say $k.defined } | 13:42 | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
pierre_ | Hi | ||
gfldex | if you want to hand Nil around like that you will have to use binding | ||
pierre_ | really, it's just in one test case | 13:43 | |
ok, i think the correct solution | |||
i'll wirte a separate test for Nil :) | |||
gfldex | m: my Int $i is default(1); say $i; $i = Nil; say $i.defined; | ||
camelia | rakudo-moar 6a8278: OUTPUT«1True» | ||
pierre_ | and not use a hash | ||
actually, in my test, i'm using Any, not Nil | 13:44 | ||
but should be the same, no? | |||
gfldex | not at all | ||
pierre_ | just to check defineness | ||
not to use it | |||
gfldex | you can use Mu if you need to differentiate between Any and "some undefined value" | 13:45 | |
13:45
bonsaikitten is now known as DrEeevil
|
|||
pierre_ | m: my $undef; my %h = $undef => 'not defined'; for %h.kv -> $k, $v { say $k.defined } | 13:45 | |
camelia | rakudo-moar 6a8278: OUTPUT«Use of uninitialized value of type Any in string context.Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful. in block <unit> at <tmp> line 1True» | ||
MasterDuke | timotimo: btw, wasn't there some functionality missing in parse_coverage_report.p6 that i said i'd add? | 13:46 | |
13:52
araujo_ joined
13:55
araujo left
|
|||
tbrowder | .tell MasterDuke thanks! | 13:55 | |
yoleaux | tbrowder: I'll pass your message to MasterDuke. | ||
14:03
araujo__ joined
14:05
buggable joined
14:06
araujo_ left
14:07
skink joined
14:10
skids joined
|
|||
tbrowder | jnthn: any plans to work on uint64 issues in near future? | 14:12 | |
m: my $undef; say $undef.defined | 14:24 | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
tbrowder | m: my $u = 1; say $u; $ | 14:25 | |
camelia | rakudo-moar 6a8278: OUTPUT«WARNINGS for <tmp>:Useless use of unnamed $ variable in sink context (line 1)1» | ||
tbrowder | m: my $u = 1; say $u; $u = Nil; say $u | 14:26 | |
camelia | rakudo-moar 6a8278: OUTPUT«1(Any)» | ||
tbrowder | m: my $u = 1; $u = Mu; say $u | 14:28 | |
camelia | rakudo-moar 6a8278: OUTPUT«(Mu)» | ||
tbrowder | m: my $u = Mu; say $u.defined | 14:29 | |
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
tbrowder | m: my $u = Any; say $u.defined | 14:30 | |
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
mr-fooba_ | is there any guide to get started with perl6 on js ? | ||
14:32
RabidGravy joined
|
|||
tbrowder | m: my $u = Nil; say $u.defined | 14:33 | |
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
tbrowder | so it looks to me that one can set a previously defined var to Mu, Any, or Nil to undefine it, no? | 14:34 | |
14:34
espadrine joined
|
|||
moritz | not really | 14:35 | |
m: my Int $x = 42; $x = Any | |||
camelia | rakudo-moar 6a8278: OUTPUT«Type check failed in assignment to $x; expected Int but got Any (Any) in block <unit> at <tmp> line 1» | ||
moritz | m: my Int $x = 42; $x = Nil; say $x.perl | ||
camelia | rakudo-moar 6a8278: OUTPUT«Int» | ||
tbrowder | m: my $u = 1; $u = Nil | 14:37 | |
camelia | ( no output ) | ||
ugexe | ... | ||
m: say Nil ~~ Any | 14:38 | ||
camelia | rakudo-moar 6a8278: OUTPUT«True» | ||
tbrowder | m: my $u = 6; say $u.defined; $u = Nil; say $u.defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«TrueFalse» | ||
tbrowder | it looks like, if one doesn't explicitly type a defined var, then assigning Nil to it undefines it | 14:39 | |
ugexe | or stores the value which may or may not be undefined | 14:40 | |
tbrowder | ?? | 14:41 | |
geekosaur | I think they dropped a word. Nil stores the default value | ||
m: my Int $v is default(6); $v = 10; say $v; $v = Nil; $v.say | 14:42 | ||
camelia | rakudo-moar 6a8278: OUTPUT«106» | ||
tbrowder | i'm just interested in ensuring a previously defined var can be forced to become undefined | ||
is there a best-practice way to do that? | 14:43 | ||
geekosaur | m: my Int $v is default(6); $v = 10; say $v; $v = Int; say $v.defined | 14:44 | |
camelia | rakudo-moar 6a8278: OUTPUT«10False» | ||
tbrowder | m: my $u = 4; if $u say 'def'; $u = Nil; if !$u say 'undef or false' | 14:46 | |
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Missing blockat <tmp>:1------> 3my $u = 4; if $u7⏏5 say 'def'; $u = Nil; if !$u say 'undef  expecting any of: block or pointy block infix infix stopper» | ||
ugexe | my $x is default(1); say $x; $x = Nil:U; say $x.defined; say $x.WHAT | ||
m: my $x is default(1); say $x; $x = Nil:U; say $x.defined; say $x.WHAT | |||
camelia | rakudo-moar 6a8278: OUTPUT«1FalseNil» | ||
ugexe | gets around Nil setting default value of 1 which would be defined | 14:47 | |
14:48
mcmillhj joined
|
|||
tbrowder | i don't see a practical difference for my typical use case | 14:49 | |
let me try the last case again co | |||
ugexe | if you want to ignore `is default` and any 3rd party who may set that trait, then no there is no difference | 14:51 | |
tbrowder | m: my $x = 't'; say $x; say 'true' if defined $x | ||
camelia | rakudo-moar 6a8278: OUTPUT«ttrue» | ||
tbrowder | okay, thanks, i guess i just don't understand meta programming!! | 14:52 | |
geekosaur | um | ||
are you confusing/conflating defined with existence? | |||
(because I see no metaprogramming here) | 14:53 | ||
tbrowder | too deep for my simple needs | ||
14:53
mcmillhj left
14:56
pecastro left
15:07
mcmillhj joined,
pecastro joined
|
|||
pierre_ | m: Blob.new( 65535.base(16).comb(2).map( {:16($_)} ) ).say | 15:10 | |
camelia | rakudo-moar 6a8278: OUTPUT«Blob:0x<ff ff>» | ||
pierre_ | any shortcut to go from 65535 to Blob 0x<ff ff> | ||
my solution looks a bit too much :) | 15:11 | ||
15:12
mcmillhj left
15:15
khw joined
15:16
zacts joined
15:17
mcmillhj joined
|
|||
pierre_ | Blob.new( 65535 ) | 15:25 | |
m: Blob.new( 65535 ) | |||
camelia | ( no output ) | ||
pierre_ | m: Blob.new( 65535 ).say | ||
camelia | rakudo-moar 6a8278: OUTPUT«Blob:0x<ff>» | ||
ugexe | m: say Blob.new(65535 xx 2) | 15:30 | |
camelia | rakudo-moar 6a8278: OUTPUT«Blob:0x<ff ff>» | ||
pierre_ | and my solution is broken on top of that | ||
m: 65539.base(16).comb(2) | |||
camelia | ( no output ) | ||
pierre_ | m: 65539.base(16).comb(2).say | ||
camelia | rakudo-moar 6a8278: OUTPUT«(10 00 3)» | ||
pierre_ | hum, interesting, with xx | ||
geekosaur | that doesn't actually work | 15:31 | |
it's truncating the top byte of 65535 to get 255 and putting that in the Buf | |||
pierre_ | oh right :) | ||
it's doing Blob.new( 65535, 65535) | 15:32 | ||
15:32
rudolfochrist joined
15:34
mcmillhj left
15:35
cyphase left
15:39
cyphase joined
|
|||
pierre_ | m: pack 'n', 65535 | 15:41 | |
camelia | rakudo-moar 6a8278: OUTPUT«Use of the 'pack' function is experimental; please 'use experimental :pack' in block <unit> at <tmp> line 1» | ||
15:42
mcmillhj joined
|
|||
pierre_ | m: 'use experimental :pack; pack('n', 65535).say | 15:42 | |
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3'use experimental :pack; pack('7⏏5n', 65535).say expecting any of: infix infix stopper statement end statement m…» | ||
pierre_ | m: use experimental :pack; pack( 'n', 65535 ).say | 15:44 | |
camelia | rakudo-moar 6a8278: OUTPUT«Buf:0x<ff ff>» | ||
pierre_ | experimental, but that would work | ||
15:45
wamba joined
15:46
pecastro left
15:47
mcmillhj left,
ufobat joined
|
|||
zacts | hi perl6 nerds | 15:54 | |
grondilu | pack is one of the first function I've delved deeply into while learning perl. I'm surprised it's experimental in Perl 6. | ||