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.
08:05 dakkar joined 10:19 wafflus joined
wafflus how do you make a named command line argument to a raku program required and/or set a default value 10:21
Str :n( :name( $name is required ) ) Unable to parse named parameter; couldn't find right parenthesis 10:22
i've tried ! as well as =
same error
ab5tract m: sub MAIN(:n(:$name = “foo”)) { dd :$name }; MAIN(:n(“bar”)) 11:11
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse named parameter; couldn't find right parenthesis
at <tmp>:1
------> sub MAIN(:n(:$name⏏ = “foo”)) { dd :$name }; MAIN(:n(“bar”)
ab5tract Gar, copied the wrong invocation 11:12
m: sub MAIN(:n(:$name) = “foo”) { dd :$name }; MAIN(:n(“bar”))
camelia :name("bar")
:name("foo")
ab5tract Second output with the default value is because I’ve forgotten the proper way to test MAIN in a one liner 11:13
Defaults are not supported on required params 11:14
m: sub MAIN(:n(:$name)! = “foo”) { dd :$name }; MAIN(:n(“bar”))
camelia ===SORRY!=== Error while compiling <tmp>
Cannot put default on required parameter $name
at <tmp>:1
------> sub MAIN(:n(:$name)! = “foo”⏏) { dd :$name }; MAIN(:n(“bar”))
expecting any of:
constraint
ab5tract wafflus: ^^ 11:15
wafflus k ty least i know
librasteve i guess a default on a required parameter is incorrect and we want the compiler to tell us 11:58
13:11 wafflus left
lizmat And yet another Rakudo Weekly hits the Net: rakudoweekly.blog/2024/06/10/2024-...ys-sommer/ 13:35
14:08 MasterDuke left
librasteve \0/ 15:40
ab5tract Defaults on a required parameter is indeed considered nonsensical, which I agree with 16:25
16:38 dakkar left
vendethiel oh wow, the RakuAST grant is amazing, amazing news 17:40
tonyo way to go nine 17:54
librasteve tonyo: also! 17:56
tonyo danke! 17:57
20:27 teatime joined 20:34 Guest48 joined, Guest48 left 21:07 teatime left