🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 6 September 2022. |
|||
00:13
jpn joined
00:19
jpn left
00:23
abraxxa-home left
00:49
vrurg_ joined,
vrurg left,
vrurg_ is now known as vrurg
00:51
coleman left
00:52
coleman joined
01:08
jpn joined
01:13
jpn left
01:17
Manifest0 left
02:03
epony joined,
jpn joined
02:08
jpn left
02:33
hulk joined,
kylese left
02:34
_________ left
02:59
jpn joined
03:05
jpn left
03:15
hulk left,
kylese joined
03:52
nil78 joined
03:53
hudo joined
03:56
jpn joined
04:00
jpn left
04:04
DarthGandalf left
04:29
DarthGandalf joined
04:53
jpn joined
05:01
epony left
05:02
epony joined
05:03
jpn left
05:56
_________ joined
06:08
petlib joined
06:09
petlib left
06:13
hudo left
06:19
jpn joined
06:22
gabiruh_ joined
06:23
gabiruh left,
jpn left
06:59
nil78 left
07:02
jpn joined
07:07
jpn left
07:25
abraxxa joined
07:39
abraxxa left
07:40
abraxxa joined
08:21
jpn joined
08:34
Manifest0 joined
08:39
jpn left
08:40
gugod left
08:41
gugod joined
08:59
jpn joined
09:07
jpn left
09:08
jpn joined
09:22
Sgeo left
|
|||
xinming | !pastebin | 10:28 | |
Any pastebin recommended? | |||
l.perl.bot/p/pd97cl <--- In this script | 10:31 | ||
When I do `raku script.raku test 5` It'll raise error | 10:32 | ||
Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏test' (indicated by ⏏) in block <unit> at raku-main-to-clarify.raku line 3 | |||
But it works fine in multi sub calls. | 10:33 | ||
Xliff | xinming: That's because "test" is not a number | 11:05 | |
And this is the problem. The coercive multi is used when there is a better option available. | 11:06 | ||
The 2nd multi is getting chosen, instead of the first. | |||
And Real() wants to convert "test" to a number. | 11:07 | ||
11:13
sena_kun joined
11:16
hudo__ left
|
|||
librasteve | so I guess Real() [shorthand for Real(Any)] checks for Any at dispatch time and this multi is chosen as Any is less restrictive than the literal Str 'test' [shorthand for Str $ where * ~~ 'test'] ... | 12:22 | |
anyway, you can see from | 12:28 | ||
dd $arg; #NumStr.new(15e0, "15e0") | 12:29 | ||
you are getting a Real anyway since Allomorph NumStr ~~ Real (so no need to use a coercion type) | 12:30 | ||
it takes a bit of getting used to that raku has all three tools in the box (i) operators just coerce anyway (1 + '2') = 3, (ii) Allomorphs are bridged types that are both Real and Stringy and (iii) there are now (since a year or two) coercion types to ring all the changes in your signatures and declarations. | 12:34 | ||
13:10
hudo joined
|
|||
Xliff | librasteve: But isn't it supposed to move from most -> less restrictive? | 13:22 | |
13:44
abraxxa left
|
|||
librasteve | dang my theory falls to the ground! | 13:45 | |
13:46
jpn left,
abraxxa-home joined
|
|||
so the questions remains why is the Real()coercion type preferred over the Str literal 'test' | 13:46 | ||
lizmat | the problem is the implicit Any in the Real() coercion | 13:47 | |
this means that "test" is not immediately disqualified as a value to match the second candidate | |||
so it tries to coerce the value to a Real, and that fails | 13:48 | ||
one could argue that that should disqualify the candidate | |||
and it wouldn't need to coerce, where it not for the "where" clause | 13:49 | ||
the <= forces the coercion | 13:50 | ||
Real() $arg where { try 10 <= $_ < 20 } | 13:51 | ||
fixes that execution error | 13:52 | ||
and make the script DWIM | |||
xinming ^^ | |||
so it's not actually the "And Real() wants to convert "test" to a number.", but the where clause that causes the error | 13:53 | ||
librasteve | so presumably, the dispatch logic doesn't know if one where clause will beat another, so the first where that matches wins?? | 13:54 | |
(after getting trapped at the type check) | |||
lizmat | that is basically the gist, yes | ||
there is no way to see which "where" clause would be tighter than aother | 13:55 | ||
librasteve | til | ||
lizmat | at least, not currently | ||
librasteve | (good luck with that) | ||
;-) | |||
lizmat | well, you could envision a where block returning some special "Tightness" indicator | 13:56 | |
librasteve | think I prefer it as first one checked wins | 13:57 | |
lizmat | and that follows the order of the candidates in source, so you can tweak stuff that way as well | 13:58 | |
afk& | 14:00 | ||
14:06
jpn joined
|
|||
Xliff | librasteve: Actually, I thought the candidates were sorted by "tightness" and first-one-wins was the law of the land. | 14:55 | |
librasteve | i guess i am thinking of a case like where 0 < $_ < 10 vs. where 2 < $_ < 8 ... since this has ambiguity coded in (and I can imagine far more convoluted variants with eg runtime variables, iterated values as comparisons) then I am mentally separating the type check as a guard (where you are right, tightness wins) vs. running the where clause and backtracking if the where result is False (where the where clauses | 14:59 | |
(for the same type) are run in source code order) | |||
15:42
Sgeo joined
16:18
epony left
16:20
epony joined
16:37
hudo_ joined
16:43
hvxgr left
16:53
hvxgr joined
17:43
jpn left
17:46
jpn joined
17:55
jpn left
|
|||
melezhik | o/ | 18:18 | |
What’s up | 18:19 | ||
coleman | hello there | 18:29 | |
19:07
jpn joined
19:30
Xliff left
|
|||
jdv | cna zef install stuff in parallel? | 19:33 | |
*can | |||
ugexe | It could but CURI holds a lock on install so there isn’t a point | 19:38 | |
it does fetch and extract in parallel though | |||
There is —test-degree which defaults to 1 but can be set higher for parallel testing as well | 19:39 | ||
19:45
jpn left
20:27
jpn joined
20:48
jpn left
|
|||
tonyo | is there no longer an issue with the precomp race? | 21:05 | |
22:24
kjp left
22:25
japhb_ is now known as japhb
22:26
kjp joined
22:56
abraxxa-home left
23:13
sena_kun left
23:54
hudo_ left
|