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.
02:56 hythm joined 03:51 razetime joined 03:54 razetime left 04:59 hythm left
rcmlz m: use Test; plan 1; unless $*DISTRO.name ~~ /macos/ { skip-rest "MacOS specific tests"; exit; } ok True, "MacOS-Tests"; done-testing 06:50
Raku eval 1..1 ok 1 - # SKIP MacOS specific tests
07:39 deadmarshal_ left 07:44 deadmarshal_ joined 08:51 dakkar joined 08:52 dakkar left 08:53 dakkar joined 11:45 tea3po joined 11:49 teatwo left 13:11 tea3po left, tea3po joined
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/11/13/2023-...proaching/ 15:43
16:05 sjn left 16:17 jgaz left 16:18 jgaz joined 17:29 dakkar left 20:22 lizmat left 20:33 lizmat joined
.vushu Hey <ab5tract> I have added macos support if you will like to try also fixed the int pointer bindings for raylib-raku. 20:39
21:11 habere-et-disper joined
habere-et-disper How do I conditionally load a module? 21:13
m: my $debug = True; use Grammar::Tracer if $debug;
camelia ===SORRY!=== Error while compiling <tmp>
Could not find Grammar::Tracer in:
/home/camelia/.raku
/home/camelia/rakudo-m-inst-1/share/perl6/site
/home/camelia/rakudo-m-inst-1/share/perl6/vendor
/home/camelia/rakudo-m-inst…
habere-et-disper This give me `Missing semicolon` before the `if`. 21:15
librasteve require is the run time word for use 21:17
m: my $debug = True; require Grammar::Tracer if $debug; 21:18
Raku eval Exit code: 1 ===SORRY!=== lang-call cannot invoke object of type 'VMNull' belonging to no language
habere-et-disper Merci encore @librasteve -- I've never used that keyword before. :)
librasteve not sure that if can be conditionalized .... I get the same error on my local Terminal 21:24
use if; 21:27
github.com/raku-community-modules/if 21:28
use if; # activate the :if adverb on use statements use Grammar::Tracer:if($debug);
zef install if 21:29
habere-et-disper That bombed without a line number with `===SORRY!=== 21:58
Cannot resolve caller infix:<==>(Mu:U, Bool:D); none of these signatures matches`
librasteve works for me 21:59
did zef install if work OK? 22:00
if so does use if; load ok (ie. comment out the use Grammar::Tracer line)?? 22:01
how about use Grammar::Tracer:if(True);
habere-et-disper yes, yes and yes 22:02
librasteve constant $debug = 1; may be needed as the use is done at compile time 22:05
habere-et-disper Seems a bit bonkers if I can't pass a value in: 22:08
`sub MAIN ( Bool :$debug = True, *@files ) {
    use if;
    use Grammar::Tracer:if( $debug );
`
librasteve The if distribution will let you conditionally load a distribution. Use cases (no pun intended) are about loading different implementations of a functionality for different operating systems, compiler backends, or compiler versions. This means that these switches for different implementations do not happen at runtime, but cheaply at compile time. This also means that a custom build and install hook is not 22:16
needed because all implementations are installed. Then depending on the conditions only the desired implementation will be used. Even if the switch is by backends you can share one installation by several backends using this technique.
^^^ this is from the README
so not bonkers, I guess - but no what you want 22:18
habere-et-disper `slurp` documentation say that encoding values are listed in method open, but I must be blind because I see none there. 22:19
22:19 sjn joined
habere-et-disper docs.raku.org/routine/slurp#type/I...ineroutine 22:19
I'm looking for `ISO-8859` but I think I read somewhere it's just best to run it through `iconv` first and give raku utf8. 22:21
librasteve just to be clear, the use statement is done by the compiler at compile time, then the program is run which is when the variables are initialized and so on - this is pretty normal behaviour, right? 22:29
constant gets around this because it's basically a term declaration that statically translates values at compile time 22:33
nemokosch Yes, good point. This is a compile time option, that's why it needs custom implementation to begin with
For plain runtime resolution, there is require 22:34
librasteve yeah, I tried require but at least in the case of Grammar::Tracer it does not work 22:39
nemokosch That could still be a bug or limitation of that particular module, i wouldn't know 22:40
librasteve looking at the module source its a Slang mixin so I expect that it's a fundamental limitation of the Slang model (on similar lines to the documented limitations of require like The symbols provided by the loaded module will not be imported into the current scope.) 22:43
23:12 habere-et-disper left 23:47 tea3po left, tea3po joined