This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
00:20 deoac joined 02:08 MasterDuke left, deoac left 03:31 frost joined 03:56 Heptite left 08:24 razetime joined 08:43 razetime left 08:55 razetime joined 09:32 razetime left, razetime joined 09:56 razetime left 10:43 jaguart joined 11:19 frost left 12:04 Nemokosch joined 12:36 jaguart left 13:01 Heptite joined 14:50 Nemokosch left 16:15 jetchisel left 16:17 jetchisel joined 16:24 deoac joined
deoac I received this error: "Type check failed in binding to parameter 'SELF'; expected Any but got BOOTException (BOOTException)" 16:25
What is a BOOTException?  I can't find it in the documentation?
It followed the error "Partially dimensioned views of shaped arrays not yet implemented. Sorry." 16:26
Kaiepi that's an nqp exception type
er
REPR
nah type 16:27
deoac Weirdly, I get this after using 'artially dimensioned views of shaped arrays' several times!
Kaiepi it shouldn't be there 16:28
passing `--ll-exception` to `raku` would give enough information for an issue maybe
deoac I'm not getting the error in the REPR.  It's coming from an application. 16:32
I'm using: Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.
Kaiepi REPR is not REPL 16:33
REPR helps back a type
deoac Ah, my mistake 16:34
Running with `--ll-exception` had no effect.  Same error messages. 16:35
Kaiepi it can give more detailed ones sometimes. what do they say? 16:39
(in full)
and can you provide any code to trigger the error with? 16:40
deoac ``` 16:43
Partially dimensioned views of shaped arrays not yet implemented. Sorry.
  in method refresh-quadrant at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Space.rakumod (Space) line 332
  in sub _move at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 266
  in block at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 139
  in sub get-command at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 134
  in sub MAIN at bin/RakuTrek line 260
  in block <unit> at bin/RakuTrek line 67
Type check failed in binding to parameter 'SELF'; expected Any but got BOOTException (BOOTException)
  in method refresh-quadrant at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Space.rakumod (Space) line 332
  in sub _move at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 266
  in block at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 139
  in sub get-command at /Users/jimbollinger/CommaProjects/RakuTrek/lib/Commands.rakumod (Commands) line 134
  in sub MAIN at bin/RakuTrek line 260
  in block <unit> at bin/RakuTrek line 67
```
16:43 discord-raku-bot left, discord-raku-bot joined
deoac `    #| When the Enterprise moves into a new quadrant, this method should be 16:45
    #| called to update the galaxy.
    method refresh-quadrant (Location $old-loc, Location $new-loc) {
Nemokosch well, what is the code that gives the error?
deoac         my ($new-quad, $new-sect) = $new-loc.split;
        my ($old-quad, $old-sect) = $old-loc.split;
        my Quadrant $old-quadrant := $.quadrants[$old-quad.x;$old-quad.y];
        my Quadrant $new-quadrant := $.quadrants[$new-quad.x;$new-quad.y];
        # update the Enterprise
        $.Enterprise.location = $new-loc.clone;
        # update the new location
        $new-quadrant.has-enterprise = True;
        try { $new-quadrant.sectors[$new-sect.x;$new-sect.y] = $.Enterprise;
            CATCH { .say; .resume; };
        }
        # update the old location
        $old-quadrant.has-enterprise = False;
        try { $old-quadrant.sectors[$old-sect.x;$old-sect.y] = EmptySpace.new;
            CATCH { .say; .resume; };
16:45 discord-raku-bot left 16:46 discord-raku-bot joined
deoac $.quadrants is a 2-dim grid of sectors.  Sectors are a 2-dim grid of objects. 16:46
Errors are from the CATCH blocks
Nemokosch huh, kinda frightening 16:48
deoac Which? My code or the errors?
BTW, the first time I call this function, only the first CATCH is executed. 16:50
After that both CATCHes are triggered.
Nemokosch > Partially dimensioned views of shaped arrays not yet implemented. Sorry.
This error is okay, or I mean, a reasonable type of error
The other one seems kind of like nuclear reactors melting 16:51
deoac Yet, many times 'partially dimensioned views of shaped arrays' works just fine.
Nemokosch Well, that "shouldn't" work 16:52
deoac :-)
Nemokosch if your array is not 2-dimensional and you are providing 2 dimensions, that won't work, at least not at the moment
Kaiepi i wonder if `Failure`'s involved somewhere, somehow 16:54
16:58 discord-raku-bot left, discord-raku-bot joined
deoac The arrays are definitely 2-dim.  If I remove one of the dimensions, I get the error `Cannot assign to a 2 dimension array with only 1 dimensions` 17:00
Nemokosch it could be a bug, hard to tell from this code 17:04
17:07 deoac left 17:56 deoac joined
deoac New question. 20:09
Nemokosch go ahead 😅 20:10
deoac I have a sub that returns an array made up of three values - a Str, Array[Rat], Object - in that order.  How can a specify this with `returns` or `-->` ?
Nemokosch That is an excellent question but I'm afraid I'm not going to be of any use. I barely ever use type annotations. 20:12
lately I have heard of the Data::Record module made by Kaiepi: raku.land/zef:Kaiepi/Data::Record seems like it could come handy 20:13
gfldex m:``` 20:15
subset Stuffz of List where { .elems == 3 && .[0] ~~ Str && .[1] ~~ Array[Rat] && .[2] ~~ Any:D }
sub foo( --> Stuffz) {}
```
gfldex deoac: please note that you don't specify a return type with `returns`, you tell the compiler to do a runtime value check on returning a value.
Kaiepi `subset Stuffz of List:D where (Str, Array[Rat], Any:D)` should work too 20:21
deoac gfldex: Thanks, I'll use --> instead 20:25
gfldex --> and `returns` are equivalent
deoac Thanks for the `subset` tip.  They really are a nifty and useful part of the language!
gfldex Actually, they are a cludge to keep the gammar less complicated that it is already. :) 20:26
And they often provide LTA error messages. We really could do with tuples, like in Nim. 20:27
20:51 archenoth left 21:16 MasterDuke joined 22:12 deoac left 22:19 deoac joined 23:42 archenoth joined