»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
Xliff_ m: my @a = ^9; say @a[^4]; say @a[*] 01:44
evalable6 (0 1 2 3)
(0 1 2 3 4 5 6 7 8)
Xliff_ m: my @a = ^9; say @a[^4]; say @a[*-1]
evalable6 (0 1 2 3)
8
Xliff_ m: my @a = ^9; say @a[ ^4 ]; 02:50
evalable6 (0 1 2 3)
Xliff_ m: my $a = 2; my @a = ^9; say @a[ ^(2 * 2) ];
evalable6 (0 1 2 3)
Xliff_ m: my %a = ( a=>1, b=>2, 3=>3 ); for %a.keys { with %a{$_} { .say }; } 04:12
evalable6 2
3
1
uzl m: class A { has $.val; method Str { 'µ' ~ $!val } }; multi sub infix:<+>(A $lhs, A $rhs) { $lhs.val + $rhs.val }; (A.new(:12val) + A.new(:23val)).put; A.new(:12val).put 04:31
evalable6 35
µ12
uzl How would I overload an operator (e.g., +) for a class in the same manner as Str? 04:33
Is using the multi operator-type:<OP>(T $lhs, T $rhs) { } syntax the right way to do it whenever operators are being overloaded instead of methods (e.g., Str, Num, etc.)? 04:36
uzl ... the `multi operator-type:<OP>(T $lhs, T $rhs) { }` syntax ... 04:37
lizmat_ weekly: blogs.perl.org/users/brian_d_foy/20...sting.html 07:17
notable6 lizmat_, Noted!
ufobat good morning :D 07:54
lizmat ufobat o/ 07:58
kawaii o/ 08:36
patrickb o/ 08:38
nebuchadnezzar Hello 08:42
Am I the only one unable to access perl6.org websites ?
lizmat nebuchadnezzar: www.reddit.com/r/perl6/comments/bf...ains_seem/ 08:43
please use perl6.wakelift.de/ for now 08:44
nebuchadnezzar thanks a lot 08:45
cono does any1 know what is going on with perl6.org ? 08:55
nebuchadnezzar cono: as lizmat just said to me www.reddit.com/r/perl6/comments/bf...ains_seem/ 08:56
cono: please use perl6.wakelift.de/ for now
cono got it, thanks! 08:58
patrickb sena_kun: Have you seen my openapi-schema-validate PRs? 09:07
kawaii: Some days ago I mixed you and sena_kun up, that's why I pinged you about those PRs. Sorry about that. 09:08
sena_kun patrickb, not yet... oh, I somehow missed it, sorry... 09:08
patrickb sena_kun: Never mind. 09:09
sena_kun patrickb, merged, bumped the version too. thank you! 09:10
kawaii no problem :)
rba Hi all. I would volunteer to bring perl6.org and it's subdomains back online. Who is on it? 09:25
lizmat moritz is on it 09:26
lizmat could someone respond to twitter.com/GwenDragonTek/status/1...8538600448 ? 13:20
El_Che lgtaube: done 13:31
lizmat: done 13:32
.tell lizmat done (twitter)
yoleaux El_Che: I'll pass your message to lizmat.
elcaro m: my $b = Blob.new() but role :: { }
evalable6 (exit code 1) This REPR cannot change type
in block <unit> at /tmp/LaqPCIuQu5 line 1
elcaro How come Blobs/Bufs can't do roles 13:33
?
jnthn elcaro: Because they're represented in memory as an array, not an object, and so they can't store additional attributes 13:47
elcaro jnthn: thanks. i'll just put it in a class instead. 14:02
lizmat El_Che++ 14:03
yoleaux 13:32Z <El_Che> lizmat: done (twitter)
holyghost hail. I'm on netbsd, I hope I will be of use if I compile perl6 and put in Xn::Y modules on CPAN 14:24
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2019/04/23/...ster-down/ 14:28
holyghost wordpress++
patrickb .tell lizmat The four slots are for GSoC, not GSoD 14:32
yoleaux patrickb: I'll pass your message to lizmat.
patrickb lizmat: Also loads of '- by' in the Twitter section 14:35
lizmat patrickb++ # fixed 14:36
yoleaux 14:32Z <patrickb> lizmat: The four slots are for GSoC, not GSoD
lizmat patrickb: what was it you said before that
patrickb: ah duh
holyghost I'm a bit drunk but it seems to have compiled, now installing zef pkgs 14:40
sena_kun lizmat, "Modern programming language by ." misses `八雲アナグラ` as nickname 15:03
lizmat sena_kun++ # fixed 15:04
holyghost So I guess since the sites are down, that zef does not update mirrors ... ? 15:09
sena_kun there is a delay of 6 miutes. :( 15:10
holyghost ok, zef cannot find SDL2::Raw
holyghost MoarVM panic: Unable to allocate memory for callback closure 15:19
sena_kun also sees a lot of "Perl&nnbsp;6" in this weekly <- lizmat
holyghost looks like a bug on google, I'll try to fix tomorrow 15:21
timotimo holyghost[afk]: could be an infinite recursion 15:24
holyghost[afk] I'll check 15:27
Seems to happen only when I do not enter a perl6 file argument 15:29
holyghost For the rest 2018.10 is fine on netbsd 15:30
I couldn't get a similar version as the sites are down
Coolness, I can hack somewhat tomorrow :-)
lizmat sena_kun++ # fixed, I think 15:31
guifa Is there a shorthanded way to do with @foo { for @_ { … } } ? 15:32
sena_kun lizmat, now it's safe. \o/ Thanks a lot for all your efforts!
guifa Just for @foo { … } will sometimes get an Any value that the with @foo protects against
holyghost lizmat++ 15:33
I'; going to drink something now I think, I'm too tired of this morning's trip 15:34
guifa lizmat: interesting to see your comment on the Fluent ycombinator post. Don’t forget that I have a mostly working port of for P6 :-) It’ll be totally finished once I get the date stuff worked out for Intl::CLDR 15:43
lizmat guifa: please remind me which response that was? 15:44
guifa news.ycombinator.com/item?id=19680662 | grep ‘lizmat’ 15:45
timotimo wouldn't it be funny if it'd actually literally accept |grep"foobar" in the url and DWYM 15:49
lizmat guifa: ah, that one, :-)
guifa timotimo: I bet someone has made a browser extension for that 15:52
filoteo_ how to determine graphème width, for terminal use ? 16:10
lizmat filoteo_: I think that's very implementation dependent, but like to be proven wrong 16:11
afaik, each manufacturer has freedom as to how to implement rendering 16:12
filoteo_ ascii=1, cjk=2, many math syms=2 chars some 3, and ancient script rare graphème like 5 or 6
timotimo there is an "east asian width" property that is interesting for some cases, but it probably won't do much for emoji and such
and yeah, the terminal itself has to have its own implementation, and you better not get it wrong :) :)
(you most probably will)
guifa Do you mean number of columns displayed in the terminal or number of code points used to compose it?
filoteo_ the number of columns on the terminal 16:13
like ⌬ I get two how many you get ? 16:14
guifa That should be both font and terminal dependent. I’m not sure if there’s actually a way to calculate it without knowing a lot about the environment
filoteo_ then ⨌ I get 3 and 𒁏 get 7 or so, how about you how does it show in your terminal ? 16:15
guifa GOogling around I found that there’s a POSIX function wcswidth that might be of help 16:16
guifa That might not be a bad module for someone to make. There is a P5 implementation 16:17
guifa is afk&
filoteo_ that's the oldy widechar func, I am suspicious of it
not to mention some (common) terminal render such ༽ overspread upper and lower term lines 16:18
lizmat yeah, that seems very pre-Unicode :-) 16:19
filoteo_ I have yet to hear about row-width, and I supect some east-asian script have it more common 16:20
like tibetan stacking letters
and probably other languages, like at least 10 millions people
some terminal seems to fit them, but they become way too small for proper readability 16:21
nebuchadnezzar erf, I can't remember where I read an article speaking about the first fail with Object Oriented Programming which is it's name, it should be Message Oriented Programming. I'm sure I read it on a perl6 blog but I missed to save and annotate the link :-( 16:22
filoteo_ I think Alan Kay @nebuchadnezzar 16:26
recently read about it and was sorry or something like that 16:27
may be he had smalltalk in mind, not sure what he thought
jnthn nebuchadnezzar: Maybe wiki.c2.com/?AlanKayOnMessaging is what you're looking for 16:28
lucasb o/ 16:55
New module is "Command::Despatch" with an E, in the weekly :)
AlexDaniel AAAAAAAA! 16:59
lucasb: iirc it's a valid British spelling, but it bothers me a lot :) 17:01
lucasb it reminds me the name of that popular song... Despatchito! :D
AlexDaniel perfect name for a module 17:02
kawaii AlexDaniel, lucasb: I'm glad that my module caused just the right amount of discomfort :) 17:33
lichtkind does anybody know whats with perl6.org? 17:44
Altai-man_ lichtkind, twitter.com/perl6org/status/1119234204221562882 <- 17:44
lichtkind thank you 17:45
lucs nebuchadnezzar: Could this be the blog post you saw?: 6guts.wordpress.com/2016/11/25/per...ood-thing/ 17:46
(even if it isn't , it's worth a read, eh) 17:47
woolfy Back online, thanks to Dan Wright of The Perl Foundation: perl6.org/ www.perl6.org/ docs.perl6.org/ 18:02
It's not the link to the original server, but to the temporary (new?) server. 18:04
Altai-man_ \o/ 18:07
woolfy I mean, the dns has been changed by Dan Wright, and it is now pointing to the new server.
Altai-man_ feels we need to get a bunch of people to discuss&implement improvements to the infrastructure 18:09
s/get/gather/
AlexDaniel Altai-man_: yes and github.com/perl6/problem-solving/issues/9 18:13
Altai-man_ AlexDaniel, great! Thanks for the link
AlexDaniel, isn't it focused on security rather than reliability? 18:14
AlexDaniel Altai-man_: well, if a hacker downs a server then suddenly it's reliability :) 18:15
Altai-man_: but yes, it's a slightly different ticket, but maybe a proper solution should consider security too
guifa filoteo: do you have an example of a CLI program that is row-height aware? 18:29
err filoteo_
tony-o_ what do you mean by row-height aware? 18:35
tony-o_ there is this: linux.die.net/man/3/getmaxyx - coupled with font info might give row height 18:42
or close
discord6 <Tyler (Aearnus)> Cheers woolfy! 19:20
guifa tony-o: filoteo_ was looking for a way to know how wide (in columns) or high (in rows) a given character would appear when printed to a terminal. I don’t think anyone has done anything with height-awareness as most terminals these days can handle LTR and RTF text, but assume horizontal text that is 1-em tall. 19:28
japhb guifa: That's my understanding as well, but I'd love to be proven wrong, because I find terminal font sizing to be *wildly* variable between operating systems and terminal rendering libraries. Which makes writing libraries like Terminal::Print a pain. 20:11
(Right now Terminal::Print is relatively low level, so tries not to actively break layout that higher layers get right, but it also does not attempt to guess the width of characters or do any auto-layout.) 20:12
guifa japhb: I think the only solution would basically involve a entire rewrite of how terminals work (at least to assume that horizontal characters could be > 1 em tall or vertical characters could be >1em wide) 20:13
If you have a string of horizontal text, and one character is 2 high, does it overwrite the char above or below to fit? And if that one above or below is two high, does the “left over” get deleted or stay partially visible (despite not being an independent character that can be selected) 20:14
timotimo may want to have a quick look at arcan :3 20:15
japhb guifa: The answer to all of those I think is "it depends". :-( 20:16
timotimo: This thing? github.com/letoram/arcan 20:18
timotimo that's the one
i'm impressed by its approach
but i haven't had the opportunity to actually dig in
timotimo you know 20:19
there's hundreds of dozens of millions of nopastes/pastebin services
but i don't think there's a tailbin yet?
guifa Right. It would probably require unicode characters to get a new property and I don’t think that’s one they’d be too inclined to add because the answer might depend on whether it’s in a vertical or horizontal context, for instance.
timotimo i.e. you point a growing file at the site using some tool and others could watch it grow in their web browser or by curling or whatever 20:20
guifa doesn’t know why he never made a hash pretty print sub until today. 20:24
timotimo have you seen Data::Dump::Tree? 20:26
it's super pretty
guifa d’oh. Thankfully I didn’t spend too much time on mine ha 20:29
I had just been using dd which wasn’t prettified 20:30
timotimo aye, dd just uses .perl 20:34
guifa can custom control flow operators only be done with slangs or can they be defined with regular subs? 20:39
gfldex guifa: it depends. What do you want to do? 20:42
guifa gfldex: a with/for combination. The XML method .elements returns (Any) if there aren’t matching children, which if you say for $xml.elements(:tag<matchesnothing>) { … } you still get a single run of the loop because the Any scalar then gets coerced into a list with a single element: the type obejct Any 20:46
Can protect against that be doing with $xml.elements(…) { for @_ { … } } but… that’s fugly
especially if you have to nest it once or twice
I could write a wrapper function that captures the Any return and passes Nil instead, but I’d need to do that on a per-method basis, or if I write it more generally, then I’d have an extra sub call: for nil-if-any( $xml.elements(…) ) { … } which is only marginally nicer looking 20:49
sena_kun m: my $a = (Any); for $a.grep(*.defined) { .say }
evalable6
gfldex guifa: if you want a keyword followed by a container and a block, like with `for`, you have to create a slang.
you could guard it with a multi sub that does the tranform you need 20:50
sena_kun probably the easiest option without creating a specific and ugly bycicle with slangs/patching
m: my $a = (Any); for $a.grep(so *) { .say }
evalable6
sena_kun and not so type-heavy, and doesn't add a level of indentation 20:51
s/type/typing/
sena_kun guifa, what do you think about ^? 20:53
guifa the .grep(so *) I think would be the cleanest. I hadn’t thought of that for some reason
sena_kun :)
gfldex m: my \e = (Any,); multi sub guard((Any,)) { () }; multi sub guard(\a) { \a }; for guard(e) { say "run!" } 20:56
evalable6
gfldex guifa: ^^^ A better name as guard for guard would be better.
Also you could guard against other nasties by adding more multies. 20:59
Or just wrap the bloody thing. :) 21:00
guifa Haha. I know. All of this would have been solved if the XML returned Nil for inexistant matches 21:01
nebuchadnezzar lucs: thanks, it was that post from jnthn :-D
guifa Actually, that is probably a good general question that I might make on SO as well for more general audience 21:02
gfldex guifa: it has to return Empty. Nil will iterate once.
guifa Huh, weird. In my tests for Nil { } didn’t iterate 21:03
gfldex if it is bound, it will
guifa But weird … now it is
nebuchadnezzar jnthn: thanks for sourcing the Alan's quote you did in 6guts.wordpress.com/2016/11/25/per...ood-thing/ :-D
guifa But actually that is a more general Q that I ought to probably post on SO for the more general audience 21:04
nebuchadnezzar hmm, interesting, as a non english native I was wondering if it was “thanks for sourcing the quote you did” or “thanks for sourcing the quote you made”
lucs nebuchadnezzar: Apparently, he didn't recognize it when you mentioned it :)
guifa When should a sub/method return (Any) and when should it return Nil? Because both seem to get used in similar ways.
sena_kun Nil when there is nothing, `(Any)` when there is a single element of something and it is not initialized 21:05
nebuchadnezzar lucs: but he gave me the source of the quote: “I’m sorry that I long ago coined the term “objects” for this topic because it gets many people to focus on the lesser idea. The big idea is “messaging”…”
timotimo i would actually return Empty instead of Nil
gfldex m: sub nilish() { Nil }; for nilish() { say 'oi‽' }
evalable6 oi‽
timotimo when there's nothing
lucs nebuchadnezzar: it took me a while to find, I knew I'd read something like that in the past but couldn't remember where.
timotimo guifa: .grep(so *) will not do what you mean
m: say so *
evalable6 { ... }
lucs nebuchadnezzar: Yeah, Alan Kay.
timotimo oh
apparently it will. okay never mind! :)
sena_kun timotimo, yes, that's an option too... then what about Nil? :) 21:06
timotimo Nil can be returned when you want the "returns a container to its default value" semantics
i think Nil is a sensible return value for when you're expecting to get an element, but it's not there ("not in list")
and Empty is for when you expect a list, but there are no elements to give back
guifa So basically, use Empty as the list-y Nil 21:07
guifa I’m going to post it on SO later if anyone wants to ellaborate on it 21:09
nebuchadnezzar lucs: jnthn: thanks, I could made my answer on #mastodon ;-) 21:18
nebuchadnezzar lucs++ 21:18
jnthn++
lucs nebuchadnezzar: Hey, you're welcome 21:20
gfldex m: sub return-a-list( --> List:D ) { Nil }; for return-a-list() { say 'Should this happen?' } 21:38
evalable6 Should this happen?
gfldex guifa: please note ^^^
kawaii does anyone know why when I use my Test datasouce I get an array and why when I use my DBI one I get a nested array? 🤔 22:20
github.com/kawaii/p6-pokeapi/blob/...pm6#L8-L17
github.com/kawaii/p6-pokeapi/blob/....pm6#L5-L8
the DBI one is literally pulling `["default", "alolan"]` from the database field 22:21
yet I end up with something like `[[default alolan]]`
a nested array, when the Test datasource takes `my @forms = <default alolan mega altered>;` and gives me the correct answer of `Array @forms = ["default", "alolan", "mega", "altered"]` 22:22
timotimo it's from-json's fault 22:27
it returns the result itemized
you can my @forms = from-json($query.row)<>
.list should also work instead of <>
kawaii hey that fixed the nesting! 22:29
`[default alolan]` isn't quite right still
timotimo probably just the .gist instead of the .perl 22:31
kawaii ah you 22:32
were right
`Array $forms = $["default", "alolan"]` :)
Juerd "Only isolated underscores are allowed inside numbers" 22:47
Why is that? This seems oddly specific... 22:48