»ö« 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:22
perlnewbee joined
|
|||
perlnewbee | hello :) | 00:23 | |
i want to write a parser for some markup language i defined, and i want to try grammars for this. But i dont want to install perl6 in my production env. Can i compile this later to an executable binary? | 00:24 | ||
timotimo | there's different ways to get a perl6 program deployed | 00:33 | |
one of which is docker, another is making an installer for windows that contains a custom-compiled rakudo in it | |||
but creating a single executable file from a program isn't yet a thing we have, sadly | |||
perlnewbee | oh, ok. Thanks :) | 00:34 | |
00:35
test2 joined
00:37
mr_ron left
00:42
zachk left
00:44
mr_ron joined
00:45
test2 left
|
|||
MasterDuke | hm, can't you use flatpack or appimage (i forget which one samcv got working) for that? | 00:47 | |
timotimo | we do have an appimage of rakudo itself, i think maybe even rakudo star including dependencies? maybe you can use that for a full program | 00:51 | |
00:52
Kaiepi left
|
|||
buggable | New CPAN upload: Font-FreeType-0.0.8.tar.gz by WARRINGD modules.perl6.org/dist/Font::FreeTy...n:WARRINGD | 00:56 | |
01:08
mcmillhj joined
01:20
mcmillhj left
01:23
espadrine left
01:29
comborico1611 left
01:31
Herby_ left
01:32
BenGoldberg joined
01:41
FROGGS_ joined
01:44
FROGGS left
01:49
ilbot3 left
01:56
ilbot3 joined,
ChanServ sets mode: +v ilbot3
01:57
mcmillhj joined
02:01
mr_ron left
02:03
Kaiepi joined
02:08
mcmillhj left
|
|||
Geth | doc: 4f3459fcf6 | 陈梓立++ (committed using GitHub Web editor) | doc/Language/variables.pod6 Fix broken link No very sure if it works. Co #1972. If works, close this issue. |
02:18 | |
synopsebot | Link: doc.perl6.org/language/variables | ||
02:50
mr_ron joined
02:52
Herby_ joined
02:54
mr_ron left
|
|||
Geth | doc: coke self-assigned /tmp files don't get cleaned up properly github.com/perl6/doc/issues/1973 101a710ccb | 陈梓立++ (committed using GitHub Web editor) | README.zh.md |
02:58 | |
03:03
comborico1611 joined
|
|||
comborico1611 | M: if 'ac' ~~ m/ a.c / { say "Match";} | 03:03 | |
m: if 'ac' ~~ m/ a.c / { say "Match";} | 03:04 | ||
camelia | ( no output ) | ||
comborico1611 | m: if 'ac' ~~ m/ a?c / { say "Match"; } | 03:06 | |
camelia | Match | ||
comborico1611 | m: if 'c' ~~ m/ a?c / { say "Match"; } | 03:07 | |
camelia | Match | ||
comborico1611 | m: if 'c' ~~ / a?c / { say "Match"; } | 03:11 | |
camelia | Match | ||
comborico1611 | m: if 'aaz' ~~ m/ a*z / { say "Match"; } | 03:16 | |
camelia | Match | ||
comborico1611 | m: if 'z' ~~ m/ a*z / { say "Match"; } | ||
camelia | Match | ||
comborico1611 | m: if 'azzz' ~~ m/ a*z / { say "Match"; } | 03:17 | |
camelia | Match | ||
comborico1611 | m: if 'z' ~~ m/ a+z / { say "Match"; } | 03:19 | |
camelia | ( no output ) | ||
Geth | doc: 65f77f515a | (Zoffix Znet)++ | app.pl Make dev app clean up its temp files |
03:20 | |
comborico1611 | m: if 'Rakudo is a Perl 6 compiler' ~~ m/:s Perl 6/ {say "The matching string starts at position: " ~ $/.from} | 03:21 | |
camelia | The matching string starts at position: 12 | ||
Geth | doc: f437917457 | 陈梓立++ (committed using GitHub Web editor) | doc/Language/variables.pod6 Fix link |
03:22 | |
synopsebot | Link: doc.perl6.org/language/variables | ||
03:23
ryn1x joined
|
|||
tobs | m: .polymod(2, 4, 8 ... *).say for 1, 2, 4 ... 16 | 03:26 | |
camelia | (1) (0 1) (0 2) (0 0 1) (0 0 2) |
||
tobs | I hoped this would give me the popcount, but why doesn't it work on 4 and 16? | ||
Actually, I just want to know reliably if an integer is a power of 2. | 03:27 | ||
03:43
Zoffix joined
|
|||
Zoffix | tobs: is log too flimsy? | 03:43 | |
m: say (2¹⁰⁰).log: 2 | |||
camelia | 100 | ||
Zoffix | m: say (2¹⁰⁰+1).log: 2 | ||
camelia | 100 | ||
Zoffix | I guess that answers that... | ||
The 8 and 16 polymoded with divisor 8, don't they? (0 0 1)(0 0 2) | 03:45 | ||
tobs | Zoffix: I just read the code of Int.polymod and now the results make sense to me | 03:48 | |
03:48
comborico1611 left
|
|||
Zoffix | m: sub pow2 { not $^x +& ($x - 1) }; say pow2 2¹⁰⁰ | 03:51 | |
camelia | True | ||
Zoffix | m: sub pow2 { not $^x +& ($x - 1) }; say pow2 2¹⁰⁰+1 | ||
camelia | False | ||
03:51
BenGoldberg left
|
|||
Zoffix | Neat. | 03:52 | |
TEttinger | m: sub pow2 {$x.lsb == $x}; say pow2 2¹⁰⁰ | 03:53 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$x' is not declared at <tmp>:1 ------> 3sub pow2 {7⏏5$x.lsb == $x}; say pow2 2¹⁰⁰ |
||
TEttinger | m: sub pow2 { $^x.lsb == $x}; say pow2 2¹⁰⁰ | ||
camelia | False | ||
Zoffix | Any power of two is 1 followed by zeros and it minus 1 is 01111111…, so anding that gives zero for powers of 2 | ||
TIL | |||
TEttinger | m: sub pow2 { $^x.lsb }; say pow2 2¹⁰⁰ | 03:54 | |
camelia | 100 | ||
TEttinger | ohhh | ||
m: sub pow2 { $^x ^ $x.lsb == $x }; say pow2 2¹⁰⁰ | 03:55 | ||
camelia | one(True, False) | ||
Zoffix | m: sub pow2 { $^x +^ $x.lsb == $x }; say pow2 2¹⁰⁰ | ||
camelia | False | ||
TEttinger | hm | ||
exponent op is? | |||
Zoffix | ^ is junction +^ is bit op | ||
Oh, that's ** | |||
m: sub pow2 { $^x ** $x.lsb == $x }; say pow2 2¹⁰⁰ | |||
camelia | False | ||
TEttinger | oh heh, nvm | ||
Zoffix | m: sub pow2 { $^x ** $x.lsb }; say pow2 2¹⁰⁰ | 03:56 | |
camelia | 19950631168807583848837421626835850838234968318861924548520089498529438830221946631919961684036194597899331129423209124271556491349413781117593785932096323957855730046793794526765246551266059895520550086918193311542508608460618104685509074866089624888… | ||
TEttinger | m: sub pow2 { 2 $^x.lsb == $x }; say pow2 2¹⁰⁰ | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3sub pow2 { 27⏏5 $^x.lsb == $x }; say pow2 2¹⁰⁰ expecting any of: infix infix stopper statement end sta… |
||
Zoffix | ah | ||
TEttinger | m: sub pow2 { 2 **$^x.lsb == $x }; say pow2 2¹⁰⁰ | ||
camelia | True | ||
Zoffix | \o// | ||
TEttinger | m: sub pow2 { 2 **$^x.lsb == $x }; say pow2 2¹⁰⁰ + 1 | ||
camelia | False | ||
TEttinger | hooray | ||
hooray for lsb | |||
Zoffix | m: my $p = 2¹⁰⁰; sub pow2 { 2 **$^x.lsb == $x }; { for ^1000_000 { my $ = pow2 $p }; say now - ENTER now } | 03:57 | |
camelia | (timeout) | ||
Zoffix | m: my $p = 2¹⁰⁰; sub pow2 { 2 **$^x.lsb == $x }; { for ^1000 { my $ = pow2 $p }; say now - ENTER now } | ||
camelia | 0.0476687 | ||
Zoffix | m: my $p = 2¹⁰⁰; sub pow2 { 2 **$^x.lsb == $x }; { for ^50000 { my $ = pow2 $p }; say now - ENTER now } | 03:58 | |
camelia | 1.48259542 | ||
Zoffix | m: my $p = 2¹⁰⁰; sub pow2 { not $^x +& ($x - 1) }; { for ^50000 { my $ = pow2 $p }; say now - ENTER now } | ||
camelia | 0.0874599 | ||
Zoffix | :) anding's faster :) | ||
tobs | oh, thanks TEttinger++ and Zoffix++. I was still busy .map'ing sequences to get my popcount. | 03:59 | |
TEttinger | I wonder if there's a popcount built in | ||
04:00
Tison joined
|
|||
Zoffix | is this it? en.wikipedia.org/wiki/Hamming_weight | 04:00 | |
Tison | good noon! | 04:01 | |
Zoffix | \o | ||
tobs | Zoffix: if you have a list of bits, yes | ||
TEttinger | rosettacode.org/wiki/Population_count#Perl_6 | ||
hmmm | |||
tobs | m: sub pow2 (Int $n) { so (2, 4, 8 ...^ * >= $n).map(* Rmod $n).all == 0 } ; { for ^1000 { my $ = pow2 $p }; say now - ENTER now } # assuming it's correct | 04:02 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$p' is not declared at <tmp>:1 ------> 3.all == 0 } ; { for ^1000 { my $ = pow2 7⏏5$p }; say now - ENTER now } # assuming i |
||
Zoffix | that shit's over my head | ||
tobs | m: my $p = 2**100; sub pow2 (Int $n) { so (2, 4, 8 ...^ * >= $n).map(* Rmod $n).all == 0 } ; { for ^1000 { my $ = pow2 $p }; say now - ENTER now } # assuming it's correct | 04:03 | |
camelia | 5.3492947 | ||
Zoffix | m: say +StrDistance.new(:before('0' x .chars), :after($_)) with 2¹⁰⁰.base: 2 | 04:04 | |
camelia | 1 | ||
Zoffix | m: say +StrDistance.new(:before('0' x .chars), :after($_)) with (2¹⁰⁰+1).base: 2 | 04:05 | |
camelia | 2 | ||
Zoffix | m: say +StrDistance.new(:before('0' x .chars), :after($_)) with (2¹⁰⁰-1).base: 2 | ||
camelia | 100 | ||
Zoffix | ¯\_(ツ)_/¯ | ||
tobs | well, now I have at least 3 ways to do it which shorter than mine. Mission accomplished \o/ | 04:06 | |
04:09
Zoffix left
|
|||
tobs | m: sub pow2 ($n) { .elems == 1 with $n.base(2) ~~ m:g/1/ }; say pow2($_) for ^10; | 04:10 | |
camelia | False True True False True False False False True False |
||
Geth | perl6-pod-to-bigpage: 9fe402be40 | 陈梓立++ (committed using GitHub Web editor) | lib/Pod/To/BigPage.pm6 Fix over escape though there is remaining issue of X<> tags |
04:13 | |
perl6-pod-to-bigpage: 4518ca3599 | 陈梓立++ (committed using GitHub Web editor) | META6.json Bump version |
|||
doc: 1bc12e6ec7 | 陈梓立++ (committed using GitHub Web editor) | util/trigger-rebuild.txt Update trigger-rebuild.txt |
04:14 | ||
Tison | .ask AlexDaniel how can I figure out which libs depend on a special lib? say for URI, Pod::To::HTML depends on URI | 04:18 | |
yoleaux | Tison: I'll pass your message to AlexDaniel. | ||
04:22
Herby_ left
|
|||
Tison | The problem I works on is, Pod::To::BigPage does not support X<> tags well, it just renders a strange list in sidebar, with all <a> links fail. I'd like to clear its logic, but afraid making some damaging changes. | 04:23 | |
04:29
khw left
|
|||
Tison | .ask [Coke] could you please take a look at this build fail on doc? I just trigger rebuild and it fails unexpectedly. | 04:30 | |
yoleaux | Tison: I'll pass your message to [Coke]. | ||
Tison | travis-ci.org/perl6/doc/builds/372...tification | ||
buggable | [travis build above] ☠ Did not recognize some failures. Check results manually. | ||
tobs | my subconscious came up with how I should have used polymod: | 04:45 | |
m: say .polymod(2 xx *).sum == 1 for ^10 | |||
camelia | False True True False True False False False True False |
||
04:50
thowe left
|
|||
buggable | New CPAN upload: HTTP-Tinyish-0.1.1.tar.gz by SKAJI modules.perl6.org/dist/HTTP::Tinyish:cpan:SKAJI | 04:56 | |
04:58
ryn1x left
05:29
sauvin left
05:31
sauvin joined
05:39
perlnewbee left
05:48
eliasr left
05:49
espadrine joined
06:02
kurahaupo left,
kurahaupo joined
06:10
ufobat joined
06:21
jmerelo joined
|
|||
Geth | doc/car-grant-midrat: fd50cdfe77 | (Zoffix Znet)++ | doc/Type/Str.pod6 [CaR Grant] Document Str.Rat |
06:40 | |
ufobat | jmerelo, docs.perl6.org/type/Buf#method_subbuf-rw doesn't mention what $length is, if it isn't provided. if means that you replace everything till the end. but one could think that you just change the abount of data you're acctually providing | 06:44 | |
like $large-buf.subbuf-rw(10) = Buf.new(10,11) # whoul'd set the $lange-buf to 12 bytes | 06:46 | ||
where is the documentation on github? | 06:48 | ||
Geth | doc: 5076e57b99 | (JJ Merelo)++ | htmlify.p6 Eliminates Any and Mu from pages Leaving Cool, which is not common for all pages, and Exception, which is the mother of all X::*. Closes #1916. |
06:54 | |
jmerelo | ufobat: let me check | ||
ufobat: right here github.com/perl6/doc/blob/master/d...f.pod6#L16 | 06:55 | ||
ufobat: it does say "C<$length> specifies how many elements are to be replaced". Is that what you mean? | 06:56 | ||
07:04
kurahaupo_ joined,
kurahaupo left
|
|||
Geth | doc/car-grant-midrat: cf74874249 | (Zoffix Znet)++ | doc/Language/numerics.pod6 [CaR Grant] Document the rest of primary numerics |
07:11 | |
07:11
Tison left
|
|||
Geth | doc: cbc50baf02 | (JJ Merelo)++ | 16 files Renames test files to give them a logical order Closes #1966. It might also help #1951. Or at least help debug it. |
07:26 | |
ufobat | jmerelo, aye, but $length is optional, what if you leave it out | 07:29 | |
jmerelo | ufobat: OK, right. Does not say anything about that. Can you please create an issue for that? | 07:30 | |
ufobat | do you replace from $start to $end or do you replace just n bytes if you say .subbuf-rw($start) = $buf-with-n-elems | ||
of course :) | 07:31 | ||
07:31
kurahaupo_ left
07:32
kurahaupo joined
|
|||
jmerelo | ufobat: no idea right now. Would have to check code from roast, probably. Thanks! | 07:32 | |
ufobat | jup it replaces everthing: github.com/rakudo/rakudo/blob/mast...f.pm6#L650 | 07:33 | |
issue created | 07:35 | ||
jmerelo | ufobat: thanks! | 07:39 | |
ufobat | thanks as well :-) | 07:40 | |
Geth | perl6-pod-to-bigpage: e57f16207d | (JJ Merelo)++ | t/P.t Fixes test |
07:44 | |
doc: 025f28b5d5 | (JJ Merelo)++ | htmlify.p6 Eliminates debug code |
07:45 | ||
jmerelo | As a consequence of eliminating Any and Mu from all type pages, testing is now between 2 and 4 minutes faster... The docker test is now down to ~8 minutes | 07:48 | |
Also, now tests have some kind of "logical" order. They should fail faster, since most frequent errors are in front. | 07:49 | ||
07:51
DataLinkDroid joined,
rindolf joined
07:54
wamba joined
|
|||
Geth | doc/car-grant-midrat: fd0161a2f4 | (JJ Merelo)++ | doc/Language/numerics.pod6 Fixes pod |
07:55 | |
doc: 7942e679bd | (Zoffix Znet)++ (committed using GitHub Web editor) | util/trigger-rebuild.txt Update trigger-rebuild.txt |
07:57 | ||
jmerelo | 1000 closed issues already in perl6/doc github.com/perl6/doc/issues?q=is%3...s%3Aclosed | 07:59 | |
07:59
darutoko joined
08:05
sjoshi joined
08:08
sjoshi left
08:11
domidumont joined
08:14
sjoshi joined
08:15
sjoshi left
08:17
domidumont left,
domidumont joined
08:18
TEttinger left
|
|||
Geth | doc: Kaiepi++ created pull request #1975: Add Node.js to Perl 6 nutshell page |
08:23 | |
jmerelo | .seen nkh | 08:31 | |
yoleaux | I haven't seen nkh around. | ||
jmerelo | Data::Dump::Tree seems kind of abandoned... github.com/nkh/P6-Data-Dump-Tree | 08:39 | |
09:05
athenot joined
09:09
athenot_ joined
09:10
athenot left
09:21
Zartant joined,
irco joined,
Zartant left,
athenot_ left
09:46
Kaiepi left
|
|||
jmerelo | Apparently, new JS is getting the // and ==> operators from Perl 6... medium.freecodecamp.org/here-are-t...7bce1bfb0b | 09:57 | |
squashable6: status | 10:05 | ||
squashable6 | jmerelo, ⚠🍕 Next SQUASHathon in 4 days and ≈23 hours (2018-05-05 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day | ||
Geth | doc: 25d32fe58f | (Elizabeth Mattijsen)++ | doc/Language/5to6-perlfunc.pod6 Add mention of P5 functions added by P5opendir |
10:09 | |
synopsebot | Link: doc.perl6.org/language/5to6-perlfunc | ||
buggable | New CPAN upload: P5built-ins-0.0.11.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/....11.tar.gz | 10:16 | |
10:18
Kaiepi joined
|
|||
buggable | New CPAN upload: P5opendir-0.0.2.tar.gz by ELIZABETH modules.perl6.org/dist/P5opendir:cpan:ELIZABETH | 10:36 | |
jmerelo | Initial analysis on the Perl 6 documentarion repository www.researchgate.net/publication/3...icationCTA | 10:40 | |
Apart from the curious power-law behavior in issue solution time, it's got nice and colorful charts. Also it's allowed me to create some report-generation and statistical analysis tools, all of them in Perl 6 | 10:42 | ||
If you'd like to see more metrics done, well, raise an issue :-) It's open science, so pull requests are admitted and encouraged. | 10:43 | ||
ufobat | how could i create a $float if i just have the bits? | ||
jmerelo | Maybe the best take-home message is that 50% of the issues are solved in 1 day, but a quarter of them take more than 16 days to process | 10:44 | |
ufobat: bits in IEEE754 representation? | |||
ufobat | yes | ||
jmerelo | ufobat: maybe through a Buf? Let me see... | 10:45 | |
(meanwhile, posting it in StackOverflow will also get a number of high-quality responses... :-) ) | |||
ufobat | with unpack() maybe, but that's experimental | 10:46 | |
jmerelo | ufobat: right. And buf is only for strings, apparently... | ||
pack seems to be only for integers... | 10:47 | ||
ufobat: maybe stuff it into some Native data structure? | |||
ufobat: right, that might be it... | 10:48 | ||
ufobat | how does this work? | ||
jmerelo | jmerelo: trying to find the way... | 10:49 | |
ufobat: right, something like this stackoverflow.com/questions/263102...ting-point | |||
using the NativeCall API in Perl 6. | |||
ufobat | i was looking through lizmat modules.perl6.org/dist/P5pack:cpan:...P5pack.pm6 but apparently it doesn't implement 'f' and 'd'. or am i mistaken | 10:54 | |
because i thought perl5 unpack/pack would do this | 10:55 | ||
lizmat | ufobat: not, sure, it's been a while since I really looked at that | 10:56 | |
ufobat: I think we don't have an equivalent for f/d in Perl 6 ? | 10:57 | ||
ufobat | we do have num32 which chould be a IEEE float? | 11:01 | |
lizmat | not sure... I believe you | 11:03 | |
11:03
markong joined
|
|||
lizmat | possibly my work on pack/unpack predates the availability of num32 | 11:04 | |
ufobat | i just know num32 from the NativeCall documentation | ||
Voldenet | I believe num32 is a float and Num is a double | 11:07 | |
I'm not sure though, but I'd just use Num for both of them | 11:09 | ||
ufobat | i'll ask stackoverflow :) | 11:15 | |
jmerelo | ufobat: posted my (failing) solution to that problem in StackOverflow stackoverflow.com/questions/500859...sing-the-n | 11:16 | |
Voldenet | m: my num32 $x = 1/3.Num; my $y = $x * $x; $x = $y; say $x - $y | ||
camelia | 1.655684478407693e-09 | ||
jmerelo | What I was trying to do is to just use memcpy through NativeCall to turn one into another. | ||
Voldenet | yeah, every operation gets turned into 64-bit one anyway | ||
ufobat | jmerelo, i think memcopy needs pointers? | 11:17 | |
Voldenet | is rw, maybe | 11:19 | |
jnthn | Can possibly do it with a NativeCall union or something | 11:20 | |
ufobat | stackoverflow.com/questions/500860...into-a-num | 11:25 | |
lizmat | weekly: www.researchgate.net/publication/3...ial_report | 11:28 | |
notable6 | lizmat, Noted! | ||
11:29
ufobat left
|
|||
jmerelo | ufobat: theoretically they are pointers. | 11:30 | |
ufobat: I have pointed to your question from mine. | 11:34 | ||
buggable | New CPAN upload: HTTP-Tinyish-0.1.2.tar.gz by SKAJI modules.perl6.org/dist/HTTP::Tinyish:cpan:SKAJI | 11:36 | |
Voldenet | m: class Memory is repr('CUnion') { has int32 $.int; has num32 $.float }; say Memory.new(:float(1.Num)).int; | 11:38 | |
camelia | 1065353216 | ||
Voldenet | jmerelo: ^ | ||
you don't really need memcpy for it | 11:39 | ||
AlexDaniel | .tell Tison you can try `zef rdepends URI` | ||
yoleaux | AlexDaniel: I'll pass your message to Tison. | ||
11:40
Kaiepi left
|
|||
jmerelo | Voldenet: thanks! | 11:41 | |
11:41
jmerelo left
11:55
InstallPerl6 joined
|
|||
Voldenet | Huh, I do wonder how to use Pointer[T] | 11:56 | |
m: use NativeCall; say nativecast(uint32, Pointer.new(1.Num)) | 11:57 | ||
camelia | Default constructor for 'NativeCall::Types::Pointer' only takes named arguments in block <unit> at <tmp> line 1 |
||
Voldenet | m: use NativeCall; say nativecast(uint32, CArray[num32].new(1.Num)) | ||
camelia | 1065353216 | ||
12:18
Kaiepi joined
|
|||
lizmat | m: use NativeCall; say nativecast(uint32, CArray[num32].new(1e0)) # more idiomatic way to make literal nums | 12:20 | |
camelia | 1065353216 | ||
jnthn | Are you sure that isn't 32 bits of the pointer to the array? | 12:22 | |
use NativeCall; say nativecast(uint32, CArray[num32].new(0e0)) | |||
evalable6 | 0 | ||
jnthn | m: use NativeCall; say nativecast(uint32, CArray[num32].new(0e0)) | ||
camelia | 0 | ||
jnthn | Hm, apparently not. | 12:23 | |
Voldenet | I'm still unsure if this can be made into Pointer[num32] somehow | ||
Kaiepi | it can | 12:24 | |
m: use NativeCall; my $ptr = nativecast(uint32, CArray[uint32].new(1e0)); say nativecast(Pointer[num32], $ptr) | 12:25 | ||
camelia | This type cannot unbox to a native integer: P6opaque, Num in method new at /home/camelia/rakudo-m-inst-2/share/perl6/sources/51E302443A2C8FF185ABC10CA1E5520EFEE885A1 (NativeCall::Types) line 198 in method new at /home/camelia/rakudo-m-inst-2/s… |
||
Kaiepi | m: use NativeCall; my $ptr = nativecast(num32, CArray[num32].new(1e0)); say nativecast(Pointer[num32], $ptr) | ||
camelia | Native call expected return type with CPointer, CStruct, CArray, or VMArray representation, but got a P6opaque (Num) in sub nativecast at /home/camelia/rakudo-m-inst-2/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line … |
||
Kaiepi | oh | ||
Voldenet | Ah, what I meant was this | 12:26 | |
use NativeCall; say nativecast(uint32, Pointer[num32].new(0e0)) | |||
m: use NativeCall; say nativecast(uint32, Pointer[num32].new(0e0)) | |||
camelia | Default constructor for 'NativeCall::Types::Pointer[num32]' only takes named arguments in block <unit> at <tmp> line 1 |
||
Voldenet | it would make more sense to be able to use Pointer in this context, because CArray is, well, an array :) | 12:28 | |
12:28
cono joined
|
|||
cono | hello all. Q: Is there a way to make tail-recursion? | 12:29 | |
Kaiepi | m: use NativeCall; my $ptr = nativecast(CArray[num32], CArray[num32].new(1e0)); say $ptr | ||
camelia | NativeCall::Types::CArray[num32].new | ||
Kaiepi | m: use NativeCall; my $ptr = nativecast(Pointer[num32], CArray[num32].new(1e0)); say $ptr | ||
camelia | NativeCall::Types::Pointer[num32]<0x52882f0> | ||
12:30
Ven`` joined
|
|||
Kaiepi | probably shouldn't try to code with little sleep but that's a way to get it | 12:30 | |
m: use NativeCall; my $ptr = nativecast(Pointer[num32], CArray[num32].new(1e0)); say $ptr.deref | 12:32 | ||
camelia | 1 | ||
Voldenet | But in the end you still end up creating an array | ||
12:33
InstallPerl6 left
|
|||
lizmat | cono: short answer is no: OOC, what are you trying to achieve? | 12:33 | |
cono | wrote small recursive algorithm for tree traversing, and was thinking change it to loop or nextwith/samewith provides tail recursion. Will rewrite it to loop, not a big deal | 13:08 | |
buggable | New CPAN upload: P5pack-0.0.3.tar.gz by ELIZABETH modules.perl6.org/dist/P5pack:cpan:ELIZABETH | 13:16 | |
13:33
evalable6 left,
evalable6 joined,
mscha joined
|
|||
buggable | New CPAN upload: P5chomp-0.0.4.tar.gz by ELIZABETH modules.perl6.org/dist/P5chomp:cpan:ELIZABETH | 13:36 | |
13:47
Ven`` left
13:50
Ven`` joined
14:27
HaraldJoerg joined
14:42
cognominal left,
cognominal joined
14:51
siigl joined,
siigl left
|
|||
lizmat | I thought: let's try the SO way: stackoverflow.com/questions/500879...-segfaults | 14:56 | |
15:06
stmuk_ joined
15:09
stmuk left
|
|||
Geth | doc: 5d54953626 | cfa++ | doc/Language/5to6-perlfunc.pod6 nbsp |
15:17 | |
synopsebot | Link: doc.perl6.org/language/5to6-perlfunc | ||
El_Che | lizmat: and already an answer | 15:28 | |
15:29
zakharyas joined
15:30
zakharyas left
15:31
zakharyas joined
15:36
zakharyas left,
zakharyas joined
15:39
thowe joined
15:41
Zoffix joined
|
|||
Zoffix | Is "Perl 6" trademarked? | 15:42 | |
yoleaux | 07:46Z <brrt> Zoffix: lsb (lowest-set-bit?) can be implemented better by the underlying architecture | ||
Zoffix | Oh cool. There's a "PERL" medical device: tmsearch.uspto.gov/bin/showfield?f=...wtxng9.2.3 | 15:43 | |
K, found it tmsearch.uspto.gov/bin/showfield?f=...txng9.2.30 | 15:45 | ||
Thinking of buying a new car and gonna put a "♥ Perl 6" license plate on it :) But law says I can't infringe on trademarks :) | |||
Zoffix emails TPF's legal department | 15:46 | ||
moritz | is a merge usage as endorsement a potential infringement? | 15:49 | |
Zoffix | "merge usage"? | ||
15:49
kaare_ joined
|
|||
Zoffix | Oh you mean, like I'm basically gonna be like a walking ad. It probably is. What if the trademark owner doesn't want to be associated with me? | 15:50 | |
moritz | *mere | 15:51 | |
I have no idea how copyright works | 15:52 | ||
El_Che | don't you live in Canada? | ||
Are us trademarks valid there? | |||
(without a legal presence?) | |||
Zoffix | I don't know. | 15:55 | |
Which isn't the answer I want to give if the license plate people ask me if I have permission to use it :P | 15:56 | ||
15:57
stmuk joined
|
|||
moritz | understandable :-) | 15:59 | |
Zoffix | Slightly irksome that all the letters are capitalized :) www.services.gov.on.ca/wps85/s2i/S...t=PERL%206 | ||
16:00
stmuk_ left,
khw joined
16:03
HaraldJoerg1 joined
16:05
HaraldJoerg left
|
|||
El_Che | Zoffix: I don't think they care | 16:05 | |
the lawsuite for you ;) | |||
16:21
zakharyas1 joined,
zakharyas left
16:24
jmerelo joined
16:26
Ven`` left
|
|||
kt_ | I answered another: rosettacode.org/wiki/Simple_database#Perl_6 | 16:34 | |
16:34
zakharyas1 left
16:36
zakharyas joined
|
|||
Geth | gtk-simple: 391ed3cada | (Nick Logan)++ (committed using GitHub Web editor) | Build.pm Fix Build.pm to exit 0 on success |
16:40 | |
gtk-simple: 4707622d9f | (Nick Logan)++ (committed using GitHub Web editor) | META6.json Bump version 0.1.9 |
|||
jmerelo | kt_++ | 16:41 | |
16:41
jmerelo left
16:42
jmerelo joined
16:49
Ven`` joined
16:50
TEttinger joined
|
|||
jmerelo | Can I run by you my understanding of what "Normal Form Grapheme" is to see if I got it right? | 16:52 | |
Basically, it's a, well, normalized form of implementing graphemes so that they can be easily compared to each other. | 16:53 | ||
Since graphemes might include several codepoints, you could put those codepoints in principle in any possible order. | |||
timotimo | that's already in NFC | 16:54 | |
jmerelo | OK, but although it's not too clear to me how to do it (I have found only references by presentations by jnthn), the clearest possible explanation I've read is this one: | 16:55 | |
NFG needs NFC, and NFC needs NFD | |||
timotimo | i don't think NFC needs NFD actually | ||
jmerelo | (from 6guts.wordpress.com/2015/04/12/thi...many-rts/) | ||
timotimo | or maybe it does | 16:56 | |
moritz | NFC is a nice idea, but it only works for comparisons and constant-time string accesses if there is a pre-composed character in unicode | ||
NFG lifts that limitation | 16:57 | ||
jmerelo | OK, then two questions. | ||
1. Is NFG a Perl 6 thing? | |||
moritz | yes | ||
jmerelo | 2. what does it do exactly? I know it's not NFC, NFD or KFC | ||
But it's not clear what it exactly *is* | 16:58 | ||
timotimo | it's a Little Unicode Consortium built into perl6 itself | 16:59 | |
incoming strings are eaten up and whenever there's a grapheme that isn't defined yet, the Little Unicode Consortium defines a codepoint for it | |||
for example, someone posts a zalgo string which has LATIN A WITH FIFTY DOTS ABOVE AND THIRTY TILDES BELOW | |||
then the Little Unicode Consortium goes to work: | |||
"clearly there's a people out there who have this character in their native language | 17:00 | ||
we should define a codepoint so we can properly handle texts in that language" | |||
jmerelo | timotimo so far, I *love* this description. | ||
timotimo | and the rest of it is just NFC | 17:01 | |
it has the benefit that there are no longer any multi-codepoint graphemes in existence anywhere | |||
jmerelo | That is why it's constant time, because you use a single codepoint for every new grapheme, instead of several codepoints | ||
timotimo | yes | ||
plus the overhead of Little Unicode Consortium meetings | |||
jmerelo | The Little Unicode Consortion (let's calle it LUC, or Luke), is that part of the Precomp store, or is it a runtime-only thing? | 17:02 | |
timotimo | runtime-only | ||
it gets unceremoneously discarded at the end of the program | 17:03 | ||
jmerelo | Poor Luke. He was a good Luke. | ||
17:03
zakharyas left
|
|||
timotimo | basically it's the Phoenix Little Unicode Consortium | 17:03 | |
or PLUC | |||
jmerelo | So we use the Phoenix Little Unicode Consortium to represent any new Texas-form operator that comes our way? | 17:04 | |
It's a Route 66 thing. | |||
But I love the explanation, and I kinda understand it. Thanks! | 17:05 | ||
timotimo | cool | ||
17:06
zakharyas joined
|
|||
TEttinger | how many codepoints are possible for the LUC to define? | 17:11 | |
timotimo | 2^31 perhaps - 1 | ||
i mean 2^31 or 2^31 - 1 | |||
because we use negative codepoint numbers for LUC's own codepoints | 17:12 | ||
chansen_ | Is the 2^31-1 limitation perl VM or are these synthetic code points recycled? | 17:17 | |
timotimo | we do not yet garbage-collect synthetic codepoints, but it is possible | ||
17:17
rindolf left
|
|||
chansen_ | ok | 17:20 | |
Geth | doc: 076bee114a | (JJ Merelo)++ | 2 files Deduped NFG and whenever And added a little explanation for NFG thanks to @timo. Refs @1912, two down, 6 to go. |
||
doc: 3cbc96deba | (JJ Merelo)++ | doc/Language/operators.pod6 dedups ++, refs #1912 |
|||
synopsebot | Link: doc.perl6.org/language/operators | ||
doc: 7a409a432a | (JJ Merelo)++ | doc/Language/operators.pod6 Dedups «=» and discovers #1976 on the way |
|||
17:21
rindolf joined
|
|||
AlexDaniel | jmerelo: what is D#1976 about | 17:21 | |
synopsebot | D#1976 [open]: github.com/perl6/doc/issues/1976 Some unicode characters eliminated in generated page | ||
17:21
zakharyas left
|
|||
AlexDaniel | jmerelo: infix C«=» is = and that's correct | 17:21 | |
timotimo | i haven't done the maths yet, but if you're reaching a point where 2^31 custom code points will have been defined, you've probably already consumed many gigabytes, perhaps terabytes of incoming data | ||
17:22
rouking left
|
|||
jmerelo | AlexDaniel: right. Oh. I thought it was a 3-letter operator. I'm so dumb. | 17:26 | |
Hum | |||
Geth | doc: 90221c63ca | (JJ Merelo)++ | doc/Language/operators.pod6 Renaming indexing thanks to @alexdaniel |
17:27 | |
jmerelo | Sorry about that. | ||
17:28
jmerelo left
|
|||
chansen_ | timotimo: true, but that is not uncommon for a daemon. | 17:28 | |
timotimo | true | ||
it's something that should definitely be implemented | 17:29 | ||
chansen_ | How does MoarVM error when the limit is reached? | ||
timotimo | it seems like we don't check | 17:31 | |
chansen_ | ouch! | ||
timotimo | maybe we even wrap around and reuse -1, then -2, and so on | ||
it's all in moarvm's src/string/nfg.c | 17:32 | ||
17:35
xinming left
17:37
xinming joined
|
|||
timotimo | should we just take the newest? 3.7.0 seems new and available and such | 17:40 | |
17:42
wamba left,
Ven`` left
|
|||
AlexDaniel | timotimo: sorry, what is this about? | 17:43 | |
timotimo | wrong window :) | 17:45 | |
17:54
wamba joined
18:01
|oLa|1 joined,
raynold left
18:20
ufobat joined
18:22
Zoffix left,
markong left
18:23
markong joined
|
|||
ufobat | woho, my baby sereal example gets almost parsed. there is a little bug which i am going to hunt down tomorrow | 19:03 | |
19:04
domidumont left,
darutoko left
19:14
Kaiepi left,
Kaiepi joined
20:13
comborico1611 joined
|
|||
comborico1611 | Can someone point me to page in Docs where m is explained, as in regex m:i/ ab/ | 20:15 | |
Can someone explain difference between m/abc/ and /abc/ ? | 20:34 | ||
20:38
Zoffix joined
|
|||
comborico1611 | Can someone explain difference between m/abc/ and /abc/ ? | 20:38 | |
tobs | comborico1611: Couldn't find a page about m// per se. Everything points to this: docs.perl6.org/language/regexes | ||
you'll answer your question yourself then | |||
comborico1611 | tobs: Thanks for trying! | 20:39 | |
Zoffix | comborico1611: /./ constructs a regex object. m/./ immediatelly executes that regex. In some contexts (such as smartmatching and bool), the plain /./ also executes the regex | ||
executes it matching against $_ | |||
20:39
dct joined
|
|||
comborico1611 | Weird. I haven't read anything about that. Is m/./ advanced? | 20:40 | |
Zoffix | "advanced"? What do you mean? | ||
comborico1611 | Rarely used. | ||
Zoffix | It's used when you want to perform the match right away | ||
m: $_ = "meows"; my $match = /.+/; say $match # just a Regex object | 20:41 | ||
camelia | /.+/ | ||
comborico1611 | Something is going over my head here. | ||
Zoffix | m: $_ = "meows"; my $match = m/.+/; say $match # just a Regex object | ||
camelia | 「meows」 | ||
Zoffix | *second one should read # now a completed Match | ||
comborico1611 | I've read perl6intro.com's take on regex, and Think Perl 6. And both don't explain this. | 20:42 | |
Even Docs doesn't explain this. | |||
Granted I didn't read all of regex on Docs, but I scanned it and nothign on this. | 20:43 | ||
Zoffix | It's kind of an irrelevant detail really | ||
tobs | m: "abc" ~~ /^a/ | 20:45 | |
camelia | ( no output ) | ||
comborico1611 | Zoffix: Someone called it the Regex Match Operator. Does that sound right? | ||
Zoffix | comborico1611: and yeah, I'd say it's "rarely used" as it's often uneeded. The only thing is if you want to stick some adverbs that go on the outside, you'd normally write them as `rx:g/./` (because `:g/./` is invalid). However, in many cases you're matching immediatelly anyway, so people tend to use the shorter `m:g/./` version | ||
tobs | usually write it like this. I guess the smartmatch operator takes care of applying it, even without m// | ||
20:47
Kaiepi left,
Kaiepi joined
|
|||
Zoffix | comborico1611: dunno, it's not an operator in a sense that you have some sort of &circumfix:<m/ /> and it's parsed in the same group as quoters, like qw// or qx// | 20:48 | |
comborico1611 | Zoffix: I see. | 20:49 | |
Zoffix: Why does $_ = "meows"; my $match = /.+/; say match.WHAT output as (Match)? | 20:51 | ||
Is match a type? | |||
Zoffix | comborico1611: rx/./ = "*r*ege*x*" => create a Regex object. As a shortcut, you can skip the "rx" part if you're not using any adverbs; m/./ = '*m*atch' => create and immediately match a Regex object against $_. | 20:52 | |
m: $_ = "meows"; my $match = /.+/; say $match.WHAT | |||
camelia | (Regex) | ||
comborico1611 | My REPL is output of (Match) | ||
timotimo | sounds like your rakudo is a month or two out of date | 20:53 | |
comborico1611 | Err. m/./ | ||
timotimo | no problem, though | ||
Zoffix | comborico1611: What did you type? gist.github.com/zoffixznet/d530022...9c819a61d9 | ||
comborico1611: well yeah, the m = *match* so it performs the match and gives you the resultant Match object | |||
comborico1611 | with m/./ it is (Match) | ||
without is (Regex) | |||
Zoffix | That's right. | ||
comborico1611 | Okay. Thanks! | 20:54 | |
ufobat | lizmat, perl6 -Ilib -e 'use Sereal; say decode_file("sereal.example")' # prints out: [{a => 2} 1] | ||
Zoffix | m: $_ = "meows"; so my $match = /.+ { say "performing match" }/; | 20:55 | |
camelia | WARNINGS for <tmp>: performing match Useless use of "so " in expression "so my $match = /.+ { say \"performing match\" }/" in sink context (line 1) |
||
Zoffix | It's not useless! | ||
lizmat | ufobat: cool! | ||
Zoffix | m: $_ = "meows"; $ = so my $match = /.+ { say "performing match" }/; | ||
camelia | performing match | ||
comborico1611 | Zoffix: Do you mind if I use your examples in an Issue for Perl6 Docs? | 20:56 | |
Zoffix | comborico1611: ^ and here, despite there not being an m//, a match is performed when the Regex object gets to `so` call, because Regex's .Bool method executes a match. So you could write stuff like ` if /foo/ { ... }` without being forced to use `m//` | ||
comborico1611 | Not a big deal if you mind. | ||
Zoffix | I don't care about the examples. | ||
You could also make a PR and submit: github.com/perl6/doc/blob/master/d...gexes.pod6 | |||
comborico1611 | Eee. I don't know. I barely understand this stuff, if even that. | 20:59 | |
But I'll see what I can glue together with your responses. | |||
Zoffix | comborico1611: well, good. You can explain it to people who barely understand this stuff in the words they'll understand. | 21:00 | |
comborico1611 | That is very true. | ||
Zoffix: How do I make "meows" into that weird indented thing for objects? | 21:06 | ||
21:06
robertle left
|
|||
Zoffix | comborico1611: into a what? | 21:07 | |
「meows」? | |||
comborico1611 | Heh. You know how the REPl outputs a Matched Object in a certain style | ||
yeah | |||
Zoffix | That's how Match.gist outputs a match | ||
comborico1611 | I'll just copy and paste it. Also, can you provide another example for rx/.+/ for meows? | 21:08 | |
Zoffix | u: 「」 | ||
unicodable6 | Zoffix, U+FF62 HALFWIDTH LEFT CORNER BRACKET [Ps] (「) | ||
Zoffix, U+FF63 HALFWIDTH RIGHT CORNER BRACKET [Pe] (」) | |||
Zoffix | m: my $match = rx/.+/.ACCEPTS: "meows"; say $match | 21:09 | |
camelia | 「meows」 | ||
Zoffix | m: my $match = rx/.+/.match: "meows"; say $match | ||
camelia | Invocant of method 'match' must be a type object of type 'Any', not an object instance of type 'Regex'. Did you forget a 'multi'? in block <unit> at <tmp> line 1 |
||
comborico1611 | How do you remember all that? | ||
Zoffix | That error sucks :( | ||
comborico1611 | Yeah. | ||
Zoffix | m: my $match = "meows".match: rx:g/./; say $match | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Adverb g not allowed on rx at <tmp>:1 ------> 3my $match = "meows".match: rx:g/./7⏏5; say $match |
||
Zoffix | orly | 21:10 | |
m: my $match = "meows".match: rx:i/./; say $match | |||
camelia | 「m」 | ||
Zoffix | m: my $match = "meows".match: m:i/./; say $match | ||
camelia | 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 1 Cannot resolve caller match(Str: Nil); none of these signature… |
||
comborico1611 | *applauds | ||
Zoffix | hehe | ||
comborico1611 | Is that one good enough? | ||
my $match = "meows".match: rx:i/./; say $match | |||
evalable6 | 「m」 | ||
comborico1611 | It has that :i in there which ruines the simplicity of the other two examples. | 21:11 | |
Zoffix | dunno; It's easier to write `rx:i/./` as `/:i ./` and I'm too lazy to lookup which adverbs must be placed outside the regex AND can be used with `rx` | ||
comborico1611 | I just won't include an example of 'rx'. | ||
Zoffix | As for how to remember all that. Dunno, just years of exposure to it. Also mnemonics: rx = "*r*ege*x* object"; m = "*m*atch"; g = "*g*lobal match" (though I don't even remember it as a global match anymore; it's just a "g" match in my brain and it knows it means repeated match across the whole thing) | 21:13 | |
Zoffix & | |||
21:13
Zoffix left
|
|||
buggable | New CPAN upload: P5localtime-0.0.1.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/...0.1.tar.gz | 21:16 | |
21:18
jast left
21:19
jast joined
|
|||
lizmat | thanks to everybody who helped ^^^ | 21:20 | |
21:21
wamba left
|
|||
Geth | doc: COMBORICO++ created pull request #1977: m/ / and / / examples added |
21:35 | |
comborico1611 | That's neat. | 21:36 | |
buggable | New CPAN upload: P5built-ins-0.0.12.tar.gz by ELIZABETH cpan.metacpan.org/authors/id/E/EL/....12.tar.gz | ||
HaraldJoerg1 | comborico1611: After reading the docs, I was as confused as you were | 21:39 | |
comborico1611 | That's good news. | ||
Hopefully, not after my addition. | |||
HaraldJoerg1 | I think that "m/abc/; # a regex that is immediately matched against $_" is badly worded, because it simply isn't "a regex" | 21:40 | |
comborico1611 | Or, because of. lol | ||
HaraldJoerg1 | The examples do help, so thanks for the PR | ||
comborico1611 | Yay! You're welcome! | 21:41 | |
I really don't understand much of this, so I can't comment about the possible bad wording. | |||
HaraldJoerg1 | Me neither, but if it starts with "a regex" I'd expect it to return a regex | ||
comborico1611 | m: say " | 21:45 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1) at <tmp>:1 ------> 3say "7⏏5<EOL> expecting any of: argument list … |
||
comborico1611 | m: say "\c[HALFWIDTH RIGHT CORNER BRACKET]" | ||
camelia | 」 | ||
comborico1611 | m: say "\c[WHITE SMILING FACE]" | 21:47 | |
camelia | ☺ | ||
Geth | doc: 7a26988543 | (Elizabeth Mattijsen)++ | doc/Language/5to6-perlfunc.pod6 Add mention of P5localtime for localtime/gmtime |
||
synopsebot | Link: doc.perl6.org/language/5to6-perlfunc | ||
comborico1611 | m: say "\c[BLACK SMILING FACE]" | ||
camelia | ☻ | ||
comborico1611 | m: say "\c[YELLOW SMILING FACE]" | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unrecognized character name [YELLOW SMILING FACE] at <tmp>:1 ------> 3say "\c[YELLOW SMILING FACE7⏏5]" |
||
21:55
mscha left
|
|||
comborico1611 | Finished Perl6Intro. Pretty good! | 21:57 | |
Break time! | 21:58 | ||
21:58
comborico1611 left
22:09
HaraldJoerg1 left
22:18
Sgeo_ left
22:22
Sgeo joined
|
|||
buggable | New CPAN upload: P5localtime-0.0.2.tar.gz by ELIZABETH modules.perl6.org/dist/P5localtime:...:ELIZABETH | 22:26 | |
lizmat | weekly: code.foo.no/index.php/2018/04/29/a...rs-report/ | 22:27 | |
notable6 | lizmat, Noted! | ||
sauvin | I have this code: termbin.com/jal4 .. it barfs with "malformed UTF-8". Ran into this before reading from files, fixed it with putting a ":utf-c8" somewhere. Where in this example code would something similar be put? | ||
timotimo | the .Supply method call can be told to :bin so you get Buf instead of Str, then you can .decode that as "utf8-c8" if you want | 22:28 | |
docs.perl6.org/type/Proc::Async#method_Supply | |||
it also takes :enc("blah") if you like | |||
sauvin | Trying that... | 22:31 | |
Nope. | |||
Perl6 sure is craploads stickier about this than Perl5 was. | 22:32 | ||
Very, very annoying. | |||
timotimo | where did you put it? :) | ||
22:32
epony left
22:33
epony joined
|
|||
sauvin | termbin.com/zm4l | 22:33 | |
Before you laugh and call me an idiot, no, I don't know perl6 very well yet. :D | |||
timotimo | oh that's fine | ||
you would have wanted :enc("utf8-c8") instead, which is like enc => "utf8-c8" | 22:34 | ||
what you pass instead is utf8-c8 => True | |||
sauvin | Probably know in a tiny handful of minutes if that worked or not. | 22:35 | |
That might have done it. Why does perl6 barf so easily on "bad" UTF-8 when nothing else I have does? | 22:37 | ||
timotimo | i'm not entirely sure what situations you are encountering tbh | ||
maybe the other systems are just fine with the thought of serving you mojibake? | 22:38 | ||
sauvin | Raw output from my IRC client. | ||
timotimo | could very well be due to color codes? | ||
sauvin | Hrm... possibly. I'd have to look to see if I stripped those off. | ||
22:39
Kaiepi left
22:40
Kaiepi joined
|
|||
sauvin | No, I didn't. You're saying colours and probably things like bolds and underlines are screwing up the UTF8? | 22:40 | |
timotimo | i haven't looked, but i can imagine it could be illegal utf8 | ||
sauvin | The colours and suchlike aren't UTF-anything. theyr' | 22:41 | |
(grr) | |||
timotimo | hm, are they just \x03 followed by two numbers? | ||
sauvin | they're "control codes", characters I believe ASCII 0..31. | ||
Something a lot like that. I'd have to dig that stuff up again to find out. | 22:42 | ||
timotimo | m: Buf.new(0x02, "a".ord, 0x0f).decode("utf8").say | ||
camelia | a | ||
ilbelkyr | well, 1..31 (1..3 in common usage, plus a few more for the more exotic codes such as italics/underline etc) | ||
timotimo | m: Buf.new(0x1d, 0x1f, 0x16, "a".ord, 0x0f).decode("utf8").say | ||
camelia | a | ||
timotimo | hm, that seems just fine | ||
sauvin | As a matter of fact, last time I screwed around with perl6 and ran into this UTF8 thing, it was on raw IRC logs. | 22:43 | |
OK, so it ain't a perl6 thing. It's an IRC thing. | |||
timotimo | well, i mean, other irc users are fine sending you binary garbage | ||
ilbelkyr | might be non-UTF encodings as well, I suppose | 22:44 | |
timotimo | sure, utf8 is just used by people who decided that everybody using the same encoding is a good idea, and utf8 is a good compromise | 22:45 | |
but the irc server is probably fine spreading any old binary garbage | |||
ilbelkyr | yeah, to the irc server it's all just a series of bytes | ||
sauvin | The server software itself might just be sending literally whatever binary comes its way. | ||
22:46
ryn1x joined
|
|||
sauvin | OK, so, what you just told me is to fix my logger. | 22:46 | |
22:48
ryn1x left
22:49
kurahaupo_ joined,
ryn1x joined
|
|||
timotimo | if all you're interested in is passing stuff along, you can just as well use latin1 as the encoding, because every sequence of bytes is valid latin1 | 22:50 | |
22:50
kurahaupo_ is now known as kurahaupo__
|
|||
timotimo | it's just that you'll be seeing mojibake if you read it back as latin1 | 22:51 | |
Geth | doc: a3b977067c | (Elizabeth Mattijsen)++ | doc/Language/nativecall.pod6 Omit "is native" value for already loaded functions No need to pass a Str type object, this has been fixed in NativeCall several years ago already. |
||
synopsebot | Link: doc.perl6.org/language/nativecall | ||
sauvin | "reading it back" is pretty much a necessity, though. | ||
22:51
kurahaupo left
|
|||
timotimo | with invalid utf8 you really can't win with a one-size-fits-all solution, unless you want to build some machine-learning solution that takes the whole context and tries to figure out what the most likely encoding or meaning is | 22:52 | |
22:52
kurahaupo__ is now known as kurahaupo
|
|||
tobs | sauvin: as a heuristic, how about splitting the log into lines and trying encodings until one doesn't fail? (There won't be a single line with different encodings, hopefully.) | 22:55 | |
sauvin | Hopefully not, but this is IRC, an international thing, and folks from all over the world splutter all kinds of different things. | 22:56 | |
Trying to fix my logger atm. | |||
Grr. Fix ain't working. I'll have to deal with it when my head is clearer. | 23:02 | ||
Many thnaks, though. You told me where the problem is, what needs to be done about it, and that time spent learning perl6 isn't wasted. | 23:03 | ||
23:04
rindolf left
|
|||
sauvin | Can't blame the hammer if the nails are made out of acrylic. | 23:04 | |
timotimo | ouch :) | ||
sauvin | Oh, it'll be an easy fix. I've run into exactly this once before, many years ago. Wound up stripping off colours manually before I found a module for it. | 23:06 | |
Ain't working, for some reason, but the logger is in perl5 and so probably not on topic here. | |||
timotimo | well, perl6 fancies itself a glue language, so other languages aren't fully off-topic if you're interacting with a program in that language :) | 23:09 | |
23:09
rindolf joined
|
|||
sauvin | Perl5 fancies itself the same. Funny kind of glue, though: it does EVERYTHING. | 23:09 | |
23:10
eliasr joined
23:23
comborico1611 joined
23:26
Zoffix joined
|
|||
comborico1611 | How do I add say WHAT onto this: say my $st = (my $string = "banana").comb | 23:26 | |
Zoffix | sauvin: FWIW, here's how IRC::Client module handles IRC content. Just `try`ies to decode it as utf8 first and then fallsback to latin. Seems to work OK: github.com/zoffixznet/perl6-IRC-Cl...#L206-L208 | 23:27 | |
comborico1611: why do you need a `.WHAT`? | |||
comborico1611 | I'm wondering what comb returns | ||
( a b c ) | 23:28 | ||
Seq, right? | |||
Zoffix | comborico1611: you mean print the name of the objecT? | ||
timotimo | yes, it gives you a seq. if you assign seqs into @foo or such, it will be turned into an array | ||
comborico1611 | Zoffix: Yes. | ||
I'm still pretty fuzzy on these objects. Match object and Seq object... are classes? | 23:29 | ||
I mean objects of classes. | |||
Zoffix | comborico1611: then use `.^name`, not .WHAT. .WHAT returns the type object not a string. It's a fake method and so doesn't work in some contexts, and a gist of a typeobject prints just the shortname, not the fullname. | ||
m: my $st = (my $string = "banana").comb; say $st.^name | |||
camelia | Resource temporarily unavailable | ||
timotimo | almost everything is an object, objects are instances of classes | ||
Zoffix | e: my $st = (my $string = "banana").comb; say $st.^name | ||
evalable6 | Seq | ||
Zoffix | comborico1611: and that's not a good way to store a Seq. You're shoving it into a container, so other operations on it would treat is as a single item rather than the contents of it | 23:30 | |
comborico1611 | I thought Perl6 was really procedural that pretended to be OO. | ||
Zoffix | e: my $st = (my $string = "banana").comb; for $st { .say } | ||
evalable6 | (b a n a n a) | ||
Zoffix | You should bind instead | ||
e: my $st := (my $string = "banana").comb; for $st { .say } | |||
evalable6 | b a n a n a |
||
Geth | doc: 2b5cbcb9cd | (Will "Coke" Coleda)++ | htmlify.p6 Proactively remove temp files While the module will remove them, if the script aborts for any reason, they stick around. This removes them as soon as possible instead. Closes #1973 |
23:31 | |
Zoffix | sauvin: "Why does perl6 barf so easily on "bad" UTF-8 when nothing else I have does?" Because we decode as UTF-8 by default, while other things give you bytes and require you to do the decoding yourself and many programmers aren't even aware their programs can't handle unicode properly because a few ASCII strings they tried in their program "work". If you do decode them, other things barf just the same | 23:39 | |
$ perl6 -e '$*OUT.write: Buf.new: 200' | perl -C -wlE 'say for <>' | |||
utf8 "\xC8" does not map to Unicode at -e line 1, <> line 1. | |||
Malformed UTF-8 character (unexpected end of string) in say at -e line 1, <> line 1. | |||
comborico1611 | Goodbye! | 23:41 | |
23:41
comborico1611 left
|
|||
sauvin | Makes sense. When I made that statement, I wasn't taking into account the only things I'd worked with was stuff containing IRC color codes, which probably aren't part of UTF-*anything*. | 23:41 | |
Zoffix | Wonder what ruby does, 'cause based on the manpage, this should enable utf8 on stdin: perl6 -e '$*OUT.write: Buf.new: 200' | ruby -U -e 'puts $stdin.readline()' | 23:45 | |
Yet, it just prints an "unknown char and doesn't | |||
throw | |||
Zoffix smiles at comments on this answer "terse and readable": stackoverflow.com/a/21329178/2410502 | 23:47 | ||
Considering Perl 6's version is just `slurp "test.txt"` :) | |||
timotimo | easy to cherry-pick pieces where perl6 code is so much nicer ;) | 23:48 | |
but try this! $foo + $bar * $quux - $bleh ** $plop | |||
you can hardly make that better in perl6 than it is in ruby! :P | 23:49 | ||
checkmate butterflyists! | |||
Geth | doc: 6dec94afbb | COMBORICO++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 m/ / and / / examples added Added examples to help illustrate difference between m/ / and / /. Zoffix provided the examples. I provided the learning. An example for rx/ / is needed. As a newbie, this info is very helpful and rare. It is not in Think Perl 6, ttbomk. And definitely not in Perl6Intro.com. Needed info or something better. |
||
synopsebot | Link: doc.perl6.org/language/regexes | ||
Geth | doc: 13b03e53c0 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Merge pull request #1977 from COMBORICO/patch-1 m/ / and / / examples added |
||
doc: 874a87bd66 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Formatting fixes - Use proper C<> blocks instead of quotes - Clarify output in examples to show object names |
23:51 | ||
Zoffix | timotimo: what is it in ruby? | 23:52 | |
timotimo | probably the same, really | ||
Zoffix | Ah :) | ||
Geth | doc: 5a27049b70 | (Will "Coke" Coleda)++ | htmlify.p6 Revert "Proactively remove temp files" This reverts commit 2b5cbcb9cd26625a723c4106182c539cf7a01cc1. - originally was commented out; when uncommented, build breaks |
||
timotimo | sorry, i'm just being silly for no reason | ||
i feel like my head isn't screwed on right today | 23:53 | ||
Geth | doc/coke/build: 18 commits pushed by (Will "Coke" Coleda)++ review: github.com/perl6/doc/compare/10be0...4c26a50415 |
||
AlexDaniel | just screw it left | ||
AlexDaniel being silly a little bit is fine | 23:54 | ||
timotimo | but if it's not screwed on right, wouldn't screwing it left unscrew it even further? | ||
AlexDaniel | .oO( but the flat earth part was too much, IMO :) ) |
||
timotimo | i'm not sure why i brought that up, yeah |