🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | 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 8 June 2022. |
|||
00:01
unicodable6 left,
reportable6 left,
coverable6 left,
benchable6 left,
bloatable6 left,
greppable6 left,
linkable6 left,
notable6 left,
tellable6 left,
nativecallable6 left,
bisectable6 left,
evalable6 left,
quotable6 left,
committable6 left,
releasable6 left,
shareable6 left,
statisfiable6 left,
sourceable6 left,
notable6 joined,
committable6 joined
00:02
benchable6 joined,
quotable6 joined,
shareable6 joined,
sourceable6 joined,
statisfiable6 joined,
coverable6 joined
00:03
greppable6 joined,
releasable6 joined,
bisectable6 joined,
bloatable6 joined,
reportable6 joined,
tellable6 joined
00:04
nativecallable6 joined,
unicodable6 joined,
linkable6 joined,
evalable6 joined
01:04
linkable6 left,
evalable6 left
01:05
evalable6 joined
01:07
linkable6 joined
|
|||
Geth | doc: 1983eb9425 | Coke++ | xt/01-raku-version.t Track latest release |
01:42 | |
doc: 7a7b51222c | Coke++ | writing-docs/INDEXING.md Remove currently unused category (passes xt/) |
|||
01:48
rir joined
02:00
Garbanzo joined
02:26
Garbanzo left
02:27
frost joined,
rir left
03:14
simcop2387 joined
03:16
perlbot joined
04:01
perlbot left
04:02
simcop2387 left
04:12
simcop2387 joined
04:13
perlbot joined
04:14
Sgeo_ joined,
Kaipei joined,
Garbanzo joined,
donpdonp|z_ joined
04:15
[Coke]_ joined
04:16
[Coke] left,
vrurg left
04:17
Kaiepi left,
Sgeo left,
tejr left,
donpdonp- left
04:18
tejr joined
04:19
vrurg joined
04:40
djerius left
04:44
djerius joined
05:00
Sankalp- joined
05:01
Sankalp left,
Sankalp- is now known as Sankalp
05:18
Kaipei left
05:55
Garbanzo left
06:07
reportable6 left
06:08
reportable6 joined
06:19
mexen joined
06:31
Sgeo_ left
07:06
dakkar joined
07:08
frost left
|
|||
Zephyr | is there a regex/raku rule to test if given string is an acceptable raku identifier or not? | 07:44 | |
not sure what unicode ranges it uses | |||
Nemokosch | The language is parsed with Raku grammars so quite surely | 07:46 | |
Zephyr | could I have a link to the parser to find that part myself? | ||
Nemokosch | If only I knew where it was... | 07:47 | |
Maybe this? | 07:48 | ||
github.com/Raku/nqp/blob/master/sr...rammar.nqp | |||
NQP is a subset of Raku, for all intents and purposes | 07:50 | ||
Zephyr | is that it | 07:52 | |
oh, think I found it github.com/Raku/nqp/blob/master/sr...r.nqp#L45= | 07:56 | ||
thanks for the repo <@297037173541175296> | |||
08:00
ecocode left
08:04
ecocode joined
08:16
Kaipei joined
08:17
discord-raku-bot left,
discord-raku-bot joined
|
|||
nine | Actually Raku's grammar is github.com/rakudo/rakudo/blob/mast...rammar.nqp | 08:37 | |
With the RakuAST version at github.com/rakudo/rakudo/blob/raku...rammar.nqp | |||
Nemokosch | interesting, it's the same but phrased differently | 08:50 | |
08:53
discord-raku-bot left,
discord-raku-bot joined
09:09
waffulus joined
|
|||
waffulus | I am a complete noob to raku i tested some regex from the offical site but i keep getting weird outputed characters and I don't know why | 09:12 | |
[0] > 'raku' ~~ /rak./; # matches the whole string | 09:13 | ||
「raku」 | |||
Zephyr | m: 'raku' ~~ /rak./ | ||
Nemokosch | ~~it's not a weird character, it's a perfectly valid ó~~ | 09:14 | |
waffulus | so its supposed to so that? | ||
dutchie | something's broken with your unicode handling; raku is trying to print the Match object with japanese-style 「quotes」 | ||
waffulus | I ran into a problem while trying to set up Readline: Cannot locate native library 'readline.dll': error 0x7e | ||
Falling back to Linenoise (if present) | |||
maybe that is something to do with it | |||
or maybe it is the font i'm using source code pro and have tried ohter fonts | 09:15 | ||
Zephyr | is the bot down | ||
dutchie | m: '「'.encode.decode('latin-1') # something like this | ||
camelia | ( no output ) | ||
dutchie | m: '「'.encode.decode('latin-1').say # something like this | ||
camelia | ï½¢ | ||
dutchie | (substitute latin-1 for your local system encoding to perhaps replicate) | 09:16 | |
Nemokosch | definitely character encoding issue in some way | ||
I don't know if it's supposed to work here but it usually doesn't | 09:17 | ||
waffulus | dutchie i get a ? | ||
dutchie | you should make sure your terminal (or console or whatever) is expecting utf-8 output | 09:23 | |
waffulus | i can type unicode and get the output as is | ||
when i use powershell it outputs the uncode as is | 09:24 | ||
when i use perl it complains of malformed utf | |||
in an infinite loop | |||
Nemokosch | windows be like | 09:28 | |
waffulus | well maybe but python seems to work | 09:29 | |
maybe i should reinstall it | |||
k no longer using something called rakudo-moar loaded up the repl no luck | 09:39 | ||
Nemokosch | how did you install the Raku environment, by the way | 09:44 | |
waffulus | well i just installed it using the msi downloaded from rakudo.org | 09:45 | |
Nemokosch | msvc... well idk, doesn't explain | 09:46 | |
but rakubrew.org/?platform=win rules 😛 | |||
waffulus | k i wil will try that version, ty | 09:47 | |
Nemokosch | doesn't sound related but who knows | 09:48 | |
"good practices" | |||
09:53
lichtkind joined
|
|||
waffulus | sorry can't installed the rakubrew one complaining about shims and shell hooks | 09:59 | |
10:03
Altai-man joined
|
|||
waffulus | sorry the rakubrew installation just seems to add even more problems on top of what i already had | 10:03 | |
10:08
thundergnat joined
|
|||
thundergnat | m: say $_ ~~ /^<ident>$/ for <raku ok1 42nope>; # <-- (is there a regex/raku rule to test if given string is an acceptable raku identifier or not?) | 10:08 | |
camelia | 「raku」 ident => 「raku」 「ok1」 ident => 「ok1」 Nil |
||
10:09
thundergnat left
|
|||
Nemokosch | you did see the difinition though, no? | 10:38 | |
oh right | |||
anyway, the definition is <ident> [[ \-' ] <ident>]* | |||
iirc | |||
discord ate the backslash | |||
but the _three_ characters inside should be: \ - ' | |||
11:01
waffulus left
|
|||
meh | 11:01 | ||
more accurately: | |||
token apostrophe { | |||
<[ ' \- ]> | |||
} | |||
token identifier { | |||
<.ident> [ <.apostrophe> <.ident> ]* | |||
} | |||
moritz | so to answer the question, `identifier` parses an identifier, `ident` just a subset of identifiers | 11:04 | |
Nemokosch | by the way, it seems to me discord cut the backslash again | 11:05 | |
11:07
Nemokosch joined
|
|||
not sure if it shows up inside the apostrophe definition? | 11:07 | ||
moritz | yes, the dash is backslash-quoted | 11:09 | |
Nemokosch | test: [\-'] | ||
Nemokosch | okay it does work | ||
so is it quoting in the Raku regex as well? | 11:10 | ||
or escaping | |||
11:10
Nemokosch left
|
|||
moritz | it#s escaping, because the - in a character class usually is a range | 11:13 | |
wait no, that was perl 5 semantics | 11:14 | ||
Nemokosch | anyway, you are right, it is escaping | 11:17 | |
11:53
abraxxa joined
11:59
abraxxa left
12:00
abraxxa joined
12:02
codesections73 left
12:07
reportable6 left,
reportable6 joined
13:07
evalable6 left,
linkable6 left
13:09
linkable6 joined
13:11
evalable6 joined
13:56
Altai-man left,
sena_kun_ joined
13:59
abraxxa left
14:14
morte_ joined
14:18
timo left
14:21
morte_ left
14:23
[Coke]_ is now known as [Coke]
14:35
Sgeo joined
14:39
timo joined
14:41
Garbanzo joined
15:25
morte_ joined
15:31
avuserow left
15:32
avuserow joined
15:35
dakkar left
15:39
ecocode left
15:40
ecocode joined
15:41
Sankalp left
16:11
Sankalp joined
17:05
fingolfin joined
|
|||
fingolfin | Hello community. I see in docs (docs.raku.org/language/glossary#Stub), that "Stubs define name and signature". But this code doesn't throw error. Why? Is it a bug? | 17:12 | |
role A { | |||
method M(Str $x) { … } | |||
} | |||
class B does A { | |||
method M(Int $x) { 0 } | |||
} | |||
17:13
mexen left
17:36
sena_kun_ left
|
|||
[Coke] | m: role A { method M(Str $x) { ... } }; class B does A { method M(Int $x) { 0 } }; | 17:56 | |
camelia | ( no output ) | ||
[Coke] | m: role A { method M(Str $x) { ... } }; class B does A { method M(Int $x) { 0 } }; B.new.M(3); | ||
camelia | ( no output ) | 17:57 | |
[Coke] | in the latter case, you're invoking B's copy of the method. it doesn't need to touch A's version. | ||
m: role A { method M(Str $x) { ... } }; class B does A { method M(Int $x) { 0 } }; A.new.M(3); | |||
camelia | Method 'M' must be implemented by A because it is required by roles: A. in block <unit> at <tmp> line 1 |
||
[Coke] | but if you pun the role (create an anonymous class out of it), and try to invoke the method, then the fact that it's a stub is noticed. | 17:58 | |
m: role A { method M(Str $x) { ... } }; class C does A { }; C.new.M(3); | |||
camelia | ===SORRY!=== Error while compiling <tmp> Method 'M' must be implemented by C because it is required by roles: A. at <tmp>:1 |
||
[Coke] | ^^ or if you don't override it. | ||
m: role A { method M(Str $x) { ... } }; class C does A { }; C.new.M("3"); #better | |||
camelia | ===SORRY!=== Error while compiling <tmp> Method 'M' must be implemented by C because it is required by roles: A. at <tmp>:1 |
||
[Coke] | I think the fact that you changed the first parameter type doesn't matter unless you try to invoke it: | 17:59 | |
m: role A { method M(Str $x) { ... } }; class B does A { method M(Int $x) { 0 } }; B.new.M("three"); | |||
camelia | Type check failed in binding to parameter '$x'; expected Int but got Str ("three") in method M at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
[Coke] | need a multi for that to work. | 18:00 | |
Not sure I answer the question you were after. | |||
18:07
reportable6 left
18:08
reportable6 joined
|
|||
fingolfin | Thank you Coke, I have read your answers carefully. It turns out that if the methods have the same name, but different signatures, is it still the same method? It's a little confusing... It turns out that "method M(Int$x) { 0 }" in my example implements the method "method M(Str $x)", but does it "incorrectly". Why wouldn't raku track down this | 18:13 | |
error at the compilation stage? | |||
I am asking this question because in another situation, if the method is not implemented at all, raku reports it at the compilation stage: | |||
m: role A { method M(Str $x) { ... } }; class B does A { }; | 18:14 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Method 'M' must be implemented by B because it is required by roles: A. at <tmp>:1 |
||
[Coke] | m: role A { multi method M(Str $x) { ... } }; class B does A { multi method M(Int $x) { 0 } }; B.new.M("three"); | ||
camelia | ===SORRY!=== Error while compiling <tmp> Multi method 'M' with signature :(B: Str $x, *%_) must be implemented by B because it is required by a role at <tmp>:1 |
||
[Coke] | m: role A { multi method M(Str $x) { ... } }; class B does A { multi method M(Int $x) { 0 } }; | 18:15 | |
camelia | ===SORRY!=== Error while compiling <tmp> Multi method 'M' with signature :(B: Str $x, *%_) must be implemented by B because it is required by a role at <tmp>:1 |
||
[Coke] | (there you go. the multi forces the compile time alert) | ||
fingolfin | Thanks, it's getting clearer. But why is there no error without "multi"? Is this behavior correct? | 18:22 | |
It seems to me that if a class implements a method with a different signature, then this is essentially a different method. But maybe I don't understand something... | |||
18:22
fingolfin left
18:25
sena_kun left
|
|||
[Coke] | that would be my take; they're considered different methods unless you specify multi, which indicates that anything with the same name counts. | 18:26 | |
18:26
sena_kun joined
|
|||
[Coke] | but then, because of the stub, the compiler realizes that NOTHING is implementing that specific version of the multi. | 18:27 | |
18:51
vasko left
18:56
fingolfin joined
19:31
fingolfin left
20:31
unicodable6 left,
reportable6 left,
benchable6 left,
releasable6 left,
linkable6 left,
bisectable6 left,
nativecallable6 left,
notable6 left,
quotable6 left,
evalable6 left,
coverable6 left,
statisfiable6 left,
bloatable6 left,
committable6 left,
greppable6 left,
sourceable6 left,
shareable6 left,
tellable6 left
20:32
notable6 joined,
benchable6 joined,
sourceable6 joined,
bloatable6 joined,
quotable6 joined,
bisectable6 joined
20:33
unicodable6 joined,
committable6 joined,
reportable6 joined,
releasable6 joined,
shareable6 joined,
greppable6 joined,
linkable6 joined
20:34
nativecallable6 joined,
evalable6 joined,
tellable6 joined,
statisfiable6 joined,
coverable6 joined
21:34
linkable6 left,
notable6 left,
coverable6 left,
greppable6 left,
benchable6 left,
unicodable6 left,
bloatable6 left,
sourceable6 left,
statisfiable6 left,
releasable6 left,
bisectable6 left,
reportable6 left,
nativecallable6 left,
shareable6 left,
quotable6 left,
committable6 left,
tellable6 left,
evalable6 left,
bisectable6 joined
21:35
shareable6 joined,
tellable6 joined,
reportable6 joined,
evalable6 joined
21:36
benchable6 joined,
greppable6 joined,
sourceable6 joined,
notable6 joined,
coverable6 joined,
unicodable6 joined,
statisfiable6 joined,
committable6 joined,
bloatable6 joined
21:37
quotable6 joined,
linkable6 joined,
nativecallable6 joined,
releasable6 joined
22:29
discord-raku-bot left
22:30
discord-raku-bot joined
|
|||
tonyo | . | 22:51 | |
23:08
discord-raku-bot left,
gfldex left
23:36
discord-raku-bot joined
23:40
gfldex joined
23:48
morte_ left
|