🦋 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:00
reportable6 left
00:01
reportable6 joined
00:26
thaewrapt left
00:36
thaewrapt joined
00:39
jpn joined
00:44
jpn left
01:09
kylese left
01:10
kylese joined
01:25
itaipu left
01:30
nine left,
nine joined
01:40
jpn joined
01:45
jpn left
02:15
kylese left,
kylese joined
|
|||
roguerakudev | are there any plans to make arrays whose elements are all known to be of a given type compatible with typed array parameters? | 02:19 | |
e.g. sub foo(Int @ints) { ... } currently doesn't accept [1, 2, 3] as an argument | 02:20 | ||
because [1, 2, 3] is technically untyped | 02:21 | ||
[Coke] | I haven't heard of it - I imagine it would be potentially costly. | ||
roguerakudev | I kinda get why it is the way it is, but it's rather annoying when you want to ensure things are of a certain type but don't want to impose an undue burden on callers | ||
so you end up doing something like @param where @param.all ~~ Type or similar, and it feels a bit dirty | 02:22 | ||
[Coke] | sub foo(Int @ints) { dd @ints}; foo(Array[Int].new(1,2,3)) | 02:23 | |
evalable6 | Array[Int].new(1, 2, 3) | ||
evalable6_ | Array[Int].new(1, 2, 3) | ||
[Coke] | can I recommend a multi with a strict type, and one with the manual type check? | 02:24 | |
roguerakudev | yeah, Array[Foo].new(...) just seems needlessly verbose when it's clear that all elements are of type Foo (even at compile time) | ||
Coke - in the end I will probably just remove the constraint and trust the caller | 02:25 | ||
I like the idea that the programmer can start prototyping without type constraints and then add them as the design cements, but right now this behavior discourages me from adding in typing in many cases | 02:27 | ||
ugexe | the pattern i ended up following was using a separate assignment altogether, i.e. `my Candidate @results = @candidates; return @results;` | 02:28 | |
either way, it is a bit unfortunate it requires copying | 02:30 | ||
roguerakudev | more generally, parameterized types don't currently DWIM imo, but there's probably some edge case that prevents Foo[Bar] from being a subtype of Foo[Baz] in every case even if Bar is a subtype of Baz | ||
maybe in an ideal world we'd have some way to mark such edge cases while the default is that Foo[Bar] ~~ Foo[Baz] (e.g. Array[SomeType] ~~ Array[Any]) | 02:32 | ||
or maybe the default is the other way, and things like Array are marked as having that property, whatever that property would be called | 02:33 | ||
oh wait, that already is the case | 02:38 | ||
[1, 2] isn't even Array[Any], it's just Array - but somehow I expect the absence of that type parameter to make it default to Any, so maybe that's the crux of the issue | 02:39 | ||
bah, I'm on too little sleep for all this reasoning | 02:41 | ||
02:41
jpn joined
|
|||
for reference, Positional's type defaults to Mu, but Any vs. Mu doesn't really matter in this context github.com/rakudo/rakudo/blob/881c...rakumod#L1 | 02:42 | ||
so maybe it's sufficient for list/array/hash literals to take on the most specific common type of the elements as their associated role/class's type parameter? | 02:44 | ||
if [1, 2] were always Array[Int], that shouldn't (?) break anything given that Positional[Int] is compatible with Positional[Mu] | 02:45 | ||
02:47
jpn left
03:42
jpn joined
03:47
jpn left
04:03
Guest89 joined
04:13
Guest89 left
04:33
Xliff joined
|
|||
Xliff | m: say 1, 1, 2, 3...*+* | 04:33 | |
camelia | (1 1) | ||
Xliff | Why isn't that sequence evaluating? | ||
m: say 1, 1, 2, 3..*+* | |||
camelia | 112WhateverCode.new | ||
04:43
jpn joined
04:49
jpn left
04:57
merp left
05:03
merp joined
05:44
jpn joined
05:46
Sgeo left
05:50
jpn left
06:00
reportable6 left
06:01
reportable6 joined
06:36
stoned75 joined
06:37
stoned75 left
06:45
jpn joined
06:50
jpn left
07:00
lucerne left
07:31
jpn joined
07:36
lucerne joined
08:03
jpn left
08:55
jpn joined
09:24
sena_kun joined
09:34
Guest1580 joined
|
|||
nahita3882 | > If the endpoint is not , it's smartmatched against each generated element and the sequence is terminated when the smartmatch succeeded. in your case the endpoint is a WhateverCode with arity 2, so it takes the first 2 elements of the sequence which are 1 and 1, subjects it to ` + *` which gives 1 + 1 = 2, which is truthful so the sequence is terminated and yields 1, 1 | 09:39 | |
did you mean 1, 1, * + * ... *? | |||
(your second message was evaluating to a List with 4 elements: 1, 1, 2 and a WhateverCode with the body 3 .. * + *, i.e., a Range maker from 2 arguments) | 09:41 | ||
09:48
vms14 left
09:52
vms14 joined,
Guest1580 left
10:21
eseyman left
10:45
manu_ joined
10:47
vms14 left,
vms14_ joined
10:49
manu_ is now known as eseyman
11:05
vms14_ is now known as vms14
11:49
jpn left
12:00
reportable6 left
12:03
reportable6 joined
12:16
jpn joined
12:36
zara joined
12:40
jpn left
12:52
zara left
14:16
jpn joined
14:25
jpn left
14:41
jpn joined
15:08
jpn left
15:49
bdju left
16:18
xinming left
16:23
xinming joined
16:31
bdju joined
16:38
avuserow left,
avuserow joined
16:55
jpn joined
|
|||
dr.shuppet | Oh so that's what it says, I didn't see the italics and didn't realize there are *s in there | 17:05 | |
m: say (1, 1, 2, 3, * + * ... *)[0..10] | 17:07 | ||
evalable6 | (1 1 2 3 5 8 13 21 34 55 89) | ||
Raku eval | (1 1 2 3 5 8 13 21 34 55 89) | ||
17:07
thaewrapt left
17:10
thaewrapt joined
17:13
thaewrapt left
17:21
teatime joined
17:25
thaewrapt joined
|
|||
Geth | docker: m-dango++ created pull request #65: Bump to 2024.04 |
17:33 | |
18:00
reportable6 left
18:01
reportable6 joined
19:17
linkable6_ left,
evalable6_ left
19:18
linkable6_ joined
19:19
evalable6_ joined
19:24
jpn left
19:33
jpn joined
19:43
jpn left
19:47
vms14 left,
vms14 joined
20:50
jpn joined
21:14
itaipu joined
21:17
jpn left
21:33
jpn joined
21:38
jpn left
22:09
jpn joined
22:14
jpn left,
leah2 left
22:22
leah2 joined
22:43
sena_kun left
23:12
jpn joined
23:17
jpn left
23:39
Sgeo joined
|