🦋 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.
00:07 reportable6 left 00:08 reportable6 joined 00:32 bigdata joined 00:46 jgaz joined 00:58 Kaipii left 01:03 Kaipii joined 01:12 [Coke]__ joined 01:15 [Coke] left 01:17 frost26 joined 01:19 [Coke]__ is now known as [Coke] 01:20 jgaz left 02:00 bigdata left 02:53 epony left 03:44 Sauvin left, Colere joined 04:38 razetime joined 04:56 epony joined 05:46 Xliff left, kueppo joined 06:07 reportable6 left 06:08 reportable6 joined
Kernspin Guten Morgen / Bonjour / Доброе утро / Good morning. 06:16
06:44 Nemokosch joined 06:48 sivoais left 07:31 razetime left 07:36 MoC joined 07:37 kueppo left 07:40 sivoais joined 07:42 Abhoerschutz joined
Nemokosch [Coke]: the idea sounds really good but unfortunately I have no idea how... 07:43
07:44 Abhoerschutz left 07:45 Kernspin left, Kernspin joined 07:47 Abhoerschutz joined 07:59 jjido joined 08:01 razetime joined 08:20 Abhoerschutz left 08:21 Abhoerschutz joined 08:30 daxim joined 08:51 jgaz joined 08:54 kueppo joined 09:18 jjido left 09:28 kueppo left 09:45 sena_kun left 09:46 sena_kun joined 10:02 jgaz left 10:05 labster joined 10:06 Kernspin left 10:08 Kernspin joined
Nemokosch Something doesn't click in. 10:09
If I have a script, the MAIN function can take enums
If I have a module, apparently it can't.
How do I fix that?
lizmat can't give an answer to this question: insufficient data 10:10
unless you want me to rubberduck :-)
Nemokosch Well, have you used an enum in the CLI of a module? 10:11
lizmat I've used True and False, yes ?
10:11 Kernspin left 10:12 Kernspin joined
Nemokosch An enum that lives in the module of the CLI, that is 10:12
10:12 Abhoerschutz left
lizmat Nemokosch: I'm now spending cycles trying to figure out what you mean 10:13
10:13 Abhoerschutz joined
lizmat I'd rather spend that on fixing any known problem 10:14
Nemokosch it shouldn't be that hard, though
there is the MAIN subroutine and it can take enums, that will be parsed okay - in theory
now, since I made my script a module under lib/ and export MAIN, trying to use it from a script 10:15
doesn't work anymore
10:17 frost26 left
Nemokosch it's really easy to reproduce, too, I'm gonna make a golfed gist in a sec 10:20
gist.github.com/2colours/d85b593f7...733f00d9c6 10:22
in a mi6 generated default module under lib and bin respectively
running demo.raku Wolves will just give you the usage 10:23
tried exporting the enum as well, didn't help on it 10:24
10:25 frost56 joined
lizmat is looking at it 10:25
10:25 tadzik left 10:26 crystalfrost[m] left, CIAvash left, Matthew|m left, AlexDaniel left, andrea[m] left 10:31 CIAvash joined
lizmat Nemokosch: I think it's a bug, located at github.com/rakudo/rakudo/blob/mast...in.pm6#L75 10:51
10:51 AlexDaniel joined, crystalfrost[m] joined, Matthew|m joined, MitarashiDango[m joined, tadzik joined, andrea[m] joined
Abhoerschutz Where can I found out, what modules (like Perl DBI::) Raku already owns? 10:52
Where can I finnd out, what modules (like Perl DBI::) Raku already owns?
Where can I find out, what modules (like Perl DBI::) Raku already owns?
lizmat Abhoerschutz: you could check raku.land 10:54
Abhoerschutz lizmat: Oh, thank you! Great.
lizmat Nemokosch: I think the ::(a) doesn't work in the import case
Nemokosch: you could check if there's already an issue for it, and if not, create one 10:55
Abhoerschutz lizmat: Very futuristic, nice website (raku.land). 10:56
10:58 labster left
lizmat Nemokosch: I don't see an easy workaround atm 10:58
Nemokosch My workaround was to use a string and convert it with EnumName::{$str} 10:59
lizmat well,, yeah.. but that's not generic ;-)
Nemokosch I don't know what ::(a) is or how it comes into play 11:00
11:03 kueppo joined, Kaipei joined 11:05 kueppo left 11:06 Kaiepi joined 11:07 Kaipii left 11:08 Kaipei left
lizmat Nemokosch: github.com/rakudo/rakudo/blob/mast...in.pm6#L75 11:09
11:40 lichtkind joined 11:54 Kernspin left, Kernspin joined 11:55 Abhoerschutz left, Abhoerschutz joined 12:06 reportable6 left 12:07 reportable6 joined 12:20 bigdata joined 12:29 gugod left 12:32 derpydoo joined 12:46 Abhoerschutz left, Abhoerschutz joined 13:09 dextercd joined 13:14 gugod joined 13:19 frost56 left
Nemokosch lizmat: I will check on the issues, I'm just not sure what to look for 13:36
lizmat enum?
13:38 sena_kun left
Nemokosch doesn't seem to help a lot 13:38
also, CLI allomorphs have further problems so it might not be named with "enum" somewhere 13:39
you might remember the Label fail where the built-in Label sabotaged parsing to the customly defined enum Label 13:40
Something else: is it possible that Cro had no realease for almost a year?
13:40 Nemokosch left 13:43 sena_kun joined
guifa_ Nemokosch: it's actively being developed, my guess is they just haven't been doing formal github releases 13:45
tellable6 guifa_, I'll pass your message to Nemokosch
Abhoerschutz Good afternoon. Guten Nachmittag.
guifa_ o/ 13:46
Nemokosch guifa_: no newer releases on raku.land 13:49
14:26 derpydoo left, [Coke]___ joined 14:29 [Coke] left 15:15 habere-et-disper joined 15:39 Kernspin left, Kernspin joined 15:42 Kernspin left 15:43 Kernspin joined 15:47 Abhoerschutz left, Abhoerschutz joined 16:06 sena_kun left 16:23 Colere is now known as Sauvin 16:24 masukomi joined, sena_kun joined, sena_kun left
Another interesting error for today: 16:25
I have a module that contains the following line of code:
const %specpath-from-projectid = %?RESOURCES<project_paths.conf>.IO.words;
I get the following error at compilation: # Missing serialize REPR function for REPR VMIter (BOOTIter) 16:27
if I change that line to `my %specpath-from-projectid`, it works
if I add `const $unused = %?RESOURCES<project_paths.conf>.IO.words.Map; dd $unused;`, it also works logs the correct value for $used
ugexe probably isn't a great idea to store lazy sequences in a compile time constant 16:30
16:35 kueppo joined 16:37 kueppo left
Nemokosch except it's not a lazy sequence but a Hash 16:38
ugexe .words does not return a Hash 16:39
Nemokosch % does, however
that assignment is eager 16:40
ugexe i was talking about the one i dont expect to work; the lazy one
if you're asking why the other ones works, well you already answered that 16:41
Nemokosch there was no lazy one
16:41 Nemokosch joined
Nemokosch beep boop 16:42
tellable6 2022-10-15T13:45:16Z #raku <guifa_> Nemokosch: it's actively being developed, my guess is they just haven't been doing formal github releases
Nemokosch m: % = 1..* #hangs becouse _it is eager_
camelia (timeout)
Nemokosch why would `const %specpath-from-projectid = ` be any different? 16:43
*constant, of course 16:44
`constant %specpath-from-projectid = %?RESOURCES<project_paths.conf>.IO.words.Map` also doesn't work, it really _is_ about the sigil difference 16:45
not laziness 16:46
16:47 Nemokosch left
ugexe m: const $a = 1 16:48
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$a' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> const ⏏$a = 1
ugexe m: constant $a = 1
camelia ( no output )
ugexe seems like `const $unused = ` should be throwing a compile time error and not work in any scenario 16:49
Nemokosch what is the difference between the $ version and the % version, then? 16:50
16:51 jjido joined
ugexe not sure, and i already spent some cycles trying to mentally debug something that doesnt compile :P 16:51
my next guess would be somehow related to the .IO call on RESOURCES doesnt return a normal IO::Path object like an e.g. string does 16:53
how that would affect that code, i dunno. but it is a difference between what you have and like constant %a = "META6.json".IO.words; say %a
what if you calls .words without the .IO? 16:55
%?RESOURCES<...>.words
evalable6 Use of Nil.words coerced to empty string
in block <unit> at /tmp/mpUHzCwYs0 line 1
Nemokosch should `constant %a = "META6.json".IO.words` work? 😄 At this point, I'm not sure if I can follow the narrative
16:56 MoC left
ugexe it doesnt even matter if it works or not, only that it has the same behavior as your example 16:57
(which it doesnt have the same behavior, to be clear)
when i try to reproduce i get a different error 16:59
===SORRY!=== Error while compiling /Users/ugexe/repos/zef/bin/zef
Cannot do 'readchars' on a closed handle
github.com/rakudo/rakudo/blob/dad8....pm6#L7-L9 17:05
is probably relevant
17:14 haxxelotto joined
Nemokosch Cannot do readchars was with $ = and without the .Map 17:23
17:41 jjido left, Abhoerschutz left, Abhoerschutz joined
mentioned commits: github.com/rakudo/rakudo/commit/64...9d6a77b844 17:43
github.com/rakudo/rakudo/commit/d4...9656c28232
from these, I don't see how "IO() **MUST** be determined at runtime" would follow, and in particular I don't think it was about this use case 17:45
17:45 Nemokosch joined
is there a way to modify a resource file after installation? 17:45
17:47 derpydoo joined
(to share my reasoning: if there is a transparent way to change resource files, I will gladly promote that possibility to the supposed users and use runtime resolution; if there isn't, slurping the content of the file could and should work, or else uglier workarounds need to be applied for the same effect) 17:49
ugexe once something has been installed it is meant to be immutable 17:57
17:58 jgaz joined
ugexe just allow it to be overriden in a location where its logical for the user to have write access to files `my $config = try { "~/.config/myapp/config.json".IO.slurp } || %?RESOURCES<config.json>` 17:59
18:01 justVain is now known as justache 18:03 razetime left
Nemokosch oh by the way, just now I checked... a Resource has loads of methods that call self.IO but it doesn't sound obvious that all those methods would inherit the "must be called at runtime" warning 18:04
nope, slurp doesn't work either xD
tbh it might be the most convenient if I simply expect the config file to be in the $*CWD, I need to see Windows compatibility anyway 18:06
ugexe you could also try like `$*DISTRIBUION.content("resources/config.json").open.slurp(:close)`
if you expect the config file in $*CWD then i doubt its going to work once installed
github.com/ugexe/zef/blob/3398a89d...od#L29-L32 18:07
18:07 reportable6 left
ugexe its pretty simple 18:07
18:08 reportable6 joined
Nemokosch I think the discussion is getting a bit messy. The $*CWD idea was meant for the runtime resolution, and for that, I see no reason why it wouldn't work 18:08
ugexe ...because installed things can run at runtime?
if myapp expects the config to be in $*CWD, you install myapp, and then change directories do you want it to not work? 18:09
Nemokosch I don't like the way this question is phrased lol but basically yes, that's exactly what I want. 18:10
I want it to work wherever the supposed user put the file with the supposed name and content.
ugexe i wouldnt bother making it a distribution then, since its not really distributed in the sense that libraries are 18:11
18:11 haxxelotto left
ugexe i guess i don't understand. i would just suggest doing it how zef does it since it provides defaults, user overrides, and is proven to work on basically all OS 18:12
github.com/ugexe/zef#global-configuration 18:13
Nemokosch I mean, it's really not a "distribution". It's just a directory that can be zef-installed for 1. dependency management 2. running tests 3. precompilation of actual code 18:14
ugexe it would be precompiled without installing fwiw 18:15
i usually run those types of "apps" like `raku -I $dir-containing-meta6 $dir-containing-meta6/bin/myapp` 18:16
although its true that installation guarantees all the files are precompiled immediately (revealing potential compile errors) 18:19
Nemokosch I'm not sure how it behaves but I have no issues with having an "undistributed", but otherwise zef-compatible "app"
like I don't see big disadvantages to what I'm doing, even if it's not meant to use most of typical distribution stuff 18:20
ugexe sometimes people write tests that don't end up using every module, and thus e.g. `prove6 t/` could show all tests passing but it would fail on install when one of those unused-in-tests modules gets installed/precompiled
Nemokosch and fwiw I don't badly need this "constant from resource file" feature (if I need it at all) but I do think the behavior is strange and the prohibition of compiling resource file content into the module is badly reasoned 18:23
Actually I feel lucky that I'm getting a feel for what is likely to be the problem, even when I think something could "just work" 18:25
CLI parsing, on the other hand, is really starting to be a problem, with the name collisions and badly exported enums 18:27
ugexe constant $config = $?DISTRIBUTION.content("resources/config.json").open(:bin).slurp(:close).decode.words; 18:38
evalable6 Use of Nil.words coerced to empty string
in block at /tmp/Ukckui_Lbr line 1
ugexe so uh that works too lol
18:39 jetchisel left
ugexe i suppose s/:bin// and s/.decode// would be the same and slightly shorter 18:39
18:41 haxxelotto joined 18:42 jetchisel joined
Nemokosch interesting, what is the content method? 18:45
ugexe github.com/rakudo/rakudo/blob/4cdb...pm6#L2-L18 18:47
basically you give content() a path as it is written in the meta6.json file 18:48
so .content("lib/Foo.rakumod") or .content("resources/whatever.json")
18:54 kueppo joined, Manifest0 joined
ugexe some explanation in this old advent post as well perl6advent.wordpress.com/2016/12/...ained-ish/ 18:56
Nemokosch thanks 18:58
18:59 habere-et-disper left 19:07 derpydoo left
guifa_ whoa 19:08
someone changed the $*DISTRO on the mac side from "macosx" to "macos"
easy fix for one of my modules but I was wondering why detection was way off
19:18 derpydoo joined 19:24 jgaz left 19:49 kueppo left 20:10 Nemokosch left
Nemokosch > Often used as a Boolean value. See operator. Made via the use keyword. 20:36
docs.raku.org/language/glossary#iffy 20:37
am I braindead or the "Made via the use keyword" remark makes no sense in this context?
20:37 sena_kun joined 20:49 derpydoo left 20:56 sena_kun left 20:57 sena_kun joined 20:59 haxxelotto left, haxxelotto joined 21:00 sena_kun left 21:01 sena_kun joined 21:05 derpydoo joined 21:08 Xliff joined
Xliff \o 21:18
[Coke] - Your gh wiki page isn't a bad idea for a dashboard. 21:19
An app server with controls might be a better one. Depends on how detailed you want to get with your dashboard.
Where are you getting your data? What metrics do you want to track?
21:20 jgaz joined 21:23 sena_kun left 21:24 sena_kun joined 21:25 Justin joined 21:26 Justin is now known as Justin546
Justin546 Can anyone tell me if I need to install postgres for Red ORM? 21:27
Xliff Justin546, If you are going to use Postgres in your application, then yes.
It does depend on DB::Pg 21:28
Justin546 I would prefer not to but when I zef install Red I get "Failed to find dependencies: pq:ver<5>:from<native>"
Xliff You can "zef install Red --force-install" 21:29
Justin546 Oh!  Okay, I'll try that.  Thanks!
Xliff You may also want to do that to DB::Pg 21:30
If push comes to shove you can always install Postgres and not use it.
guifa_ nemokosch: that's a joke, there, I think. 21:32
tellable6 guifa_, I'll pass your message to Nemokosch
21:34 TieUpYourCamel left
Justin546 Xliff: yeah --force-install didn't seem to do anything. I just wondered if this was normal as no mention of it anywhere. 21:34
Xliff Justin546, ah. mea cupla. 21:35
culpa, even :)
So just go ahead and install libpq
Nemokosch guifa_: apparently I'm not in a funny enough mood 😄 21:37
Justin546 I had that thought but abandoned it when I did apt search libpq and got 50 or so results.
Xliff Yeah. It's there. That's the proper package name for Debian/Ubuntu
Justin546 Xliff: libpq5, maybe?
Xliff Er. That's the one. 21:38
I don't know why they don't create a pseudo package pointing to the latest version. The dev package is still libpq-dev
Nemokosch Is PostgreSQL really needed for Red? 🤔 I wouldn't have thought. What a nuisance 21:39
Justin546 That did the trick! Thanks.
Xliff Nemokosch - Yeah. It's a dependency.
Justin546, yw. 21:40
Nemokosch what if somebody doesn't plan to use PostgreSQL? 😅 21:41
21:41 jetchisel left
guifa_ niiiiice 21:43
I just made a super simple module that produces a supply that emits anytime the timezone info changes (e.g. daylight savings time)
to use it's as simple as
Xliff guifa_++
guifa_, source? 21:44
21:44 haxxelotto left
guifa_ reach { whenever timezone-shifts() -> $metadata { ... } } 21:44
Xliff: I'm still self-bikeshedding names before I publish :-)
Xliff reach? 21:45
guifa_ react
Nemokosch react, right?
Xliff guifa_, Ah, OK. I was hoping to take a look at it so I can finally figure out the Supply paradigm.
I still have some misconceptions about react/whenever. 21:46
guifa_ Right now I've tentatively named the module Timezones::Live but that just sounds..... so..... HI I'M MARKETING LOOK AT MY FANCY NEW THING
Xliff LOL
Timezones::Event?
Hmmm.... same thing!? ^_^
Event::Timezone ? (LOL!) 21:47
Maybe.... Timezone::React?
guifa_ hmmm React sounds less market-y especially in the context of Raku since it's a keyword we have 21:49
Xliff Good.
Nemokosch I'm also curious about Supply's 21:50
Xliff Timezone::Action ?
guifa_ I think React is perfect
Xliff =D 21:51
guifa_ I'll finish documenting and I'll publish
Xliff \o/
guifa_ problem is... I don't really know how to write a test file for it
Xliff LOL.
Nemokosch I need a pushable and pullable queue for a TS discord bot
guifa_ "Please change your computer's clock to a few minutes before your timezone will change. then run the test file and wait until it happens"
Xliff Maybe a docker container where you do just that? 21:52
guifa_ yeah but that's not doable in the module test file
I just tested it as thoroughly as I could where I manually inserted values
Xliff Hmm... I could be more help if I saw the source. +D 21:53
21:53 sena_kun left
vrurg The module could easily be extended to produce not only timezone events. For future developement I would consider naming it DateTime::<something>. 21:53
guifa_ vrurg: hmm, good point 21:54
Xliff Yeah. It is... when it actually uses a DateTime
guifa_ it could chunk events like when the day rolls over, months roll over, etc
Xliff Until then, I would leave it TimeZone
guifa: Now THAT is worth the rename.
vrurg Xliff: renaming a module is a big trouble.
Xliff vrurg: Ah. OK. Didn't know that. 21:55
guifa_ I did it recently
This was my tactic
vrurg Xliff: just consider you have dependencies on that module.
guifa_ github.com/alabamenhu/UserTimezone...ne.rakumod
21:58 TieUpYourCamel joined
guifa_ okay between Xliff and vrurg this module is going to take a bit longer :-) 22:00
but I'll gist my current code for Xliff
22:03 Justin546 left
Xliff guifa++ 22:04
22:04 sena_kun joined
guifa_ Xliff: gist.github.com/alabamenhu/fe0ef49...28c32232a6 22:05
Xliff guifa: As for testing, create a custom timezone, compile it with zic -- set DST change over for 30 seconds in the future. Switch timezones. Start test. Wait 30. If no event within that time, then the test fails.
vrurg guifa_: consider different code structure. Something like `supply { loop { await $promise; emit; } }` 22:06
This way you wouldn't consume a thread. 22:07
guifa_ the supply would still run async though?
Xliff vrurg: Could that structure be repeated for multiple events? 22:08
vrurg Sure it will.
Xliff 'EVENT1: { supply { loop { await $promise; emit; }; }; EVENT2: { supply { loop { await $promise2; emit; }; }; ...
vrurg Xliff: of course. There are many ways. Promise.any to await for a couple of promises. Supply.merge for several supplies.
Xliff vrurg: Could you give me example of Supply.merge? 22:09
vrurg Xliff: not that way. `supply` returns a Supply. So, you could react on them separately. Or merge into a single one.
Xliff Id want to react separately. Sorry I misread. 22:10
vrurg Xliff: TIMTOWTDI ;)
Related to the module, it could be something like `react { whenever DateTime::React.timezone { ... }; whenever DateTime::React.date { ... }; }` 22:12
Ok, I'll be unable to type for a while.
vrurg is afk&
22:30 sena_kun left 22:35 derpydoo left
Xliff guifa: Adding many DateTime components to the gist. 22:36
One sec.
22:36 haxxelotto joined
guifa_ Xliff nice. Although the week will be ... more complicated 22:40
I'll need to get the user's language code for that
since some places start on Sun, Mon, etc
Xliff This is going strictly by rakudo's truncated-to 22:41
So it will be Sunday. Will have to add offsets for special-case SOW.
Although, in those cases, they might be better off going with the day trigger and checking the time attribute for the right date. 22:42
22:42 haxxelotto left
guifa_ In general my goal is for all my stuff to be pretty internationally aware from the get go, so I'll figure out a way :-) 22:42
Xliff Here's what I get when that event is tripped: Minute shifted for event TimeEvent.new(time => DateTime.new(2022,10,15,18,36,0,:timezone(-14400))) 22:43
guifa_ wants Raku to be the go-to easy-to-use language that works internationally
Xliff It triggers every minute, as expected.
And I now have a better grasp of Suppliers, supplies and react/whenever.
Thanks!
22:49 Sgeo left 22:51 dextercd left 22:52 Sgeo joined, lichtkind left 23:02 haxxelotto joined 23:41 jetchisel joined 23:45 bigdata left 23:57 jgaz left