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:40 frost joined 01:53 Kaiepi left 03:40 Kaiepi joined 04:28 Guest83 joined 04:31 Guest83 left
stevied ok, thanks 04:32
I don't understand the syntax here:
Proxy.new(
:STORE{ },
:FETCH{ }
);
I know STORE and fetch are keys and the { } are probably values but I don't quite understand how it works 04:33
i don't see anything in the documentation for constructing a pair like this with curly braces 04:35
looks like it's just creating an empty hash for the value. But isn't STORE supposed to require a callable? 04:39
weird, even this works without error: 04:41
```
my $t = Proxy.new(
:STORE[ 7, 2, 3],
:FETCH[ 5, 4, 9]
);
```
that's clearly an array 04:42
weird, even this works without error: 04:43
Proxy.new(
:STORE[ 7, 2, 3],
:FETCH[ 5, 4, 9]
);
```
``` 04:46
my $p1 = :STORE{ };
say $p1.value.^name;
my $p2 = :STORE{ 2 };
say $p2.value.^name;
```
first returns "hash" second returns "block" 04:47
ok, so this explains it: my $p1 = :STORE{ }; 04:50
say $p1.value.^name;
my $p2 = :STORE{ 2 };
say $p2.value.^name;
ok, so this explains it: docs.raku.org/language/operators#term_{_}
but that doesn't answer the question as to why/how STORE accepts a hash for an argument 04:52
i guess it must get coerced into a block?
ok, interesting, if I try to assign the object to a var, I do get an expected error: 05:01
```
my $t = Proxy.new(
:STORE{ },
:FETCH{ }
);
```
``` 05:02
No such method 'CALL-ME' for invocant of type 'Hash'
in block <unit> at /Users/stevedondley/Library/Application Support/"Edument Central Europe"/Comma2022.06/scratches/random-scratch line 5
```
problem solved
if I put something between the braces, raku treats it like a block
very confusing, though
06:18 Kaiepi left 07:50 dakkar joined 09:55 frost left 10:17 frost joined
gfldex `()` is the empty List, `[]` is the empty Array, `{}` is the empty Hash and `{;}` is the empty Block. 10:53
10:58 jaguart joined 11:18 frost left 11:26 frost joined 12:20 frost left 12:47 m_athias left 12:48 m_athias joined
stevied Yeah but the part that really threw me was that the object wasn’t created because it was never assigned. 13:07
So it looked like the { } was being used as a callable. 13:08
17:01 dakkar left 17:15 jaguart left 17:31 jaguart joined 23:11 jaguart left