03:11 discord-raku-bot left, discord-raku-bot joined
Razetime thanks a lot 09:09
ah this is super concise, exactly what i need
RoM Following up on Rakus leading/tailing Declarator Blocks #| and #= and Python's "doctest" I tried using the Pod-Test-Code module approach inside the leading #| Block - which did not work. However, putting some simple initial tests close to the sub I like to document - inside some =begin pod ... =end pod - is also good enough and works nicely. Thank you for that hint. 12:30
The follow-up question I could not solve is related to converting pod to HTML.
When running
raku --doc=HTML lib/MyDemoMod.rakumod > doc/MyDemoMod.html
on this Module code:
unit module MyDemoMod;
#| Some one sentence documentation.
subset PInt of UInt where * > 0;
#| Another one sentence documentation.
proto multipliziere_pos_int(PInt:D $x, PInt:D $y where $x <= $y) returns PInt {*}
multi sub multipliziere_pos_int(1, $y) is export {
return $y
Following up on Rakus leading/tailing Declarator Blocks #| and #= and Python's "doctest" I tried using the Pod-Test-Code module approach inside the leading #| Block - which did not work. However, putting some simple initial tests close to the sub I like to document - inside some =begin pod ... =end pod - is also good enough and works nicely. Thank you for that hint. 12:32
The follow-up question I could not solve is related to converting pod to HTML.
When running
raku --doc=HTML lib/MyDemoMod.rakumod > doc/MyDemoMod.html
on this Module code:
unit module MyDemoMod;
#| Some one sentence documentation.
subset PInt of UInt where * > 0;
#| Another one sentence documentation.
proto multipliziere_pos_int(PInt:D $x, PInt:D $y where $x <= $y) returns PInt {*}
multi sub multipliziere_pos_int(1, $y) is export {
return $y
Am I doing something wrong when generating teh HTML?
Am I doing something wrong when generating the HTML? 12:34
PS: I removed all the pod from the rakumod-file, the subset-format-error appears also whenusing pod inside. 12:38
PS: I removed all the pod from the rakumod-file, the subset-format-error appears also when using pod inside.
14:12 TheAthlete joined 14:24 TheAthlete left
MasterDuke @RoM#5135 i suggest asking in #raku 14:44
RoM @MasterDuke: ok 15:30
stevied I'm running the code in the synopsis at github.com/chloekek/Template-Class...lassic.pm6 16:48
all I'm getting for output is 3 dots
where do I find the source code for this module on my local machine? 17:12
looks like it's buried in share/perl6/site. I guess I don't want to touch that 17:17
I guess I should download it manually from git hub and throw it in lib or something and load it manually
I'm using `use lib '/path/to/mylib`; to try to override the module installed with zef but not getting anywhere 17:33
it's still using the module installed with zef 17:34
ok, had to do `use lib '/path/to/my/lib/Template-Classic/lib` 17:36
Is there a way to add CFLAGS when compiling a module? 19:17
or building a module, I should say 19:18
MasterDuke @stevied#8273 fyi, if it was installed with zef, `zef look Template::Classic` will drop you into a shell in the modules files. however, i don't believe you can modify the files. if you want to do that, then yes, clone and then `raku -I . <...>` in the repo 19:51
i'm not sure how CFLAGS gets populated when building a module. might take the CFLAGS used when building moarvm, or maybe just what's in your env. if the latter, then `CFLAGS="$CFLAGS -foo -bar" zef install .` should work 19:54
stevied thanks. thankfully I was able to resolve the problem without resorting to cflags voodoo 21:25
22:04 [Coke] left 22:07 [Coke] joined 22:12 [Coke] left, [Coke] joined
can someone please shed some light on this: docs.raku.org/type/Signature#Sub-signatures 22:19
what is compound parameter, first of all?
22:27 [Coke] left
MasterDuke i think they're saying that `|c`, a Capture, can (and does in this case) have multiple arguments/parameters that make it up 22:34
and the sub-signature is a way to specify its "schema" 22:35
stevied the letter after the | can be anything, right?
MasterDuke yeah, 'c' is just convention 22:36
stevied so this doesn't shed too much light on what a sub-signature is or why I would want to use it. 22:37
oh, wait. I think I see
so c is a parameter made up of two pieces of data 22:38
what's the advantage of doing something like that? 22:39
why not just have two differently name parameters?
MasterDuke sort of. i might say that c is the meta-view of all the parameters, whether it's one or many 22:40
22:40 [Coke] joined
MasterDuke usually you would. but if you're doing some meta-programing (e.g., passing a function into another function to wrap it), you might need/want to operate on the parameters as a whole 22:41
so some function might just take all it's arguments as a whole and pass them off to another function, and that function might have multi candidates based on the schema of the "whole" it receives 22:42
stevied well, what I'm trying to figure out is this line: github.com/chloekek/Template-Class...c.pm6#L102 22:44
and it's throwing an error at me
```Stub code executed
in sub at EVAL_0 line 1
in sub at /Users/me/git_repos/raku/modules/steve/Template-Classic/lib/Template/Classic.pm6 (Template::Classic) line 104
in block <unit> at ./template.raku line 13
```
it only throws an error when I have a "where" clause in my signature: 22:46
```
use Template::Classic;
my &render-list := template :(Str:D $app1,
Str:D $app2,
Str:D $key where 1),
'practice.json'.IO.slurp;
```
I'm trying to see if I can get it to work with a where a clause. but I don't know what I'm doing.
MasterDuke oh, a where clause might be tricky
since that's essentially code 22:47
but what if you just put `1` instead of `Str:D $key where 1`?
or really `'1'` since it's a Str 22:48
stevied Thanks. I’ll try in a bit. Eating. 23:05
yeah, I just get an error: `Variable '$key' is not declared` 23:13
what I really want to do is `Str:D $key where .charrs == 1`
MasterDuke it might not be possible to use a where clause when you're passing a capture around like that. any difference if you declare a subset type beforehand and use that? e.g., `subset Char of Str where .chars == 1; sub foo(Char $a) { ... }` 23:16
stevied doesn't work. here's the code: 23:19
```
subset Char of Str where .chars == 1;
my &render-list := template :(Str:D $app1,
Str:D $app2,
Char $key),
'practice.json'.IO.slurp;
print render-list 'one', 'two', 'p',;
```
MasterDuke hm. then i'm out of suggestions. might trying pinging lizmat, vrurg, SmokeMachine, gfldex, codesections, etc 23:21
stevied I guess what I'l have to do is just create a wrapper that does the checks on the arguments and then calls template 23:22
MasterDuke i'm off to sleep, good luck
stevied not a big deal. I'm just farting around trying to learn 23:23
thanks. bye.
I have this signature: `sub triple(Str:D $app1, Str:D $app2, Str:D $key where .chars == 1, Str $mod? where * ~~ any @modifiers = 'command' ) {}` 23:52
I want the last argument to be optional
when I don't pass in the 4th arg, I get an error:
`Constraint type check failed in binding to parameter '$mod'; expected anonymous constraint to be met but got Str (Str)`