🦋 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.
10:46 yewscion left 11:04 jpn joined 11:09 jpn left 11:15 abraxxa-home left 11:16 abraxxa-home joined 11:25 yewscion joined 11:30 yewscion left 11:47 jpn joined 11:52 jpn left
Voldenet re `my $b; $b[1e18]="meow"` causing panic, I think this is a bug 12:08
lizmat wow 12:09
yeah, please make an issue :-)
12:09 ChanServ sets mode: -o lizmat
Voldenet idk what's the behavior I'd expect from it though - in js browsers behave differently in such case 12:13
12:19 maylay left 12:22 maylay joined
lizmat I suggest we don't allow bigInt values for indices 12:24
Voldenet there's a few solutions, v8 uses sparse arrays 12:27
and firefox (spidermonkey, I think) simply ignores that error :> 12:28
lizmat I think we're going to opt to disallowing bigint values for now and throwing an execution error 12:32
m: my @a; @a[my $ = -1e13]="meow" # related meh 12:36
camelia ( no output )
Voldenet hm… it doesn't crash on the newest version?
m: my $b; $b[1e18]="meow"
camelia MoarVM panic: Memory allocation failed; could not allocate 8000000000000000008 bytes
Voldenet Ah, it does.
lizmat m: my @a; @a[-1e0]="meow" 12:37
camelia ( no output )
lizmat m: my @a; @a[-1]="meow"
camelia ===SORRY!=== Error while compiling <tmp>
Unsupported use of a negative -1 subscript to index from the end. In
Raku please use: a function such as *-1.
at <tmp>:1
------> my @a; @a[-1]<HERE>="meow"
lizmat meh
Voldenet Having "oom" to catch here would be a solution, but I'm not sure if it'd be actually useful 12:40
I've seen developers doing this in other languages, and obviously handling OOM didn't really add more ram properly :>
in perl5, `eval { @b[1e15]=1; }` doesn't seem to be handled, but `eval { @b[1e20]=1; }` is handled 12:44
ah, right the second one is not OOM and that is properly handled by raku too 12:45
> github.com/rakudo/rakudo/issues/5835 12:48
stanrifkin_ Not $b[1e15]?
Voldenet uh, right, I mean $b[1e15]
lizmat m: my @a; @a[my $ = -1]="meow"; dd @a # this feels very wrong 12:51
camelia []
Voldenet either way, checks for "arrays can be at most N bytes in size" would be probably better sanity check
but if someone with 2EB of ram uses large arrays, they should work ;) 12:52
m: my @a; my $n = -10e17; @a[$n]="meow"; dd @a 12:54
camelia []
Voldenet I'm suspecting this code quietly does nothing instead of writing to arbitrary locations, otherwise it'd segfault 12:55
13:05 jpn joined 13:30 maylay left 13:32 maylay joined 13:35 jpn left 13:52 jpn joined 13:57 jpn left 14:22 jpn joined 14:26 Aedil left 14:27 jpn left 14:30 Aedil joined 15:01 liztormato joined 15:07 jpn joined 15:12 jpn left 15:13 liztormato left 15:18 maylay left 15:20 maylay joined 15:22 jpn joined 15:25 liztormato joined 15:27 jpn left 15:37 apac joined, jpn joined 15:42 jpn left 15:52 liztormato left 16:11 jpn joined 16:16 jpn left 16:39 jpn joined 16:44 jpn left
sdomi Voldenet: sent the issue :) 16:54
16:59 yewscion joined 17:04 yewscion left 17:15 yewscion joined 17:20 hvxgr left 17:21 yewscion left, yewscion joined 17:24 jpn joined 17:26 yewscion left, apac left 17:28 liztormato joined 17:29 jpn left 17:33 human_blip left 17:34 hvxgr joined 17:35 human_blip joined, liztormato left 17:46 jpn joined 17:51 jpn left 18:08 yewscion joined 18:13 yewscion left 18:17 yewscion joined, jpn joined 18:21 yewscion left, jpn left 18:32 yewscion joined 18:37 yewscion left, maylay left, maylay joined 18:49 jpn joined 18:59 Sgeo joined 19:07 codesections joined 19:11 jpn left 19:34 codesections1 joined 19:36 codesections left 19:39 codesections1 left 19:40 jpn joined 19:44 codesections joined 19:51 jpn left 19:58 codesections1 joined 19:59 codesections left, codesections1 is now known as codesections 20:24 codesections left 20:25 hvxgr left 20:28 Aedil left 20:41 hvxgr joined 20:53 codesections joined 20:58 codesections1 joined 20:59 codesections left, codesections1 is now known as codesections 21:18 codesections1 joined 21:22 abraxxa-home left, codesections left, codesections1 is now known as codesections 21:38 codesections left 22:00 tadzik left 22:25 yewscion joined 23:23 codesections joined 23:28 codesections1 joined 23:30 codesections left, codesections1 is now known as codesections 23:31 sena_kun left