🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
00:13 p6steve left 00:26 p6steve joined 00:31 p6steve left 00:56 lichtkind left
codesections m: class A { my atomicint $n = 0; has Int $.id=$n⚛++ }; say A.new; dd A.new; 00:58
camelia A.new(id => 0)
A.new(id => 1)
codesections is ^^^ correct/threadsafe, or does $.id need to be an atomicint too?
00:59 p6steve joined
moon-child correct wrt what? 01:00
if $.id is never mutated concurrently then that's fine 01:01
codesections ok, thanks, that's what I was asking 01:02
(And what I thought)
01:04 p6steve left
codesections (And with that API, it can't be mutated – concurrently or otherwise. Though of course it could be it more methods were added) 01:05
01:17 p6steve joined 01:21 p6steve left 01:29 colomon joined 01:31 colomon left 01:49 p6steve joined 01:52 rbt left 01:53 rbt joined 01:54 p6steve left
Xliff codesections: New advent PR up! :) 02:04
Day 19 was a bit evil.
codesections Merged! 02:05
Xliff Thanks
02:08 p6steve joined 02:13 p6steve left
japhb advent of what? 02:14
codesections github.com/codesections/advent-of-raku-2020
02:34 ggoebel joined 02:42 p6steve joined
moon-child m: say (√5) 02:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus statement
at <tmp>:1
------> 3say (7⏏5√5)
expecting any of:
prefix
term
moon-child thoughts on prefix:<√> = &sqrt ?
(and infix:<√>(\b, \x) = x ** (1/b)) 02:47
02:48 p6steve left 02:59 p6steve joined
codesections m: say "what's wrong with { 5¯² }?" 03:03
camelia what's wrong with 0.04?
03:04 p6steve left
moon-child well, nothing's _wrong_ with it. One might as easily say: why have map, what's wrong with for? 03:05
TIMTOWTDI :)
codesections Fair :) 03:06
moon-child (also, your example doesn't work and I don't think there's a superscript / or ., so there's no concise way to do it atm) 03:07
GreaseMonkey Python philosophy of "There should be one-- and preferably only one --obvious way to do it" leads me to believe that the obvious way to implement a switch block is to use a dict which may or may not consist of callables
moon-child hmm, should 5 ** (1/3) be written 3√5 or ³√5?
GreaseMonkey i really need to learn the second part of tim toady bicarbonate because that sounds like the right philosophy
moon-child that is, should the latter syntax be enforced?
GreaseMonkey: I believe it goes 'but sometimes consistency can be a good thing', or something to that effect 03:08
GreaseMonkey i'm surprised that prefix:<√> doesn't exist, but the ¯² thing does 03:09
codesections I'd say so 3√5 looks too much like 3 x √5 (especially given the math context)
GreaseMonkey good point
moon-child truue 03:10
while we're dreaming can we get log₂8 = log(8,2)? 03:11
GreaseMonkey sub log₂8() { 2 } 03:12
wait that should be 3, not 2, whoops 03:13
codesections m: my %h is default(42); say %h<foo> 03:14
camelia 42
codesections is there any way to do ^^^^ with a $-sigiled Map?
03:14 ggoebel left
codesections m: my Map $m is default(42) 03:14
camelia 5===SORRY!5=== Error while compiling <tmp>
Default value '42' will never bind to a parameter of type Map
at <tmp>:1
------> 3my Map $m is default(42)7⏏5<EOL>
expecting any of:
constraint
03:32 p6steve joined
raydiak m: my % is Map is default(42) 03:33
camelia 5===SORRY!5=== Error while compiling <tmp>
is default on shaped Map not yet implemented. Sorry.
at <tmp>:1
------> 3my % is Map is default(42)7⏏5<EOL>
expecting any of:
constraint
raydiak ^ not sure that default works on Map at all atm
codesections Ah, makes sense. 03:34
raydiak or else that syntax confuses it... 03:36
m: my % is Hash is default(42)
camelia 5===SORRY!5=== Error while compiling <tmp>
is default on shaped Hash not yet implemented. Sorry.
at <tmp>:1
------> 3my % is Hash is default(42)7⏏5<EOL>
expecting any of:
constraint
raydiak but...
m: dd my % is default(42)
camelia Hash % = {}
03:36 p6steve left
raydiak not sure which part of that it thinks is a shape declaration :) 03:37
anyway, if you could do with a Hash, you could at least write 03:38
m: my $h = (my % is default(42)); say $h<foo>
camelia 42
moon-child m: my %a; my %b is Hash; say %a eqv %b 03:39
camelia True
codesections m: my Map() $h = (my % is default(42)); say $h<foo> 03:40
camelia 42
codesections m: my Map() $h = (my % is default(42)); say $h<foo>; say $h.WHAT
camelia 42
(Hash)
raydiak rememeber that Hash is a Map, so it does pass your type constraint :) 03:41
codesections ...oh, right
that one still seems backwards to me 03:42
m: say SetHash ~~ Set; say Set ~~ SetHash
camelia False
False
raydiak dinner &
03:46 guifa joined 03:47 guifa left 03:49 dogbert17 joined 03:50 dogbert11 joined 03:53 dogbert17 left 04:06 p6steve joined 04:11 p6steve left 04:20 dogbert17 joined 04:23 dogbert11 left 04:24 p6steve joined 04:28 p6steve left 04:30 coverable6 joined 04:40 p6steve joined 04:45 p6steve left 04:58 p6steve joined 05:02 p6steve left 05:05 hankache joined 05:16 p6steve joined 05:20 reportable6 joined, p6steve left 05:32 p6steve joined 05:36 p6steve left 05:49 p6steve joined, p6steve left 06:02 reportable6 left 06:11 muffindrake joined
muffindrake Hey, where can I get the raku docs on one page or one file? 06:11
The one-page view on the website is a 404 06:12
06:28 stoned75 joined
raydiak yes the docs have grown some wrinkles over the years that we're working on ironing out. it looks like you can still find that at docs.raku.org/perl6.html though some of the anchor links here and there seem to be broken 06:47
muffindrake That'll work nicely, thanks! 06:51
raydiak happy to help
moon-child m: +"-²" 06:54
camelia WARNINGS for <tmp>:
Useless use of "+" in expression "+\"-²\"" in sink context (line 1)
Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3-⏏5²' (indicated by ⏏)
in block <unit> at <tmp> line 1
moon-child whyn't?
given 06:56
actually, forget the -; why doesn't +"²" evaluate to 2?
07:10 dolmen joined 07:15 reportable6 joined 07:16 raydiak joined
raydiak m: say (+"²").backtrace.full 07:17
camelia in block at SETTING::src/core.c/allomorphs.pm6 line 290
in sub parse-int-frac-exp at SETTING::src/core.c/allomorphs.pm6 line 349
in sub parse-simple-number at SETTING::src/core.c/allomorphs.pm6 line 525
in sub parse-real at SETTING::src
raydiak definitely a bug, that's what I'm following to try to track it down
near as I can tell so far, the problem is likely somewhere in github.com/MoarVM/MoarVM/blob/mast...1581-L1731 07:28
.u ²
unicodable6 raydiak, U+00B2 SUPERSCRIPT TWO [No] (²)
raydiak I suppose the other question is why it works outside of a string...maybe we're handling that before it gets passed to moar through nqp, like in the grammar/actions or something 07:32
MasterDuke it's an operator, it doesn't have a numeric value. see src/Perl6/Actions.nqp:8072 07:43
raydiak but 07:44
m: say ²
camelia 2
raydiak m: say ².WHAT
camelia (Int)
07:46 Doc_Holliwood left
raydiak seems like val() ought to reflect that, no? 07:49
dpk m: say '²' 07:51
camelia ²
dpk oh, i see why
m: say ५ + ४ 07:52
camelia 9
raydiak yes we support any unicode numeric chars. but the superscripts like ² have dual meaning. it can be used as a term, or as a postfix exponentiation operator 07:55
m: say ²; say 2² 07:56
camelia 2
4
moon-child m: say ²² 07:59
camelia 4
moon-child another thing--should "2²" == 4? 08:00
imo yes, but
raydiak idk about expecting that string to numify by itself. ² is an operator in that context, not part of the term 08:01
ecocode- lizmat: is logs.liz.nl running on your laptop?
moon-child - is also an operator, but "-2" == -2
raydiak val() handles negative numbers, decimals, scientific notation, and radixes. that is all. not operators. yes prefix - parses as an op in raku, but that is a different semantic than what val() does 08:04
dpk personally it seems like a bad idea to me to give special behaviours to characters that will change if a source code file gets saved in NFKC or NFKD
raydiak you can only directly numify strings that look like some form of a number, not whole mathematical operations. you'd have to EVAL for full math op functionality, and that is expected and good (for performance) 08:05
moon-child why does 1e2 look like some form of a number, but 10² does not? 08:06
obviously I wouldn't expect to numify e.g. 5×10 or x² or anything like that
dpk: afaik raku normalizes everything, so I don't think it would make a difference? 08:07
raydiak I'd guess it's just a typical convention we carried over from most programming languages. most of them treat scientific notation as a single term, not an operator. sci notation is allowed in all kinds of places where you can't put operators. like json, for one out of countless examples 08:09
dpk regardless of what Raku does, my editor might perform a compatibility normalization when i save
if i paste source code onto some website, that website might do compatibility normalization, etc
(the 'K' in the normalization forms)
² normalizes in those forms to a normal 2 08:10
raydiak I don't know enough about the nitty-gritty of unicode to have anything intelligent to offer about that. hopefully more people will chime in soon here. it's morning in europe, so maybe... 08:11
08:12 ecocode joined
raydiak if you want a logical argument for why e notation is a term and not an op, I can't give you one because I really don't agree with it. it's just been like that in tech for longer than I've been alive. if you ask me, anything other than nonnegative integers should be an op. not e, not negative, not decimals. I even wrote a toy parser which works that way 08:19
moon-child that's fair 08:20
Altreus sounds like implementation details 08:21
I suppose if they leak through in val() that's worthy of a debate before raku properly solidifies 08:22
raydiak well we got here talking about val("²")
m: say ² 08:23
camelia 2
raydiak m: say +"²"
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5²' (indicated by ⏏)
in block <unit> at <tmp> line 1
08:23 rbt left, rbt joined
Altreus m: say val("1+2") 08:24
camelia 1+2
Altreus m
raydiak m: say +"1+2"
camelia Cannot convert string to number: imaginary part of complex number must be followed by 'i' or '\i' in '031+2⏏' (indicated by ⏏)
in block <unit> at <tmp> line 1
Altreus m: say +"1+2i" 08:25
camelia 1+2i
raydiak heh, didn't even know cal handled complex...
s/cal/val/
Altreus That's another not-operator construct then
At least there's not just one
raydiak seems so
08:26 ecocode_ joined
moon-child hmmm, that is also handled inconsistently 08:27
m: say -2.abs; say -2 .abs; say (-2).abs; say 1+i.abs; say 1+i .abs; say (1+i).abs
camelia -2
2
2
2
2
1.4142135623730951
Altreus binding I guess 08:29
I'm starting to think that I disagree with raydiak and I'd prefer things *not* to be operators! 08:30
nah that's not logically sound
But mathematical operators should probably bind tighter to numbers than other language constructs
cos it seems quite likely that you intended to apply the maths to the number
moon-child apl goes that way. monadic - is negation, but ¯ is used for negative literals. j joins the real and imaginary parts of complex numbers (so 1j2 in apl is 1+2i in raku)
Altreus Sure, but if raku did everything as operators and normalised maths at compile time then 1+2i is the same as x+yi 08:31
instead of a specially-parsed string
raydiak but if you make it bind tighter to numbers, then when you substitute in $n, the behavior becomes inconsistent with literals 08:32
moon-child yeah. That's why apl uses different symbols for each
e.g. you can't say ¯x, only ¯5
raydiak interesting 08:33
moon-child (-5 and -x are both ok, though there's no very good reason to write -5)
08:33 rbt left
Altreus raydiak: that makes sense, but then unary minus seems like it should bind tighter than method calls anyway 08:33
-$x.foo always means (-$x).foo in my reading
ah but what of the others 08:34
moon-child I think the current precedence is better
Altreus $x+$y.foo
moon-child most methods are not on numbers, but many methods on non-numbers may return numbers. so -($x.foo) is more common than (-$x).foo
Altreus this is hard, let's go shopping
raydiak I can also see an argument for parsing prefix - as part of the term instead of an op at all 08:35
Altreus Is it bad that literals are treated differently from variables? 08:36
Altreus question everything
moon-child yes, and also you have problems with $x -1
Altreus cos an expression containing entirely literals can be entirely collapsed at compile time anyway 08:37
Ah, now we're talking
See in my head I've always liked the idea that spacing matters
moon-child really? I _hate_ that
Altreus -1 is a number so $x -1 is $x * -1
moon-child and raku agrees with me--whitespace is insignificant in regexes, unlike in literally every other languages' regex 08:38
also raku doesn't multiply adjacent terms, which would be a _big_ change
raydiak we don't have implicit multiplication because it leads to even more rabbit holes. I considered it in math::symbolic and...went shopping instead :)
Altreus true, I'm talking a bit more abstract than the language allows
But I think that's exactly why we can get away with no significant whitespace 08:39
Because there's no other interpretation of $x -1
moon-child til math::symbolic
Altreus although it wouldn't pass code review
moon-child that is cool
Altreus speaking of code review I should do $work work 08:40
raydiak e.g. I couldn't figure out which way people would expect x√y to work, things like that. and it has named vars, so is ab "ab" or "a*b"? all kinds of nasty business 08:43
moon-child I think the ultimate evolution of any cas is towards mathematica. Where you write something like nth-root(x, y), and it is rendered with a superscript x 08:46
i.e. syntax is not super important, and input and display need not be completely commensurate
raydiak m::s does that in places. e.g. x^2 will become x². it has a separate root op from exponentiation, though 08:48
evalable6 (exit code 1) 04===SORRY!04=== Er…
raydiak, Full output: gist.github.com/c07d2e69cce1da6398...029894a49d
raydiak heh oops. wasn't talking to you, evalable6 08:49
moon-child the mathematica cli renders x^2 as
2
x
which is kinda ugly on the one hand, but also more consistent (if you have, e.g. x^x) 08:50
raydiak true. I just revert to ^ in that case. but the strings it outputs are all usable as inputs, so keeping it all concisely on one line has its advantages
not that m::s is anything to compare with a serious cas like mathematica. it was a fun project, would need heavy refinement, expansion, and optimization to be a serious thing 08:52
it has bugs too, in places which are hard to track down and work with because I was too clever back then, wrote some really dense knots 08:54
passes all its tests and everything, but sometimes when I try to shove longer more complex stuff through, it chokes 08:56
moon-child well it still does more than my abandoned cas :)
raydiak the whole thing actually started as just a fun way to learn raku grammars... 08:57
I didn't even know actions yet so for a long time it just did this instead: github.com/raydiak/Math-Symbolic/b...L918-L1007 :D 08:59
09:00 Kaiepi left
raydiak one of many things I mean by "too clever" 09:01
09:02 hankache left, hankache joined
raydiak oh yeah and I forgot all about the MultiHash...it represents e.g. 2*x^2+3*x+4 internally as a hash keyed by hash like { { x => 2 } => 2, { x => 1 } => 3, {} => 4 } . just a variety of really "interesting" stuff going on in there 09:06
lizmat ecocode: no, I use my laptop for development, and an old iMac for "production" :-) 09:07
tellable6 2021-05-27T22:04:09Z #raku-dev <[Coke]> lizmat you said you were going to close github.com/rakudo/rakudo/issues/3748 a year ago, please consider again
moon-child apl has a 'decode' primitive that can represent polynomials. 5⊥2 3 4 ←→ 2*5^2 + 3*5 + 4. So ⊥∘2 3 4 ←→ -> x { 2*x^2 + 3*x + 4 } 09:11
probably that's an easier representation to do logic on polynomials. Though it gets less attractive when you have stuff like x^2 + xy + y^2
09:14 Kaiepi joined
raydiak I can certainly see advantages to that 09:16
moon-child how come there's no complex rat?
raydiak in raku? 09:17
moon-child yeah
raydiak m: dd val("1.2+3.4i") # isn't that what this is? 09:18
camelia ComplexStr.new(<1.2+3.4i>, "1.2+3.4i")
moon-child m: say (i/2).im.WHAT 09:19
camelia (Num)
moon-child m: say (1/2).WHAT
camelia (Rat)
raydiak hm. dunno 09:20
moon-child I guess complex will mostly come out of (and go into) trig and sqrt, and so likely won't be rational anyway?
or maybe it's to allow a stronger ordering of the numeric tower? 09:21
Altreus a rat king? 09:23
raydiak probably a lot easier to implement representation of the parts as one static type than changing under different circumstances
m: say i.im.WHAT # not Int
camelia (Num)
moon-child interestingly the re and im methods return Real, but the Real method returns a Num
(though as you point out they in practice return Num even when they don't have to)
raydiak well also, Real is a role, not a class 09:25
moon-child yes, but Int does Real 09:26
and i.im could be an Int without loss of precision
raydiak oh I see what you mean. again, it probably comes down to preserving the implementer's sanity, if I had to guess. or performance maybe 09:27
and what you said about "where does this thing fit into the class heirarchy" maybe has something to do with it 09:28
especially if you start manipulating it. raku doesn't magically change a Rat to an Int if you manipulate it into something with a denominator of 1, for instance. so you'd have to coerce it to do other non-Int operations on it 09:31
m: say (.5+.5).WHAT
camelia (Rat)
raydiak I'd bet your excellent point about commonly getting irrational complex numbers out of trig ops and roots and other things has a lot to do with why they just picked Num and stuck with it 09:34
Altreus I'm sure I understand these concepts but I feel like the conversation skipped over a lot 09:42
This is what happens when knowledgeable people converse; they don't fill in the shared knowledge
raydiak I feel more like I'm just used to only having half a clue what I or anyone else is talking about :D 09:44
like my last point about Int...was probably toally wrong, because you can just take an Int and do whatever with it, and it'll gradually type to whatever is necessary for precision 09:46
in my defense, I can feel my brain getting squishy from fatigue
moon-child 'only having half a clue what I or anyone else is talking about' can definitely relate
and I am definitely somewhat incoherenent from lack of sleep
incoherent
Altreus y'all should get some rest before you start using terms like y'all 09:47
raydiak I lived in Texas for a couple years...y'all is a hard habit to break
Altreus why thank you sah 09:52
09:53 tejr joined 09:54 rbt joined, rbt left, rbt joined
raydiak went shooting a couple times while I was there too. and got hit by a car. moved back home after 2 years with better aim, three missing teeth, and saying y'all. talk about going native... 09:56
though to be fair, I was in Austin, which is actually a really progressive college town 09:57
lizmat Austin is nice
rest of Texas, meh
loved the Ethiopian vegan restaurant in Austin 09:58
raydiak I went to several vegan restaurants, but don't recall an ethiopian one
lizmat www.foodrepublic.com/wp-content/up...late-2.jpg 09:59
09:59 rbt left 10:00 rbt joined
raydiak looks nice, I'd try it. I'm not vegan any more, but I gave it a shot for half a year while I was there 10:01
lost a noticable of strength, but had way more energy 10:02
noticable *amount* of 10:03
noticeable
I always get that one wrong
lizmat www.tripadvisor.com/Restaurant_Rev...Texas.html # hmmm..., appears they're just vegetarian friendly 10:04
10:06 sono left
raydiak ah, maybe that's why I never noticed it in my searches. I was pretty strict about the vegan thing 10:08
the prices don't look bad for that area though 10:10
lizmat yeah, the housing of that restaurant is definitely "studentesque", almost under the highway
and it definitely has a bit of a "shanty-town" feel 10:11
raydiak I miss the freeway frontage roads, that's a great idea. can't imagine why we don't have them up here in WA 10:12
10:17 sacomo left 10:20 synthmeat joined 10:24 sgrs joined
raydiak alright, I'm going to attempt sleep. was nice chatting moon-child, Altreus, lizmat, #raku. y'all have a good * now, ya hear? \o 10:28
lizmat sleep well! 10:29
Altreus why thank you sah 10:30
hmm strange lag
nn :)
10:39 morayj joined, sacomo joined 10:55 muffindrake left 11:05 rbt left, rbt joined, rbt left, rbt joined 11:08 RaycatWhoDat joined 11:20 dolmen left 11:24 lichtkind joined 11:35 morayj left, patrickb joined 11:37 dolmen joined 11:39 Doc_Holliwood joined 11:45 ecocode_ left 11:56 ggoebel joined 12:02 reportable6 left 12:05 reportable6 joined 12:09 Summer joined 12:19 CIAvash[m] joined, morayj joined 12:21 morayj left
lizmat Changed the layout on the daily pages on logs.liz.nl/raku/today in preparation for a more final design 12:22
hope people will like it 12:27
12:36 CIAvash[m] is now known as CIAvash
lizmat afk for a few hours& 12:38
Summer its a bit information dense for me, and it doesn't feel like the username boxes own the chat line boxes 12:40
13:10 dolmen left 13:21 dolmen joined
vrurg lizmat: I'd join Summer on his note. It's rather hard to follow the current way. 13:25
Summer It'd take a whole rework to do this, but i usually find starting with raw-ish irc logs and then using spans to hide and show parts of each line or whatever, the best option (mainly because then it allows people to copy paste from the log) 13:27
jdv needs "current" for me
the formatting isnt unusable, to me. 13:28
i think moritz's copy even had some sort of tailing ability unlike vanilla collabti, iirc. 13:29
13:35 rbt left
Altreus Agree with the names thing. Feels like they should be side-by-side with the message box 13:56
cognominal lizmat: So nice a toot but he trafic of people joining and leaving should be opt in. And now that username are specially hiligthed they could go with the first of consecutive messages. 14:02
14:10 vrurg_ joined 14:12 vrurg left, sena_kun joined 14:13 Summer left 14:17 dolmen left
codesections as a Mastodon user, I found the typo about it being a "nice toot" briefly very confusing 14:17
(mastodon calls it's micro posts "toots" rather that "tweets") 14:18
s/it's/its
14:21 Sgeo joined 14:25 guifa joined 14:28 guifa left 14:41 dolmen joined 15:12 b2gills joined 15:17 stoned75 left 15:21 jmcgnh left 15:37 dolmen left 15:43 jmcgnh joined 15:44 vrurg joined, vrurg_ left 15:48 dolmen joined 16:07 jmcgnh left 16:10 jmcgnh joined 16:44 dolmen left 16:52 squashable6 left 16:55 squashable6 joined
codesections Do you think we can/should have a warning for this: I ran into a bug in my code because, when I should have done this (or, honestly, should have used an if/else) 17:09
m: say (1 ?? do {my $a = 0; $a+1} !! 'false') 17:10
camelia 1
codesections I instead had:
m: say (1 ?? (my $a = 0; $a+1) !! 'false') 17:11
camelia (0 1)
codesections (that's golfed, obviously, which makes it much more obvious). It took me quite a bit to realize that the ; was being parsed as the same as a comma, rather than as a statement terminator 17:12
17:16 rbt joined
codesections checking the docs, I see that I could also have validly written: 17:17
m: say (1 ?? $(my $a = 0; $a+1) !! 'false')
camelia 1
gfldex QAST::Stmts <wanted> :multislice<?> my $a = 0; $a+1 17:19
That's what Rakudo thinks it is given. 17:20
raydiak I can see why you'd want some feedback there, but I don't see how we could catch it without throwing false positives when people actually mean: 17:21
m: say (1,2; 3,4)
camelia ((1 2) (3 4))
codesections I guess one option would be to warn if that expression contains a ; but no , 17:22
gfldex m: say (1 ?? {my $a = 0; $a+1}() !! 'false')
camelia 1
codesections yeah, there are plenty of ways to do it correctly: $(…), do {…}, {…}() all work 17:24
raydiak m: m: say (1 ?? (my $a = 0)+1 !! 'false')
camelia 1
raydiak I supposed I could see an argument for that 17:25
warning on ; with no , I mean
gfldex m: my @a{1;2} = 42; dd @a; 17:26
camelia 5===SORRY!5=== Error while compiling <tmp>
The {} shape syntax with the @ sigil is reserved
at <tmp>:1
------> 3my @a{1;27⏏5} = 42; dd @a;
expecting any of:
statement end
statement modifier
statement…
gfldex m: my @a; @a{1;2} = 42; dd @a;
camelia Type Array does not support associative indexing.
in block <unit> at <tmp> line 1
gfldex m: my @a; @a[1;2] = 42; dd @a;
camelia Array @a = [Any, [Any, Any, 42]]
gfldex A multislice can show up in plenty of spots.
moon-child m: my @a; @a[my $x = 1;$x+1] = 424; dd @a 17:27
camelia Array @a = [Any, [Any, Any, 424]]
raydiak ah, right 17:28
codesections Hmm, I don't know the QAST internals as well as I want to, but couldn't we annotate that we're inside a ternary? 17:30
gfldex And how deep do you wont to go there? You might actually have a multi-dim slice inside a grouped expression. 17:31
I burned my fingers on () inside a tenery and my code got better. 17:32
Programmers are smart and tend to prefer education over bans. 17:33
codesections Yeah, fair. Though on the other hand, it's just a warning – I don't know that people needing `quietly` in some edge cases is _that_ high a price
patrickb m: my @a = 'a', 'b'; my @b = 'c', 'd'; my (@c, @d) = @a, @b; 17:34
camelia ( no output )
gfldex A litte warning in the docs in the right places would be nice tho.
patrickb m: my @a = 'a', 'b'; my @b = 'c', 'd'; my (@c, @d) = @a, @b; say @c; say @d;
camelia [[a b] [c d]]
[]
patrickb How can I make the above assign @a to @c and @b to @d? 17:35
gfldex m: my @a = 'a', 'b'; my @b = 'c', 'd'; my (@c, @d) := @a, @b; say @c; say @d; 17:36
camelia [a b]
[c d]
ugexe m: my @a = 'a', 'b'; my @b = 'c', 'd'; my (@c, @d) := @a, @b; say @c; say @d;
camelia [a b]
[c d]
ugexe heh
patrickb :-) 17:37
Thanks!
codesections gfldex: Raku currently is pretty free with its warnings, though: there are plenty of times I *want* to use a undefined value in Str context, and thus either get a warning, use quietly, or use //
17:48 zostay joined
raydiak I don't think there is a definitive reason that it can't/shouldn't warn, more of a judgement call. big shaded region, not a sharp line. though fwiw, I don't find "I already stumble over false positive warnings all the time so let's add another" to be a persuasive argument :) 17:57
I like the undef in str warning though, personally. that really commonly does mean something has gone wrong, in the cases of my own code 17:59
codesections ha! :D I was more trying to say that, given the number of warnings we currently get, users might expect warnings for softening like this (there's some value in consistency) 18:00
re: string warning – yeah, I agree. I get it as a false positive a fair bit, but mostly in debugging code (I might do something like `note "the current foo: $bar"`). But I don't mind a bit of extra noise in the debug output 18:02
gfldex This warning feels more like a target for a linter to me.
18:02 reportable6 left 18:03 hankache left 18:04 reportable6 joined
raydiak sure consistency, I just mean the same idea could be inverted to say that we should back off some of the warnings. like this one I hit the other day: 18:04
m: 0 ==> say
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 030 ==> say7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $…
raydiak and yet
m: sub sayQuietly ($_) {.say}; 0 ==> sayQuietly 18:05
camelia 0
codesections but that's not a warning – that's an error. Which seems like a higher bar/more like something we should back off from 18:06
raydiak the error is something else. maybe a special case in the parser or idk what. but the warning is the part after other potential difficulties 18:07
codesections I don't think they're unrelated, though 18:08
gfldex m: multi sayQuietly ($_) {.say}; 0 ==> sayQuietly
camelia 0
codesections m: 0 ==> say()
camelia 0
raydiak I can certainly see the case you're making for wanting (;) to warn. I guess a lot of the decision would just come down to how often we suspect it would be intentional or not
yes, doing it with () works. but with something that isn't "say", you don't need the ()
gfldex m: multi sayQuietly {}; multi sayQuietly ($_) {.say}; 0 ==> sayQuietly 18:09
camelia 0
18:10 sono joined
raydiak now that we're raku instead of perl 6 I almost want to rip out all the P5ism warnings. but that's probably going a bit far 18:10
codesections raydiak: yeah, agreed that it's something with say. I just think it's the same thing that makes say throw the error 18:11
gfldex `0 ==> say` not working is a bug
codesections yeah, agreed
and I think that bug is also what causes the spurious warning (it's one issue, not two) 18:12
El_Che raydiak: I don't think p5 centrism has a case today as it did when it was the "previous" version. 18:15
raydiak looks like it actually does that same error and warning both, for all of: say print abs chomp chop chr cos defined exp lc log mkdir ord reverse rmdir sin split sqrt uc unlink fc 18:26
for consistency, I'd rather see it do the same dispatch error you get for e.g.: 18:27
m: abs()
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling abs() will never work with signature of the proto ($, *%)
at <tmp>:1
------> 3<BOL>7⏏5abs()
raydiak instead of
m: 0 ==> abs
camelia 5===SORRY!5===
Argument to "abs" seems to be malformed
at <tmp>:1
------> 030 ==> abs7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "abs". In Raku please use: .abs if you meant
to call it as a method on $…