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.
deoac Can a Raku program determine whether it was started from the command line vs. a cronjob? 00:26
rf I think you can check if you're in a TTY 00:45
tea3po say $*IN.t ?? "Input comes from tty." !! "Input doesn't come from tty."; 00:47
idk how to detect if something is running under cron specifically 00:49
rf you could set an env variable in your cron script 00:50
IS_CRON=yes raku myscript.raku
habere-et-disper $*USER might be CRON ? 00:52
tea3po I imagine it would be root for system crontab, the user for user crontabs. 00:54
deoac Thanks all.  I'll check both $*IN and $*USER. 00:55
deoac $*USER is my username when run as a cronjob. 00:58
pelevesque Anyone know how to check if a class exists in the given namespace? 04:48
Nahita NS::{$class-name}:exists maybe 05:19
if it's a my-scoped class it won't be seen though 05:20
with this code
pelevesque did not work... says exists is not set 05:41
Nahita m: module NS { class A {} class B {} } for ("A", "B", "D") -> $class-name { ($class-name, NS::{$class-name}:exists).say } 05:46
Raku eval (A True) (B True) (D False)
pelevesque I import a module use MIDI::Make; And then I want to test if the File class from that module was made available. 05:49
Nahita in "Make.rakumod", what do you have? 05:55
like do you have "unit module Make;" (or "module Make { ... })
and "class File" only 05:56
or "class File is export"
if it's like module Make { class File { } } (or with "unit module Make;") then in the file that's "use"ing this, Make::<File>::exists says True 05:57
but if it's "my"-scoped (the class) and only "is export", then ::<File>:exists can tell whether it's imported to the current space 06:00
if it's both "our"-scoped (i.e., the default) and "is export", then both of them can tell
pelevesque Yes, Make.rakumod with unit module make 06:02
class File is export(:shortnames) {}
thanks! 06:03
Nahita no problem
Sussysham hi 16:12
lizmat Sussysham o/
Sussysham lizmat Greetings senpai 16:13
I mean senior
lizmat domo arigato
if you go by years, I guess you can call me a senior :-) 16:14
but I'd rather like to think of the "teacher" connotation :-) 16:15
Sussysham I will also prefer that
can you help me  with setup?
lizmat of Comma? no, I'm afraid I'm a vim person 16:19
Sussysham youtu.be/zDP9uUMYrvs intersting 16:20
lizmat No worries sensei I will figure something out
btw nxadm seems  ofline  username doesn't show up on @ 16:21
shmup oh rad, didnt know Comma had this vid!! 16:21
pelevesque Does anyone know what the api key refers to in the META6.json file? 16:48
Sussysham lizmat 16:51
lizmat pelevesque the api key means what you want it to mean: 16:52
it provides a way for users to specify which API version they want when installing / loading a module
by default it is 0 afaik
pelevesque By that API refers to the module itself, or the API or Raku? If for the module, isn't the version number enough to know what is implemented? 16:58
lizmat the API of the module itself 17:02
it's up to the module author what that actually means
use Foo:api<2>;
would load the Foo module with api 2 (if installed of course)
zef install 'Foo:api<2>'
would install the highest version Foo module with api 2 (if such a thing exists, of course) 17:03
pelevesque Is it required?
dakkar pelevesque: if the author is doing the whole semver thing, api and the major version would be more-or-less the same 17:04
and no, it's not required
pelevesque OK thanks. Ya, I am using semsev 2. I will drop my API key.
dakkar keep in mind that there's no simple way for code to ask "give me the latest version that's >= 2.0.0 and < 3.0.0" 17:05
but there is a simple way to ask "give me the latest version that's api==2"
so if you think you will have a version 2.0.0, 3.0.0, &c, you may want to start with `api=>1` 17:06
if you end up not needing it, no harm done
Nemokosch doesn't e.g 2.* give you the latest version? 17:08
dakkar I'm not sure 17:09
lizmat if you aren't specific, it will give you the highest version, regardless of api 17:10
Nemokosch is this true for all patterns? 17:11
dakkar lizmat: where's the documentation for `use` with a longname? none of docs.raku.org/language/module-packages.html docs.raku.org/language/modules.html docs.raku.org/language/compilation.html 17:13
lizmat please make a doc issue for it :-) 17:14
Sussysham Will i have setup rakudo or raku first to use Comma ide
dakkar rakudo is the implementation, raku is the language
Sussysham What SDK it is asking for?
dakkar (like CPython and Python) 17:15
Sussysham ok
dakkar (but I don't know anything about Comma, sorry)
Sussysham np
lizmat Sussysham: couldn't you just download the standalone version? commaide.com/download
afk& 17:16
Sussysham it is theone 17:17
that i downloaded
when i create new project it says no sdk specified 17:18
sdk is required for compiling debugginng
Nemokosch does comma not have an IRC channel maybe? 17:20
oh btw 17:24
stackoverflow.com/questions/550753...-comma-ide s/perl6/raku