»ö« 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.
randc it seems like if I create a multi-line string with qq:to/END/ and then print it later with say there an extra newline... is there a way to not have an ending new line in my string or do I need do go through and change all my says to prints? 01:37
timotimo you can have qq:to/END/.chomp for that purpose 01:39
randc oh cool... let me try that
that worked perfectly. thanks! 01:41
timotimo glad to hear it 01:42
jmerelo squashable6: status 06:24
squashable6 jmerelo, ⚠🍕 Next SQUASHathon in ≈21 hours (2019-07-06 UTC-14⌁UTC+20). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
jmerelo We're almost there!
Geth doc: a314d6d61d | (JJ Merelo)++ | doc/Language/classtut.pod6
Adds clarification and examples for class and class hierarchy vars

This closes #2876 which, besides, did have a bug using attribute syntax for class variables, which does not make a lot of sense.
07:05
synopsebot Link: doc.perl6.org/language/classtut
doc: ef8b0d2c3e | (JJ Merelo)++ | doc/Language/classtut.pod6
Clarifying visibility of variables refs #2876
lizmat . 08:53
El_Che lizmat: ... 09:10
lizmat dot 09:13
antoniog1miz m: sub b(){say "b";}; "b"(); 09:40
camelia No such method 'CALL-ME' for invocant of type 'Str'
in block <unit> at <tmp> line 1
antoniog1miz what's the correct way of do that?
s/do/doing 09:41
sena_kun just "b" 09:44
ah, stop
m: sub b(){say "best" }; ::('&b')(); 09:45
camelia best
sena_kun why you want to do it is another question
antoniog1miz I have several functions which a share a part of the name and I need to call them all 09:46
so I though it would useful to use that
though seeing the syntax I do not know if will be helpful for the code readability 09:47
sena_kun: ty :D
sena_kun if you know them beforehand, why not just create a list of names and iterate?
m: sub a {1.say}; sub b {2.say}; my @a = &a, &b; for @a -> &f { &f() } 09:48
camelia 1
2
antoniog1miz :o
you're a magician
well, perl6 is magic
sena_kun routines are first-class citizens, so they are not much different from "normal" values you can operate on. 09:49
xinming_ :(@ra1, @ra2) := <10 20>.map(...); 12:02
stackoverflow.com/questions/564673...nto-arrays The example is from this url, What does the : infront of (@ra1, @ra2) mean?
IIRC< :(...) is syntax for signature
Why can we make use of it in this case?
jnthn Because destructuring in Perl 6 is achieved using signatures 12:20
The :(...) is a signature literal
And a bind to a signature triggers signature binding 12:21
uzl .seen jmerelo 14:29
yoleaux 1 Jul 2019 14:20Z <AlexDaniel> uzl: plz :) gitlab.com/uzluisf/quine-mccluskey...requests/1
I saw jmerelo 06:24Z in #perl6: <jmerelo> We're almost there!
timotimo cool, i remember doing that algorithm in school 14:30
uzl .tell jmerelo What does mean the "Class variables use the same syntax" here: github.com/perl6/doc/commit/a314d6...df696R300?
yoleaux uzl: I'll pass your message to jmerelo.
uzl .tell What comes to mind is that they use twigils but I'm probably mistaken though. 14:31
yoleaux uzl: I'll pass your message to What.
uzl AlexDaniel: Will take care of that. Thanks! 14:32
antoniog1miz uzl: you put .tell What 14:33
s/put/typed 14:34
uzl antoniog1miz: Oh, my! Thanks!
.tell jmerelo What comes to mind is that they use twigils but I'm probably mistaken though. 14:35
yoleaux uzl: I'll pass your message to jmerelo.
antoniog1miz :D
antoniog1miz man curl 15:19
antoniog1miz ups 15:19
jmerelo releasable6: status 15:21
yoleaux 14:30Z <uzl> jmerelo: What does mean the "Class variables use the same syntax" here: github.com/perl6/doc/commit/a314d6...df696R300?
14:35Z <uzl> jmerelo: What comes to mind is that they use twigils but I'm probably mistaken though. 15:22
releasable6 jmerelo, Next release will happen when it's ready. R6 is down. At least 1 blocker. 492 out of 667 commits logged
jmerelo, Details: gist.github.com/c2d24c49a5b5d3ae78...e1f60f24cb
jmerelo .tell uzl: you're probably right...
yoleaux jmerelo: What kind of a name is "uzl:"?!
jmerelo .tell uzl you're probably right... 15:23
yoleaux jmerelo: I'll pass your message to uzl.
xinming_ why can't unicode be used as enum value directly? 16:06
We need to use fully qualified quoted name for that. Isn't enum value a normal unicode indentifier? 16:07
jnthn m: enum пити <вино пиво>; say пиво; 16:09
camelia пиво
jnthn Looks OK to me?
It'd need to be word characters, though, to follow the identifier rules. 16:10
jmerelo jnthn: right. We can only use alphabetic characters directly. 16:12
xinming_: enums with "identifier" syntax can be used directly, if I remember correctly. For any other you need to use its FQN 16:13
m: enum numbers <1 2 3>; say 1 16:14
camelia 1
jmerelo m: enum numbers <1 2 3>; say numbers::<1>
camelia 1
jmerelo m: enum numbers <don't you-say that_thing>; say numbers::<don't> 16:15
camelia don't
jmerelo m: enum numbers <don't you-say that_thing>; say numbers::<ss>
camelia (Any)
jmerelo m: enum numbers <don't you-say that_thing>; say don't 16:16
camelia don't
jmerelo So right, identifier syntax.
ugexe m: enum x <1s 2s 3s>; say ::("1s") 16:17
camelia 1s
ugexe no FQN required 16:18
ugexe then again its indirect, so pick your poison 16:18
jmerelo ugexe++ 16:19
TimToady you can still make anything a term with term:<> 16:37
jmerelo TimToady: but you would need to term-ize a set of unicode codepoints to make them members of a enum posse, right?
TimToady: you would save some typing, though...
TimToady yes, it's in the category of things that are possible, not the things that are easy :) 16:38
jmerelo m: enum termizer ( term<1s>, term<2s> ); say 2s 16:39
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
term used at line 1
jmerelo m: enum termizer ( term:<1s>, term:<2s> ); say 2s
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
term:<1s> used at line 1. Did you mean 'term:<now>'?
term:<2s> used at line 1. Did you mean 'term:<now>'?
vrurg m: sub term<1s> { "1s?" }; say 1s 16:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3sub term7⏏5<1s> { "1s?" }; say 1s
expecting any of:
new name to be defined
vrurg sub term:<1s> { "1s?" }; say 1s
evalable6 1s?
jmerelo m: sub term:<1s> {"1s"}; term:<2s> {"2s"} ; enum termized <1s 2s>; say 1s
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
term:<2s> used at line 1. Did you mean 'term:<1s>', 'term:<now>'?
jmerelo m: sub term:<1s> {"1s"}; sub term:<2s> {"2s"} ; enum termized <1s 2s>; say 1s
camelia 1s
jmerelo m: sub term:<1s> {"1s!"}; sub term:<2s> {"2s!"} ; enum termized <1s 2s>; say 1s 16:42
camelia 1s!
jmerelo Well, we are not earning much there...
TimToady m: enum termizer ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say 2s 16:43
camelia 2S
jmerelo TimToady: ah, OK. 16:44
TimToady m: ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say 2s
camelia 2S
TimToady the enum isn't actually necessary there...
jmerelo m: enum termizer ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say termizer 16:45
camelia (termizer)
jmerelo m: enum termizer ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say termizer.pick
camelia 2S
jmerelo Hum
m: enum termizer <1S 2S>; say termizer.pick 16:46
camelia 2S
jmerelo m: enum termizer ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say ::("1s")
camelia No such symbol '1s'
in block <unit> at <tmp> line 1
jmerelo m: enum termizer ( (constant term:<1s> = "1S"), (constant term:<2s> = "2S") ); say ::("1S")
camelia 1S
TreyHarris Any cases to think about where `cmp-ok($got, &[==], $expected)` should be preferred over `is($got, $expected)` except for allomorphs? I was about to write an `is-equal` but I realized that's so obvious there must be a reason it isn't included. (I know `ok` is even simpler but you don't get the automatic diagnostics; OTOH, `cmp-ok`'s saying `# expected: 5␤# matcher: 'infix:<==>'␤# got: 4` is kinda 17:23
crufty itself
s:s/cases to think/cases (of Numerics) to think/
TimToady still thinks we want to have a way of turning any comparison operator used in sink context into a test that knows how to report its arguments 17:31
then you just write $got == $expected plus some kind of title 17:36
TimToady and maybe without 'use Test' such tests are optimized out, or merely warned about if false 17:39
or maybe we turn 'ok' into a macro that can disect a comparison 17:40
TreyHarris TimToady: hah, we were thinking along the same lines, I was just squinting at pragmas to see if I could fake it that way 17:41
I mean, cmp-ok is nearly there already if it were generalized and turned inside-out. If that makes any sense
TreyHarris Wait... we currently don't have wantarray _and_ we can't multi on context? 17:43
TimToady either of those would involve time travel
TreyHarris So how do you write something that behaves differently in sink context? 17:44
TimToady the parser knows what is in sink context 17:44
or it couldn't warn about it :) 17:45
TreyHarris Right, but user code doesn't have access to that like Perl 5 did?
TimToady m: 1 == 2
camelia WARNINGS for <tmp>:
Useless use of "==" in expression "1 == 2" in sink context (line 1)
jnthn You return an object with a `sink` method. It will be called if the thing is in sink context.
moritz m: class A { method sink() { say "thunk"} }; A.new()
camelia thunk
TimToady we are not users :)
it seems to me that there's a large piece of syntactic relief we could provide here 17:46
TreyHarris Sorry, I was thinking #perl6 vs #perl6-dev. Changing how the language works has a proud tradition in Perl, but I think there's a bright line between what can be done in pure-Perl ("user code", I was calling it) and what requires nqp or other other languages 17:47
TimToady well, anything is possible 17:47
TreyHarris jnthn: but yes, I forgot about that; that's generalizable, is it not, for `list`, etc.? This doesn't seem to be documented
jnthn Yes, .list and .hash are similar context-y things 17:48
TreyHarris jnthn: but it isn't productive, is it... and is it even currently exhaustive? how do you specify stringy or numy context? 17:49
ah, .Numeric
jnthn .Stringy, .Numeric
evalable6 Use of uninitialized value $_ of type Any in string context.
Methods .^name, .perl, .gist,…
17:50
jnthn, Full output: gist.github.com/c75c8a351690725077...c1bce0156d
jnthn haha
dinner time &
TreyHarris that's a bit odd though, being uppercased unlike .sink and .list and .hash... I get why, since context isn't congruent with coercion except when it is, and when it is it might as well look like coercion
TimToady you know that all human languages are most irregular in the most used bits 17:51
TreyHarris Huffman encoding in action, or linguistic drift by regularization, take your pick 17:52
TreyHarris Er... Huffman "coding". I said "coding". I never called it "encoding". 17:52
TimToady well, and it's also an information theory thing, where irregularity provides more redundancy in some cases
TreyHarris TimToady: off-topic, I bet you know the term I've been wracking my brain for... a loop structure first described as being distinct from the classical for-foreach-while-until in the 60's or 70's I think, by Wirth or Dijkstra maybe? Its most common application is for I/O loops or pipeline operators and has the property that there is code both before and after the condition, which is typically invariant. if a 17:59
language like Perl 6 supports it, it lets you easily do stuff like join(); languages that don't have to fake it out somehow by including (often redundant) code outside the loop or having unwieldy logic inside it to handly first and last cases
TimToady these days those are called loop-and-a-half, but I do have a hazy recollection of some more esoteric term once 18:05
TreyHarris When the condition is a flip-flop and the code below the condition should make the loop exit after it flips, it's a guarded command. But I think there's another term besides loop-and-a-half, but yes, that will do for now, thanks 18:08
TimToady I think Dijkstra actually called it Premature Loop Exit when he was trying to discourage it 18:18
TreyHarris It was Dijkstra, and he apparently first called it "loop and a half" in reply to Knuth's reply to Go To Considered Harmful
Yes
exactly
"loop and a half" was intended to be pejorative, but Knuth liked it and adopted the term and it stuck, looks like 18:19
TimToady from googling, looks like Wirth tended to call them 'multi-exit' 18:20
TreyHarris Wirth was involved in that he proposed an extension to Pascal to have "sentinel loops" and his post-Pascal languages all... okay, we're doing the same Googling now :-)
TimToady though obviously if you write an explicit infinite loop, a loop-and-a-half has only one exit :) 18:23
TreyHarris TimToady: could you feel the quake where you are?
TimToady it comes with quakes? 18:23
TreyHarris 6.6 in LA? 18:24
Er, Ridgecrest.
TimToady and Searles Valley, wherever that is... 18:26
antoniog1miz tbrowder: thanks a lot for your commits :) 18:27
TimToady that's at least 200 miles from here
I think we might feel one from that far away only if California were a solid piece of rock, which it ain't 18:29
TimToady blames earthquakes... 18:30
TreyHarris It was felt more than 200 miles away to the southwest, but that's the other side of most of the faults
TimToady I did feel the old Coalinga quake from Camarillo, but that was closer and bigger 18:31
where a quake is felt in California has more to do with resonances than distance 18:32
deep coastal sediments tend to amplify the lower frequencies of distant quakes 18:36
where we felt the Coalinga quake, it had a period of about 2 seconds 18:37
Mountain View is in a relatively shallow bowl of sediment, compared to San Jose, so they might've felt it there 18:41
probably also depends on the directionality of the focal mechanism 18:42
TreyHarris The shakealert app apparently didn't work, though from USGS's end they say it should have, they got the prediction in time. Can't wait to see that post-mortem. Dollars to donuts it's bad UI design like happened with the Hawaii false missile alert. 18:53
TimToady well, the USGS doesn't *really* care about SoCal, since they're up here in Menlo Park :) 18:54
TreyHarris Like a pop-up that if the operator is already using the system and happens to click at the right (wrong) moment in the right (wrong) place they dismiss it and suppress the alert
TimToady: the briefing I just watched was the CalTech geology department's office 18:55
TimToady ah, yes, they care about SoCal a bit more for some reason...
the last time I was at CalTech was to sneak onto campus to watch their big-screen coverage of Voyager's Uranus flyby... 18:57
(by Neptune I could watch it at JPL :) 18:58
TreyHarris 'course, the problem with shakealert (and why there's been little enthusiasm for pushing it on people) is that it only starts becoming effective at a distance where damage and injury becomes less likely
TimToady well, they really want it for the Big One, which will come from a distance and that won't matter much :) 18:59
(that it comes from a distance, that is) 19:00
that being said, I'd much rather go through an 8.0 in California than a 7.0 in any city constructed of unreinforced masonry 19:02
timotimo aye, same problem with climates that are uncharacteristically hot, cold, and/or dry hitting places 19:05
you can probably survive 40degC in a place that has 35degC almost every year, but a place that usually sees up to 15degC will be constructed with houses that keep the heat in as effectively as possible, and the outside is probably sprinkled with places where people can conveniently take in the sun if and when it comes 19:06
rather than having shade accessible all over the place 19:07
TreyHarris like Anchorage... a city that's only once before hit 30degC once is about to have four days in a row at 31 19:08
timotimo that's terrible
my heart goes out to the people having to suffer through that
i hope the elderly are all cared for, i seem to remember they are especially at risk? 19:09
OTOH, a heatwave is always a fantastic opportunity for people to sell fresh water at exorbitantly high prices 19:10
and if a few people have to die so that someone can make good profits, i guess that's a socially accepted trade-off by now
TimToady well, they have plenty of ice nearby they can visit
timotimo oh, anchorage is pretty tiny it seems like 19:11
oops, that's just one city i suppose 19:12
oh, i was completely mistaken
TreyHarris tiny in poplation, perhaps. It's actually the largest city in area in the country because it has a mountain in the middle of it (and Alaska consolidates city and country governments into "boroughs", so Anchorage city legally is much larger than the settlements) 19:14
TimToady of course, if you're up there, the earthquake can be a 9.2, and then it doesn't matter much how well things are built... 19:14
jk, it still matters, but most structures don't have to put up with harder shaking, just longer 19:15
masak TimToady: maybe I'm being too conservative here, but I wouldn't mind at all prefixing an assertion expression with a keyword-like marker/listop, such as `assert $expected == actual();` or `expect $expected == actual();`. without that, at least to me, it feels "too magical" 19:16
TimToady sure, I can buy that 19:17
though assert is a bit long and has historical fatal baggage
timotimo yeah, we live in a capitalist society, you can literally buy anything
masak aye, I like `expect` slightly better.
timotimo "hopefully"
TimToady I like "ok" since we already claimed it 19:18
TreyHarris how about an overloaded "so" in sink context? "so, $foo equals $bar. (given that), I'm now going to...."
TimToady just make it capable of taking its first expr to bits 19:18
timotimo "so, $foo eq $bar, right?" 19:19
TimToady so in sink context could still be an unintentional error
timotimo TreyHarris: have you seen "Like, Python"?
TreyHarris "so" and "ok" are semantically equal in vernacular in that usage.
TimToady
.oO(as opposed to an intentional error?)
so, $foo eq $bar, like, and stuff? 19:20
TreyHarris "ok, $foo equals $bar. in that case, I can now..." s/ok/so/, same idea
timotimo i mean, you can literally make that a slang 19:20
TimToady $foo eq $bar means "The foo matches the bar" 19:21
but then the comment isn't optional, which is arguably a feature 19:22
TreyHarris stuff like "so $foo eq $bar or die" seems very likely to confuse... I'd vote "ok". "ok $foo eq $bar or die" will be clearly weird
TimToady yes, 'ok' is already in the correcter semantic slot 19:23
'ok' is expected to have side effects, while 'so' is not
.oO(Please okay this.)
19:24
timotimo has anybody considered a ternary for this purpose 19:25
TreyHarris I'll never come up with a better name for some semantics than you, TimToady. Except the one time I did, and I remember being pleased for days that you had agreed to my suggestion, but I can't remember what it was. I'd have to re-read the original Apocalypses to remind myself.
TimToady but it seems to me we could make ok that sort of macro, with the current syntax, and if it didn't find a comparison as the topmost operator of the first expr, just revert to the current behavior
TreyHarris
.oO(Possibly it was a case where I suggested `else` replacing a dedicated word that didn't need to be reserved for the purpose? Or vice versa when `else` was originally there but sounded very wrong? Hmm.)
19:29
(It was back in Pugs days so at least 11 years ago, when we could finally write running Perl 6 code and started to see some rubber/road interactions.) 19:31
TimToady: Yes, I like that. A word that's already devoted to testing can be more easily optimized out, too 19:32
lizmat weekly: blogs.perl.org/users/laurent_r/2019...ption.html 19:33
notable6 lizmat, Noted!
TreyHarris Assuming there were an optimization flag that would end up turning most .t files into semantic nothingness
Kaiepi squashable6, status 20:36
squashable6 Kaiepi, ⚠🍕 Next SQUASHathon in ≈7 hours (2019-07-06 UTC-14⌁UTC+20). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
Kaiepi oh, thought it was today
tbrowder .tell antoniogamiz you're welcome, but you've done the hard part! 23:22
yoleaux tbrowder: I'll pass your message to antoniogamiz.
irced hey all, I started several promises but they do not seem to be running asynchronously. do I need to go lower level? 23:47
irced any suggestions on calling a subroutine asynchronously to do work on several threads besides promise? 23:55
jnthn Depends on the work you're trying to parallelize, really. 23:57
What does your code look like, and what measurements lead you to believe that things aren't running asynchronously? 23:58