🦋 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.
tbrowder melezhik: thank you for the link 01:20
tellable6 tbrowder, I'll pass your message to melezhik
melezhik . 09:21
tellable6 2025-02-06T01:20:37Z #raku <tbrowder> melezhik: thank you for the link
melezhik tbrowder: yw 09:24
melezhik . 09:33
librasteve melezhik: thanks for these links ... I think that the template one is the bit of information that I was missing in my head ... now I see that the DSL is intended for remote actions via ssh to the target 12:08
tellable6 librasteve, I'll pass your message to melezhik
librasteve is there a cookbook example of running docker-compose on the target ... for example this is my WP docker-compose.yaml github.com/librasteve/raku-CLI-Wor...mpose.yaml 12:11
(Currently I am most interested in running Cro instead of WP on the target so an example of that would be perfect)
I am also considering Caddy instead of nginx to improve the letsenscrypt process 12:13
tbrowder librasteve: thnx for reminder of Caddy, but Apache has a module that also manages Let's Encrypt painlessly. 12:37
just have a cron job that reboots Apache weekly (for my sites) in the wee hours of the weekend. 12:39
timo apache should support config file reloading without a reboot 12:57
tbrowder not in this case because of the hands-off secure interaction required with lets encrypt. it takes a couple of two-way comms that i don't fully understand any more. 13:03
it's more than a config reload 13:04
tbrowder if all sites have the same cert date, then a 60-day reboot should be optimal 13:09
melezhik . 13:31
tellable6 2025-02-06T12:08:46Z #raku <librasteve> melezhik: thanks for these links ... I think that the template one is the bit of information that I was missing in my head ... now I see that the DSL is intended for remote actions via ssh to the target
melezhik librasteve: right, just make it sure you've installed the latest version of Sparrowdo , I've fixed few bug recently and released 13:32
also if you are into docker thins, sparrowdo could deploy things on docker via ssh as well 13:33
things 13:34
tbrowder it's tax time in the US and i just found a MIT licensed python program on GitHub that might be a good candidate for a Raku makeover for Raku marketing. it's called "tenforty" and can tie in with chatgpt and Jupyter notebooks. it is designed to test tax scenarios for ranges of tax inputs and choices. see <github.com/mmacpherson/tenforty> 13:37
melezhik what are popular template engine in Raku you might know? 14:26
I am thinking using one of those for Sparrow DSL
jdv raku?
melezhik yes 14:27
jdv no, i mean that can be a templating engine:)
melezhik ah. ))) 14:28
I still need templates somewhere )))
looking for this raku.land/?q=templater
jdv just curious - why? 14:29
i've never done any real templating i guess in raku. but i did write a xml etl tool once upon a time in raku and i used raku as the template lang
the nitty gritty of formatting was a little annoying but once figured out it was done and dusted 14:30
melezhik cause templates are convenient pattern for some class of problems/systems 14:31
for example in configuration management
jdv ok. one can create "templates" in raku. maybe our definitions of templates are different 14:32
melezhik I get that all could be done in Raku, but I am talking about a library, I don't want to create my own solution every time
melezhik template is basically is DSL which is rendered by some underlying programming language , should it be Raku or anything else, the stress on DSL 14:33
[Coke] search for "template" not "templater" ? 14:39
cro.raku.org/docs/reference/cro-we...ate-syntax ? 14:41
melezhik yup, I know that thanks, I am not sure if it's possible to reuse this module as is without cro ... 🤔 14:43
[Coke] Template::Mustache? 14:44
melezhik Template::Mustache looks good, the only concern it not actively maintained , judging by the last update date 14:46
jdv there's always inline::perl5 and the dozens of options over there:) 14:58
librasteve yeah I have once used Template::Mustache for assembling up spam emails and sending them to LLM to fuzzify
historically (ie with perl) I always leaned to Template::Toolkit 14:59
[Coke] github.com/raku-community-modules/template6 ? 15:04
patrickb Most template engines are small to medium sized projects. I wouldn't worry much about being actively maintained. Usually such projects either do their job fine, or are easily fixed up. 15:05
librasteve ^^ ++ ... maybe a couple of the more obvious ones would be good candidates for community modules 15:05
oh - I see already has been 15:07
for Template6
wafflus what does $() do like why is $(5) an int but $(1,2) a scaler and not an int 17:09
tellable6 2024-05-17T22:30:51Z #raku <ab5tract> wafflus: regex is not the approach to take for checking elements
2024-05-17T22:35:06Z #raku <ab5tract> wafflus: It’s like taking an entire type system and stringifying it :)
wafflus i mean not a list 17:11
wafflus :m say "test" 17:17
librasteve m: say "test" 17:19
evalable6 test
Raku eval test
librasteve (the colon goes after the m ;-) ) 17:20
to place a $ dollar sign before something is to itemize it (ie that places the thing into a Scalar container that can eg. be passed like a reference to a subroutine) 17:21
wafflus yes but why is it sometimes the scaler and them sometimes an int 17:23
and not the same for an array or a list
librasteve can you share some example code please
wafflus k 17:23
one minute 17:24
librasteve tx
m: say (1, 2, 3).VAR ~~ Scalar; 17:26
evalable6 False
Raku eval False
librasteve m: say $(1, 2, 3).VAR ~~ Scalar;
Raku eval True
evalable6 True
librasteve .VAR is a special method that gives you back the container of something (if there is one) docs.raku.org/syntax/VAR 17:27
Usually the container is transparent to operations, such as type checking (which is why I would like to see your code) 17:28
m: say (1, 2, 3) ~~ List 17:29
Raku eval True
evalable6 True
librasteve m: say $(1, 2, 3) ~~ List
evalable6 True
Raku eval True
wafflus pastebin.com/6NcekJTm 17:31
just based each section into the terminal
sorry i wrote it in emacs and it doesnt paste so well
librasteve tx! 17:33
wafflus like for instance if this is a string $("pear") then should this not be an $([1,2]) array or should both not be scalars?
librasteve you are asking .VAR.WHAT ... 17:35
wafflus yes sorry
librasteve what do you predict happens when you call .VAR on something without a container? 17:37
wafflus well not tbh it seems to be both sometimes it hard to know 17:39
librasteve lets try it, here's something with a container... 17:39
wafflus might have something to do with the brackets as well 17:41
librasteve ...checking 17:43
wafflus m: my \a = $(5); say a 17:44
camelia 5
wafflus m: my \a = $(5); say a.VAR.WHAT
camelia (Int) 17:44
wafflus i'm thinking it converts the values on the left to a scaler and then does the binding or assigment? 17:45
when you use my(\a,\b)
librasteve ok - here's what i think is going on and causing confusion 17:46
wafflus i am also not sure the difference between \a = and \a := i always thought they did the same thing 17:49
taht they always bind
librasteve if you go $(THING) then this does not itemize the THING if it is just a single thing - if its a list then is does get itemized
wafflus ok 17:50
so only a list will get converted?
or an array
etc
?
librasteve I think that $() is shorthand for .item as documented here docs.raku.org/type/Mu#method_item 17:53
that says Forces the invocant to be evaluated in item context and returns the value of it. 17:54
since the exceptions you have shared are single items already such as Str or Int, then this is a null operation for them 17:55
wafflus ah ok ty it just confusing when the literal is something and then when i bind to it it ends up as a scalar
librasteve ok so now these single things (literals) can be bound or assigned to dollar or sigilless variables 17:56
as you know, binding := simply associates the symbol on the left with the item on the right - no container is inserted 17:57
and assignment to a dollar variable, my $x; $x=42; will make a copy of the rhs and place in the container on the left (so this is why when there is an assignment there is now a container) 17:58
BUT there is no such thing as assignment to a sigilless variable 17:59
m: my \x = 42; x=43; say x
evalable6 (exit code 1) Cannot modify an immutable Int (42)
in block <unit> at /tmp/CanfPw63Jv line 1
Raku eval Exit code: 1 Cannot modify an immutable Int (42) in block <unit> at main.raku line 1
wafflus ok
librasteve You can use = in a declaration however, but that means "evaluate the rhs and then set the symbol to point to it" 18:01
so I think that raku lets you make the container on the rhs with eg $(1) and then binds the symbol to the container when you do that 18:02
wafflus ah ok tyi 18:03
librasteve got there in the end!
wafflus i think the () brackets at the left of the assingment change it as well 18:04
librasteve oh - lemme see
wafflus i mean maybe non of this is of any importance i just like to be able to expalin what happaning even if it is just to my self 18:07
librasteve I'm not sure ... this multiple declaration is like a sub routine call with a list on the right and a capture on the left - my initial tests suggest that there is no difference but I may have missed a wrinkle
yeah - I know the feeling 18:08
increasingly I think that raku is like those turtle pictures where most regular features on built on a set of composable primitives ("all the way down") 18:09
wafflus :)
lizmat m: dd 42.item.VAR 18:10
camelia 42
librasteve in this case, you have the primitives of containers, of sigils, of assignment and of binding ... and now you can combine these in many ways to get the job done in the most efficient way
lizmat m: dd Date.today.item.VAR
camelia Date.new(2025,2,6)
wafflus m:  my \ba = $(44) say ba.VAR.WHAT; my (\ta) = 5; say ta.VAR.WHAT ; 18:11
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> my \ba = $(44)<HERE> say ba.VAR.WHAT; my (\ta) = 5; say ta.V
expecting any of:
infix
infix stopper
postfix
statement end…
lizmat hmmm
wafflus m:  my \ba = $(44); say ba.VAR.WHAT; my (\ta) = 5; say ta.VAR.WHAT ;
camelia (Int)
(Scalar)
librasteve [now lizmat is going to come and explain what's really going on ;-)]
wafflus big guns 18:12
ty librasteve
lizmat well, not really, I'm afraid
wafflus btw its the same with $var binding will also bind to a scaler and not the int 18:13
lizmat I vaguely remember a discussion before (even in Rakudo issues) as to why $(scalar value) doesn't return a container
fact is that the item method: 18:14
method item(Mu \item:) is raw { item }
doesn't add a container (nor does it remove it
and $(foo) codegens to foo.item 18:15
however, the item sub *does* containerize
m: dd (item 42).VAR
camelia 42
librasteve say [1,2,3].item.raku; # OUTPUT: «$[1, 2, 3]␤» <=== from the docs
lizmat huh
m: dd (item 42)
camelia 42
librasteve oh - yes I see 18:16
lizmat hmmm.. apparently it selects this candidate: multi sub item(Mu $a) { $a }
which would actually de-containerize" 18:17
m: my $a = 42; dd $a, item($a)
camelia $a = 42
42
lizmat yu[
yup weird
m: my $a = 42; dd $a.VAR, item($a).VAR
camelia 42
42
lizmat m: my $a = 42; dd $a.VAR.^name, item($a).VAR.^name 18:18
camelia "Scalar"
"Int"
lizmat m: my $a = 42; dd $a.VAR.^name, $a.item.VAR.^name
camelia "Scalar"
"Scalar"
lizmat m: my $a = 42; dd $a.VAR.^name, 42.item.VAR.^name
camelia "Scalar"
"Int"
lizmat looks like commit b0caab5b reverted a change before 18:20
github.com/rakudo/rakudo/commit/b0caab5b 18:21
I don't recall why it was reverted, but judging from the day in the month, it could well be because of ecosystem breakage 18:22
wafflus kind of confusing for amateurs like me :) 18:23
lizmat I completely agree, and maybe we should revisit that before the 2025.02 release
[Coke] jdv what are your feelings / recollections about this ?
librasteve .oO 18:24
wafflus question are you guys more focused on backcompat or would you make changes and break back compat if it made the language more consitant? 18:26
lizmat back compat is important!
so most probably if we're going to fix this, it's probably in language version 6.e
to which you would have to opt-in at the moment 18:27
wafflus cool i think when you are smaller its easier to break compant if the change would be a benefit? but maybe a big language is is harder to break than compat?
i image perl is different than raku it that regards? 18:28
lizmat well, that's why we have language levels in Raku
if you specify a certain language level in your code, you're guaranteed the same semantics as long as that language level is supported by Raku
librasteve so does multi sub item(|c) {...} get selected on multiple arguments?
wafflus cool just sometime i think you guys give too much ways to do things 18:29
lizmat librasteve I think ik does
*it
wafflus: yes, I agree... that's the heritage I'm afraid
librasteve its the anti python
lizmat for example: I wouldn't be against having named arguments only be specifiable with the colon syntax 18:30
and not with the fat comma syntax
wafflus but it so wide!!
lizmat and have the fat comma syntax generate positional Pair arguments *always*
librasteve I think its nice to have options ... to the extent that raku is akin to a natural language, we humans are used to having many, many ways to say the same thing and then to select for nuance and emphasis 18:32
lizmat: you would drop Thing.new: name => value; eh? 18:33
lizmat yup, only Thing.new: :name(value)
you see: Thing.new: "name" => value 18:34
already produces a positional Pair
librasteve fwiw... I think that having a bit fat arrow can help when there is a lot of data to ingest ... I agree that the colon syntax is neater
lizmat m: sub a(|c) { dd c }; a foo => 42; a :foo(42); a "foo" => 42
camelia \(:foo(42))
\(:foo(42))
\("foo" => 42)
wafflus is there a way to write :foo(42) it without using the brackets? 18:35
lizmat if it's a numeric value, you can write :42foo
m: sub a(|c) { dd c }; a foo => 42; a :foo(42); a "foo" => 42; a :42foo 18:36
camelia \(:foo(42))
\(:foo(42))
\("foo" => 42)
\(:foo(42))
librasteve wafflus: now you do want another way - lol
wafflus typing () annyoing
:)
lizmat the idea behind allowing :42foo is that you could have a :$th named argument, and write :5th
librasteve kind of like a positional then 18:37
ordinal vs cardinal
here's the kind of code where imo a fat arrow helps: my \df = DataFrame.new( data => [[0..3] xx 6], index => (Date.new("2022-01-01"), *+1 ... *)[^6], columns => <A B C D> ); 18:39
lizmat librasteve the columns case could be shortened to :columns<A B C D> 18:40
in any case, it doesn't feel like either solution for that code would help readability
putting the data in a @data array first, and the index value in an index varlable, would allow you to do: 18:41
my \df = DataFrame.new(:@data, :$index, :columns<A B C D>)
librasteve btw this is not real code (phew) ... I wanted to exaggerate the fat arrow as a helper in a sea of brackets 18:42
lizmat which may be a bit less efficient, but unless it's ultra-hot code, it shouldn't really matter
jdv huh? you're asking about something from 2021? 18:43
lizmat yeah.. wonder if you by chance remember why that revert commit was done
jdv didn't you do the revert? 18:44
jdv that was also before i was rel mgr 18:44
maby sena_kun barely remembers? :) 18:45
lizmat jdv: I did... but I do a *lot* of commits, and only have a vague recollection of something that happened several 1000 commits ago :-
)
jdv i don't remember anything about it, sorry. 18:46
lizmat no worries!
[Coke] lizmat,jdv: in general, if you have a "risky" change, get it in ASAP and I'll do a Blin run asap 18:57
If you're asking more "why did we revert this particular item"... I think you're right as to why
I've only used $2.50 of my azure resources this month so far. :) 18:58
lizmat [Coke]: I was just thinking that maybe we should try to fix this weird discrepancy in 6.e maybe, not that we have revision-gated
[Coke] +1
librasteve_ www.irccloud.com/pastebin/hsBKPkGe 19:28
ugexe fat arrow provides a better multi-line alignment option 21:18
one can still do e.g. :foo( 1) but that juts doesnt seem as nice as foo => 1
i would never write :1foo 21:19
sena_kun jdv, what's the commit we're talking about? :) 22:18
ab5tract Couldn’t the distinguishing feature be whether there are any candidate signatures that expect positional Pairs? 22:21
Eg, fat arrows will still be named args except in the case where they are sent to a signature that expects named args? 22:22
It’s more complicated than a 100% clear cut distinction, but at the same time positional Pairs are less common than named args. 22:25