🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
perryprog In Soviet Russia, you only can use package scope. 00:50
Voldenet in soviet russia package scope uses you 02:37
perryprog UGH 02:44
I knew there was a better version
thought the my/our joke is less clear
Voldenet joking is very important business ability in IT, so I hone that ability… 02:46
rf: if you give `sort-fast` already sorted array, it will allocate things 3 times and on top of that reallocate for every element – it might be possible to use MVMArray and friends directly without copying anything 02:56
imo at minimum you should export multi dpqs_sort for CArray[num64], so it's possible to use it without copying memory 03:02
perryprog How can one customize the search path for nativecall? It's not finding dylibs installed under /opt/homebrew/lib. 04:01
Voldenet you can provide full path
perryprog Well this is for an installed thingy 04:02
Net::ZMQ, to be specific
rf Voldenet yeah that'll be the next steps I take 04:09
Voldenet m: use NativeCall; my $*VM = class :: { method platform-library-name(IO $libname, $apiversion = "") { "/lib/hehe.so.4" } }.new; my sub zmq_socket() is native("zmqswtf_WTF",v5) { * }; zmq_socket(); 04:22
camelia Cannot locate native library '/lib/hehe.so.4': /lib/hehe.so.4: cannot open shared object file: No such file or directory
in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/C3AB583B2A487B774A5B6012470C058B4893F1C7 (NativeCall…
Voldenet perryprog: maybe the above will help
ofc, you might need to capture previous $*VM and redispatch
perryprog I'm sorry, I did a really bad job of stating what my problem actually was. What I'm actually trying to do is install Jupyter::Kernel, which depends on ZMQ, which of course expects a native call to libzmq.5.dylib, but it can't find it since it's not in the search path that it's getting from.... somewhere 04:25
Voldenet from here most likely github.com/rakudo/rakudo/blob/main...VM.pm6#L73 04:26
perryprog I did find that, but I don't see where it's grabbing its search path from 04:28
Voldenet hm, I'd try using LIB env variable before anything 04:33
perryprog Nope 04:34
(Funnily enough, the search path does have . as a default so I can run it while in /opt/homebrew/lib just fine :) )
Voldenet DYLD_LIBRARY_PATH perhaps? 04:37
perryprog Tried that too, but macOS is weird about env vars that start with DYLD
Voldenet or DYLD_FALLBACK_LIBRARY_PATH
perryprog ❯ DYLD_FOOBAR=123 bash -c echo $DYLD_FOOBAR # prints nothing
Voldenet consider `DYLD_FOOBAR=123 bash -c 'echo $DYLD_FOOBAR'` 04:38
perryprog oop u right
phew I was also right
(still nothing)
Sadly it does seem like Jupyter::Kernel is pretty crashy at least in console mode (I dunno why) and I'm quite tired so I'll have to poke around at another time 04:39
Voldenet I'm pretty sure that MVM_backend_config contains prefix for libs 04:40
perryprog (basically crashes if you tab complete in like... the wrong place? I'm not sure)
Voldenet but I have no idea how to override that
perryprog that sounds promising
Voldenet m: use nqp; nqp::backendconfig<prefix> = "/eh";
camelia Cannot assign to an immutable value
in block <unit> at <tmp> line 1
perryprog I should probably file a bug report for Jupyter::Kernel regarding the tab complete crash instead of being blasé and not 🤔 04:41
is Brian Duggan on IRC at all?
Voldenet probably not, but github issue may be more useful for this 04:43
perryprog Yeah, but sometimes I like to check with more async-chat-active people if there's an "is this known" thing about a certain issue 04:45
Note that's 100% code for "I'm lazy"
Voldenet not lazy, time-efficient 04:47
perryprog right right. Yes. That. 04:48
Eh who needs sleep. I just got distracted by a link to cpan and then that made me remember this work of art exists. metacpan.org/dist/Lingua-Romana-Pe...rligata.pm
Voldenet m: use nqp; nqp::backendconfig<prefix> := "/eh"; use NativeCall; my sub zmq_socket() is native("zmq",v5) { * }; zmq_socket(); 04:49
camelia Cannot locate native library 'libzmq.so.5': libzmq.so.5: cannot open shared object file: No such file or directory
in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/C3AB583B2A487B774A5B6012470C058B4893F1C7 (NativeCall) line…
Voldenet that doesn't appear to be working either way
Anton Antonov @perryprog “Sadly it does seem like Jupyter::Kernel is pretty crashy […]” — yes, others have observed that too. Of course, if you have Mathematica then you can use Raku in Mathematica notebooks (via the Mathematica-Raku connection.) 🙂 13:52
@perryprog As Voldenet said, you can submit a GitHub issue — Brian has been fairly quick to respond to issues I have submitted. 13:53
I have dealt in the past with libzmq related problems… I can find relevant references of resolving those in macOS. But that might not be of interest to @perryprog and @Voldenet. 13:56
grondilu Hi all. I have an issue involving two modules in two files, so it's a bit difficult to show here. I'll try to explain. 14:11
I have a directory ./Foo/ and two files ./Foo.rakumod and ./Foo/Bar.rakumod 14:12
Foo is a module exporting a function.
Bar is a class using Foo
And calling the exported function inside a methoe
*method
rf ./Foo/Foo.rakumod?
grondilu no, just ./Foo.rakumod 14:13
problem is : when calling Bar.new.the-method-calling-the-Foo-func() I get an error "no such symbol in Foo" or something 14:14
rf How are you running it?
grondilu $ raku -I. -MFoo::Bar -e 'Foo::bar.new.the-func()' 14:15
let me show you the content
$ cat Foo.rakumod
unit module Foo;
our sub talk { say "hi" }
rf Ah maybe raku -I. -MFoo::Bar -e 'use Foo::Bar; Foo::bar.new.the-func()'
grondilu rf: I'll check that 14:16
nope, same error 14:17
$ cat Foo/Bar.rakumod
unit class Foo::Bar;
method talk { use Foo; Foo::talk;
}
So what am I missing and can you guys reproduce that error? 14:18
rf I would recommend using Zef to install your module 14:19
Anton Antonov @grandilu You can try defining the Foo function of interest as our and then use the full name "Foo::interest-func" in "Bar". 14:20
rf It takes away a lot of the Raku -I. use lib lib mess
Anton Antonov Also, 🤮 -- I hate the stupid foo-bar fashion of making examples.
[Coke] given the number of people in raku who use vi, I imagine you'll find a similar number who still use foo/bar/baz - they were quite popular back in the dark ages of the late 80s. 14:23
Anton Antonov @Coke Aha -- you showed yourself! 14:24
grondilu Anton Antonov: that's what I did, isn't it?
[Coke] I have often shared that I learned how to use vi on a mainframe and then got stuck. 14:25
Anton Antonov @grandilu Well, you did not say used our.
@Coke If I want to make a "search engine" for the Raku documentation where is single origin of truth for the individual parts?
[Coke] If you want to make a search engine for the docs, that's a big question and you should talk with the folks in #raku-docs about what you're doing and if it makes sense to have it be part of raku/doc-website 14:26
er, #raku-doc 14:27
perryprog (@Anton, lol regarding Mathematica-Raku)
Anton Antonov @Coke Thanks!
@Coke Also, a Raku package of such "search engine" might have a fairly large resources folder -- are there any guides, tips, rules, for Raku packages with large supporting data? 14:28
[Coke] over the last X years, raku/doc went from installing all the rakudoc files to not, because our install process was old and never updated to work once zef had helped fix how resources/ should work. 14:31
[Coke] so right now, I'm the wrong person to ask. If you're thinking of installing the raku/doc stuff as well, then we also need to think about raku/rakudoc (the CLI tool which right now works not on installed data, but an env var pointing to a folder) 14:32
I can tell you that raku/doc-website has a generated file in the deployed website that combines all the bits for the search index.
Anton Antonov @Coke This is helpful. More or less my approach is similar. 14:34
@Coke For example, here is a folder with the "search engine" files for Zef recommenders : github.com/antononcube/Scalable-Re.../main/Data . 14:35
Of course, if that collection files is too large, then they can be distributed separately. 14:36
@perryprog Well, I have to "finalize" and/or "speed-up" some of the conversions of Mathematica-to-Raku, but generally speaking I find the combination good enough. The "Jupyter::Kernel" package looks/feels very nice in VSCode (or VSCodium.) But, unfortunately I cannot install "Jupyter::Kernel" reliably on my mac. (Meaning, for example since rakudo version 2022.07 I cannot install "Jupyter::Kernel".) 14:38
grondilu Here is a shell script reproducing my issue: gist.github.com/grondilu/bdb1ea064...359fa97186 14:40
Anton Antonov: what would you use instead of 'foo bar'? 14:41
Anton Antonov @gradilu Shouldn't you have "use Foo;" in Bar.rakumod ? 14:44
grondilu it's inside the method 14:46
grondilu just checked if putting it outside changes anything. It does not. 14:52
Anton Antonov @grondilu (Sorry, I occasionally misspell your handle.)
grondilu no worries 14:53
Notice that if I put Bar not in Foo/ but in ./, and rename the class accordingly, it works just fine. 14:54
I suspect this is a bug, tbh. I'm considering creating an issue but I may be misunderstanding module use semantics. 14:55
rf Morning folks 15:04
tonyo rf: are you still using the dist branch of fez?
rf Probably
Lol
rf Why? Is it in upstream now? 15:05
[Coke] I have a raku script - if I do "script | garbage" I get a backtrace with "failed to write 6 bytes to filehandle..." - is there a best practice to avoid this? 15:06
tonyo it isn't but i'm about to push a bunch of stuff to get rid of the pax/tar/gzip shell outs 15:13
it'll have pure raku tar and zlib bindings
hopefully with all of the new usage mechanisms, logging, verbosity, and that it should be ready to start testing seriously as a module management tool 15:15
if you do a pull you should see a bunch of new stuff 15:18
lucs Does anyone know of any modules that supply interactive (possibly optional) tests? 15:36
I'm thinking of having such tests in a module I'm making and I'm wondering how other people would have approached it. 15:38
lucs Does an END block run if a program raises an unhandled exception and dies? 15:56
I guess it wouldn't always be possilbe, but could it, in certain circumstances? 15:57
lizmat END blocks are always run unless there's a segfault 16:03
even if you do an exit()
Nemokosch grondilu: I don't think that's an issue, it's just a depressing topic 16:04
lizmat PSA: it appears that the IRC logger conked out while I'm away, and I just realized I can't kick until probably Sunday
Nemokosch Foo::Bar doesn't implicitly mean "Foo/Bar" 16:05
lizmat I realize now in a bad way that server doesn't live in our DMZ :-(
my apologies: I'll resolve the logs with colabti's as soon as I can 16:06
lucs lizmat: Thanks (re. END)
Nemokosch actually, it would be interesting to know how Rakudo gets around packages
lizmat afk again&
Nemokosch because Rakudo really likes to use this convention
and it definitely doesn't install with zef... 16:06
tonyo gets around packages? 16:08
Nemokosch Rakudo is full of this pattern 16:09
IO::Path is under IO/Path.pm6 and somehow the other modules just find it
tonyo grondilu: what's the meta look like in that ? 16:10
tellable6 tonyo, I'll pass your message to grondilu
tonyo assuming there isn't one. if there was and you put Foo::Bar in the provides with the path to the right file, it'd work OK 16:11
Nemokosch how does Rakudo do this without META6 files? 16:15
take github.com/rakudo/rakudo/blob/main.../Array.pm6 for example. It's full of Rakudo:: scoped stuff.
is this something the Setting puts together? 16:16
tonyo it can find IO::Path because it's loaded by core.. you don't need to do anything to use it 16:22
m: dd IO::.keys
camelia ("ArgFiles", "Socket", "Path", "CatHandle", "Pipe", "Handle", "Notification", "Special", "Spec").Seq
Nemokosch Well, how does the core load it - especially in a way that other parts of core can also see the symbols? 16:26
perryprog Anton, what was the installation issue you were having? 16:35
tonyo rf: if you could pull on fez and provide feed back it'd be much appreciated 17:46
the only shell outs remaining are going to be difficult to do without depending on some library
[Coke] anyone remember the options to make less work like more? 17:56
[Coke] ah, nevermind. was trying "oh my zsh" and it's very... opinionated. 18:03
rf @tonyo which branch? 18:04
tonyo dist
rf On it! I'll let you know around sunday got a big release today at $work 18:05
[Coke] never do big releases on fridays! 18:06
rf Hahaha, I know. Unfortunately we have to get this out and i'll be On-Call saturday 18:07
[Coke] good luck, then.
rf Yeah, I'm fairly confident, though the whole github SSH thing makes me worried a little lol 18:08
tonyo: These changes look excellent 18:10
tonyo thanks dude
the bundling is the one i'm most concerned with..i need to deprecate checkbuild and replace it with something a little more robust
then `dist` will be released 18:11
rf Im wondering if that whole tar module could be its own thing
Feel like it may be useful :)
[Coke] +1
rf Really dig the cmd stuff too 18:12
tonyo yea it probably should be 18:20
tonyo i didn't go through the all of the file types with it yet 18:21
and it'll puke on links iirc (was a while ago i wrote that)
tonyo i _am_ hoping my abuse of MAIN catches on and we get better custom USAGES/suggestions 18:39
p6steve hi - I'm wrestling with %?RESOURCES ... anyone have a good working example I can look at? 19:19
Nemokosch the main thing to remember is that %?RESOURCES is conceptually flat. It's like an alternative to the file system. You declare which file you want to get and it will get it for you. 19:25
for example, there was this $dayjob module that had some js and css files in the resources folder
it listed them in META6.json, like this: "resources": [ "common.css", "chartgeneration.js", "chartjs2_7_0.js", "chartjs-plugin-piechart-outlabels.js" ] 19:26
tonyo p6steve: github.com/tony-o/raku-fez/blob/di...kumod#L706 19:30
tellable6 tonyo, I'll pass your message to p6steve
Nemokosch and then e.g %?RESOURCES<common.css> would be something vastly similar to an IO::Path object
p6steve tonyo: thanks!
Nemokosch the documentation also kinda has an example docs.raku.org/type/Distribution::Resource
p6steve nemo: yeah - i read the docs and already tried what you say ... 'only' problem is that it doesn't work ;-( 19:31
nemo: appreciate the help, all the same - tx
Nemokosch 🍰
tonyo p6steve: a lot of uses in that code base but you may need to grep 19:34
tellable6 tonyo, I'll pass your message to p6steve
tonyo another one exists in lib/Fez/Util/Zlib to get the right reference to zlib 19:35
p6steve ok - thanks for the help ... I have it ... what confused me is that you can't write %?RESOURCES<common.css> in a rakuscript, only in a rakumod !? 19:39
Nemokosch that's more than possible. It's a feature of a distribution. 19:41
rf p6steve: github.com/rawleyfowler/JSON-Simd/...rakumod#L8 19:49
tellable6 rf, I'll pass your message to p6steve 19:50
tonyo yea those are only available within the dist, so even in a bin/ _in_ a dist you can't get them. if you need them that way you should either put the CLI stuff in lib (which you should anyway), or make a helper to get the info for you (this leaks that data outside of the dist) 20:16
Ergo444 hi does zef update the index based on github automatically? 21:12
guifa_ it does -- but I don't remember what the lag time on it is 21:19
Anton Antonov @perryprog "Anton, what was the installation issue you were having?" -- Currently, the most significant is this one : github.com/bduggan/p6-digest-sha25...e/issues/5 21:34
p6steve ahhh - perhaps should be documented? 21:38
Nemokosch Ergo444: I think the question is a bit prone to misunderstandings. What do you mean by "based on github"? 21:58
if this is about module installation, the answer is more "no" than "yes", I mean, it takes REA into account (and it could take p6c into account) but you'd still need to let the ecosystem(s) know about your module 22:00
Voldenet grondilu: the problem with .rakumod-only modules is that there is no `project root`, so your module could be either Tmp::Foo::Bar or Foo::Bar or Bar depending on the root directory used, which causes ambiguities 23:49
tellable6 Voldenet, I'll pass your message to grondilu