🦋 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: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku
Set by lizmat on 1 May 2021.
tonyo anyone interested in a talk about fez for raku conf? trying to figure out what might be interesting about it to people? the benefits over cpan? how it actually works? the technologies behind it and what goes into an upload? 04:23
something else?
ecocode[m]1 maybe an intro on how to create a new module for upload to raku modules ? which tools to use; setup of the repo; necessary files; integration with git; what about NativeCall libraries; tests; module metadata ... 06:10
patrickb o/ 06:33
tellable6 2021-05-12T21:18:03Z #moarvm <MasterDuke> patrickb you said something a little while ago about windows vms?
patrickb tony-o: I'd like to see a talk about fez. It should include: A joke about the naming (fez vs zef), some history including the limitations of p6c and cpan, a technical overview of how the server works and why (scalability, ...), instructions of how to use it in practice, outlook including a nod toward raku.land. The talk should have slides, then it 06:40
can serve as a resource to point interested people at.
MasterDuke: I can't remember talking about Windows VMs. Can you recall what I wrote about? 06:41
tellable6 patrickb, I'll pass your message to MasterDuke
unclechu hey, is there any “autodie” thing for `run` command? 10:57
for instance if i write something like this: `run(«foo bar», :out).out.slurp(:close).chomp` it does not fail if `foo` program is not found 10:58
instead it silently continues returning empty string as a result
timotimo you'll need to sink the object you're currently calling .out on, rather than discarding it 11:13
lizmat but if you sink it, then you won't be able to get at its :out ? 11:22
unclechu timotimo: what do you mean by “sinking”? 11:53
the only solution that comes to mind is to add a subroutine wrapper that would just check for `.exitcode` at the end and throw an exception if it’s not 0 11:54
but the lack of error messages is sad. nothing is telling me what the problem is (missing `foo` in `PATH`)
lizmat unclechu: run(...) without putting it into a variable 12:21
"void context" in other languages 12:22
but I see your point: maybe we need a :throw named argument to "run" to have it throw if something went wrong 12:23
unclechu lizmat: yeah, i have the same question then. how do i slurp the `out` then? 12:24
lizmat right, indeed
what you *could* do as a workaround is to actually call .sink yourself
my $proc = run(....); $proc.sink; # will throw if something went wrong
"sinking" is really just calling .sink on an object 12:25
unclechu lizmat: that should work i think, thanks. though it wouldn’t be a one-liner anymore
lizmat in most cases, it won't do anything
unclechu would be happy to see `:throw` or something like this in the future
lizmat I'll make a PR in a moment 12:26
lizmat unclechu: github.com/rakudo/rakudo/pull/4368 13:20
unclechu thanks 13:22
unclechu for now i did it like this: `do with run(«foo bar», :out) { .sink; .out.slurp(:close).chomp }` 13:23
unclechu though i’m not sure if it’s a correct way of doing it. `.sink` waits for the end of the program, right? 13:24
what if the output does not fit the buffer for `out`?
or it is okay?
does raku has its own way of buffering? 13:25
lizmat clickbaits rakudoweekly.blog/2021/05/17/2021-...nodelayed/ 13:28
stoned75 hi. I cannot convience myself that substr-rw method works on allomorph types. Any example to give to me ? 13:35
lizmat m: my $a = <42>; $a.substr-rw(0,2) = 666; dd $a 13:36
camelia Too many positionals passed; expected 1 to 3 arguments but got 4
in block <unit> at <tmp> line 1
lizmat hmmm
afk for a bit&
stoned75 I meant with current rakudo. and yes I'm seeing exactly that lizmat. I feedled around without any luck 13:37
stoned75 *fiddled 13:42
lizmat stoned75: looks like a thinko on my part, care to create an issue for it ? 14:09
stoned75 sure. And I could look into adding a couple of tests in roast if that can help ? 14:10
lizmat yes, please! 14:12
spacebat2 is there a raku equivalent of ruby's tap or yield_self methods? a method just about every object has, that expects a lambda and calls it with self as the argument 14:20
lizmat you don't need that 14:24
m: sub twice($a) { $a ~ $a }; say "foobar".&twice() 14:25
camelia foobarfoobar
lizmat the .&methodname() syntax allows you to call a sub as a method on any object
spacebat2 ^^ is that what you meant ? 14:26
spacebat2 that might do yes 14:26
tomasz7 hi, has raku got into any linux distribution as a standard? 14:27
lizmat only really old versions
but El_Che manages a lot of Linux packages for Raku 14:28
nxadm.github.io/rakudo-pkg/ # tomasz7 14:29
tomasz7 i can easily find and install it on my Debian, but I wonder if it's getting any popular
tomasz7 perl5 is installed by default and many standard tools are in p5 14:31
that's what i'm asking about raku - has any distribution reached for it so far? 14:32
El_Che tomasz7: most distributions ship raku 14:36
tomasz7 ok but do they use it? 14:37
El_Che internally? probably not, I think that only python and perl are used that way 14:40
it's a blessing and a curse
for modern languages you are better off leaving system $lang to the system and install a recent version yourself 14:41
tomasz7 ruby too 14:43
tx 14:50
stoned75 lizmat: saw your fix. that's strange I'm pretty sure I tried that without luck :-} I must have been confused 15:06
ok that's what I thought after I read your commit log. And yes I had tried that but decided against it because after the substr-rw the allomorph is no more. is that really ok with you ? 15:10
well that was the behaviour before the introduction of the Allomorph class if I am not mistaken 15:11
stoned75 ok, according to your commit ba814fde4fc46607eb143ebddeaa9ecdba85a036 we do want substr-rw to return a Str 15:30
so be it :)
tonyo ecocode[m]1: patrickb: those are good suggestions, thanks 16:10
ErgoXX______ Is this where one comes to be reborn into a perl god 18:03
lizmat ErgoXX______ : probably not ? 18:04
unclechu is there a way to find a full path to an executable from `PATH` environment variable? like what `which` command does? 19:15
kybr i think i found a minor error in the docs; i thought i might confirm. i'm curious 19:15
docs.raku.org/language/5to6-perlfunc#quoting
qw/.../; # is more commonly rendered as C<< <...> >> in Raku. 19:16
kybr it's line 1444 of the 5to6-perlfunc.pod6 19:16
unclechu kind of equivalent to builtin `type -P` in Bash. for instance `type -P cat` would return `/usr/bin/cat` (the path would depend on OS)
kybr the line uses C<< <...> >> to code-quote, but it does so within a =for code :lang<perl> 19:17
kybr so we see the C<< <...> >> whereas i think we want to see <...> 19:19
stoned75_ kybr: you're quite right
Geth doc: kybr++ created pull request #3884:
minor fix: code quote within code quote
19:23
tusooa <unclechu "kind of equivalent to builtin `t"> why not just traverse the PATH variable? 20:47
unclechu tusooa: because maybe there already is a simpler solution? 20:49
tusooa: traversing `PATH` would take splitting string by `:` (this separator i believe also depends on OS), and checking each item for executable permission 20:51
this should be a lot of code but already too noisy comparing to something like `'some-executable-name'.expand-path` 20:52
don’t want to reinvent the wheel if it’s already invented
tusooa i can understand
unclechu this should not be 20:53
tusooa i guess it could be a nice to have
maybe there are modules for it?
unclechu maybe, but in my standalone script i’m looking for a builtin solution. so i would probably end up with traversing `PATH` instead of using some dependency 20:55
flouncy hi
ugexe no there is no built in solution because its not an easy problem to solve in a cross platform way 20:58
what gets executed on a given system when you type 'some-command' is not just/always based on PATH depending on your system
tusooa well, on some shells it could be hashed 20:59
tonyo it's really not even a system thing but a shell thing 21:00
gfldex unclechu: here is an example of how to scan $PATH: github.com/gfldex/raku-shell-pipin...kumod#L342 21:58
ugexe that can be simplified further with `$*SPEC.path` 22:03
(as well as be slightly more cross platform) 22:04
unclechu gfldex: yeah, i kind of did the same: 22:12
`my List:D \paths = %*ENV{'PATH'}.split(':').cache;`
`{ with IO::Path.new: e, :CWD($_) { return .absolute if .e } } for paths;`
ugexe: good to know that `$*SPEC.path` exists 22:13
tonyo : won't work on windows 22:16
ugexe github.com/ugexe/zef/blob/602c54f1...#L170-L181 this is what zef uses 22:20
unclechu tonyo: yeah, that i was worried about too. that it depends OS 22:21
ugexe $*SPEC.path handles the OS-specific path seperator
but there is still PATHEXT to worry about 22:22
unclechu changed to this: `{ with IO::Path.new: e, :CWD($_) { return .absolute if .e } } for $*SPEC.path;`
and error throwing after this line if it passes without `return`ing anything
ugexe because on windows there is no e.g. `git`, there is `git.exe` or `git.bat` 22:24
hence utilizing PATHEXT