🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
00:02 reportable6 left 00:04 reportable6 joined 00:16 Doc_Holliwood left 01:16 greppable6 left, releasable6 left, statisfiable6 left, coverable6 left, squashable6 left, linkable6 left, evalable6 left, quotable6 left, reportable6 left, bisectable6 left, committable6 left, shareable6 left, notable6 left, unicodable6 left, tellable6 left, nativecallable6 left, benchable6 left, sourceable6 left, bloatable6 left, releasable6 joined, shareable6 joined, bisectable6 joined, tellable6 joined 01:17 coverable6 joined, greppable6 joined, evalable6 joined, reportable6 joined, squashable6 joined, sourceable6 joined 01:18 quotable6 joined, linkable6 joined, benchable6 joined, committable6 joined, unicodable6 joined 01:19 nativecallable6 joined, notable6 joined, statisfiable6 joined, bloatable6 joined 02:19 bisectable6 left, linkable6 left, greppable6 left, statisfiable6 left, evalable6 left, releasable6 left, notable6 left, unicodable6 left, benchable6 left, sourceable6 left, tellable6 left, bloatable6 left, reportable6 left, squashable6 left, coverable6 left, quotable6 left, committable6 left, nativecallable6 left, shareable6 left, squashable6 joined, benchable6 joined, bloatable6 joined 02:20 statisfiable6 joined, reportable6 joined, releasable6 joined, greppable6 joined, sourceable6 joined, nativecallable6 joined, committable6 joined 02:21 bisectable6 joined, tellable6 joined, quotable6 joined, notable6 joined 02:22 unicodable6 joined, shareable6 joined, evalable6 joined, coverable6 joined, linkable6 joined 02:36 john joined 03:01 john left 03:06 Eddward_ joined 03:08 Eddward left 04:08 coverable6 left, releasable6 left, evalable6 left, notable6 left, reportable6 left, quotable6 left, shareable6 left, tellable6 left, bloatable6 left, committable6 left, greppable6 left, statisfiable6 left, unicodable6 left, squashable6 left, benchable6 left, nativecallable6 left, bisectable6 left, linkable6 left, sourceable6 left, nativecallable6 joined 04:09 quotable6 joined, benchable6 joined, shareable6 joined, notable6 joined, committable6 joined, statisfiable6 joined, reportable6 joined 04:10 unicodable6 joined, tellable6 joined, releasable6 joined, greppable6 joined, bloatable6 joined, sourceable6 joined, linkable6 joined, coverable6 joined, evalable6 joined 04:11 bisectable6 joined, squashable6 joined 04:51 bd3i left
avuserow m: sub f(@a) {dd @a}; f([:1a, :2b]); f([{:1a, :2b}]); 04:53
camelia Array element = [:a(1), :b(2)]
Array element = [:b(2), :a(1)]
avuserow why is my hash getting eaten in the second case? and is there any way to modify `f` so it does not happen?
I know I can add a trailing comma so it works so I'm guessing it's a form of the single argument rule? 04:54
m: m: sub f(@a) {dd @a}; f([{:1a, :2b},]); # works but easy to forget :( 04:55
camelia Array element = [{:a(1), :b(2)},]
05:44 Sgeo left 05:56 RandalSchwartz left 06:01 Doc_Holliwood joined 06:02 reportable6 left 06:04 reportable6 joined 06:25 xerxes joined 06:28 Eddward_ left 06:36 ufobat joined 07:08 holyghost left 07:14 abraxxa left 07:20 Doc_Holliwood left
raydiak yes, single-argument rule. the hash is being flattened into the array 07:23
m: dd [{:1a, :2b}]; dd [{:1a, :2b}.item]
camelia Array element = [:b(2), :a(1)]
Array element = [{:a(1), :b(2)},]
07:27 rhett joined, patrickb joined, rhett left
solitario m: say ("Hello world!"); 07:57
camelia Hello world!
08:23 xerxes left 09:17 MoC joined 10:12 peder left 10:15 peder joined 10:27 patrickb left 10:33 Doc_Holliwood joined
Altreus single-argument rule feels like a gotcha-by-design 11:04
11:10 sono left 11:38 patrickb joined 12:02 reportable6 left 12:05 reportable6 joined
lizmat Altreus: you have no idea how much discussion (online and in person) has happened about that in 2015 before the GLR 12:08
12:14 Eddward_ joined 12:15 Manifest0 left
Altreus I do not indeed! I have to imagine it wouldn't be a thing if it hadn't been considered better than not having it 12:18
I think it's one of those things where you don't realise how often it does DWIM when you're grumbling that it doesn't 12:19
12:24 Eddward_ left 12:33 phogg left 13:22 patrickb left 13:24 patrickb joined 13:40 RandalSchwartz joined 13:42 phogg joined 13:48 phogg left 13:54 bd3i joined 14:22 Sgeo joined
avuserow yeah, I remember the GLR from following IRC. of course, I didn't see the depth of the conversations. 14:26
it's interesting that hashes can flatten. I guess it makes sense since they are iterable
jdv "gotcha by design"? 14:36
Altreus The amount of debate that must have gone into deciding on this single argument feature suggests that it is the preferred option even though it is going to catch people out quite regularly 14:47
There's no way nobody realised the gotcha potential of this, but it went into the design anyway
liz's comment implies even more debate went into it than I even expected, so there must have been some pretty solid justification given how much of a gotcha it has turned out to be 14:48
15:01 swaggboi left 15:26 Eddward_ joined 15:44 bd3i left
lucs What happens with Inline::Perl5 if I later change my version of Perl, making unavailable the one that was active when I installed the module? 15:45
15:49 RandalSchwartz left
gfldex lucs: as long as you upgrade, you should be fine 15:58
lucs Not sure what you mean by "upgrade". 15:59
tonyo he renames his perl lib from perllib5 to perllib6 16:00
lucs ? 16:01
gfldex lucs: Your Perl code will behave the same way then if you would run it in Perl. If the change would work in pure Perl it will work with Inline::Perl5.
lucs In other words, Inline::Perl5 uses whatever version of Perl happens to be in the PATH? 16:02
gfldex Inline::Perl5 is using the Perl runtime to execute Perl code in Raku.
it's the libperl
lucs I see, okay, thanks. 16:03
gfldex: Also, thanks for those cool blog posts :)
gfldex you are welcome
Also, you are welcome to blog yourself. :)
lucs Nah, I don't have much to say. 16:04
gfldex I found that blogging is a great way to advance as a Raku beginner.
I'm advancing since 2008. :)
lucs And if anything, there are already way to many blogs, etc., cluttering up google search with beginner answers.
*too many 16:05
jdv p6 will never really die;)
tonyo perls strategy to never die was to blog that perl is dead
jdv the 100 year game 16:06
gfldex We advanced beginners get very little feedback from new beginners. It's hard to improve learning material if you can't watch the learners.
tonyo news.perlfoundation.org/post/wewan...perlisdead
Altreus I like it 16:25
Shame I'm only learning about it several months later
.oO( It's never too late to say that Perl is ... )
Altreus: re single arg rule 16:41
you want:
for @a { }
to iterate over @a, right ?
you don't want to have to do:
for @a.flat { }
that, in a nutshell, is why there is a single arg rule 16:42
Juerd Nothing says "Perl is dead" quite like signatures having had experimental status for 7 years :)
gfldex m: role mean { method make-fun-of-perl {} }; say „Perl is dead.“ ~~ True but mean; 16:45
camelia ( no output )
16:45 Voldenet left
jdv Juerd: or maybe the new "core oo system" not doing types. oo sans types - yeah, ok. 16:46
Juerd jdv: I don't see how that would say it's dead. If awkward design decisions meant programming languages were dead, that'd be true for basically every single one of them 16:47
Altreus lizmat: That seems like the sort of nutshell that contains a very complex nut 16:49
But if it were the choice between this gotcha, and for |@a {}, I'd choose the latter 16:50
lizmat well, yeah, that was an option...
gfldex The single argument rule doesn't work well for made up example code. In practical code it works rather well.
16:50 Voldenet joined
lizmat except that prefix | at the time was not slipping yet 16:51
jdv Juerd: i guess its not as strong as your example. to me is hints at it.
gfldex m: sub f($a is raw) {dd $a}; f([:1a, :2b]); f([{:1a, :2b}]);
camelia Array element = [:a(1), :b(2)]
Array element = [:a(1), :b(2)]
Altreus Well I don't want to open that can of nuts
lizmat for 1..5 { } # should that also need to become: for |1..5 { } ? 16:52
all in all I think the single arg rule is at least consistent 16:53
Altreus It's a choice of being more specific in one case, or in another case
lizmat and consistency was one of the goals of the GLR, as iteration and flattening before the GLR are were.... interesting
and definitely much harder to teach 16:54
Altreus But adding a comma that is astonishing to people not deep into raku, versus adding a piece of syntax that means expand this list...
lizmat so yeah, the 1-arg rule may be a gotcha, but it is something that is easily teachable
Altreus But it's also easily forgettable, which is why it's a gotcha
You can know it but still not realise you've been got by it
gfldex So far, I never hit this gotcha in practical code. 16:55
Altreus I'm assuming that the original message that prompted the discussion was the result of practical code
I know that kawaii_ has come across it himself
gfldex I use descructure a lot. So I might just dissolve stuff before the one arg rule applies. 16:59
kawaii_ I always forget about the 1 arg rule, without fail 17:02
jdv i've been tripped up by it multiple times 17:06
but i normally figure it out fast - it is an unfortunate design that's hostile to the drive by user i guess 17:07
Altreus I guess it's more obvious when your single argument needed manual destructuring than when it was automatically destructured 17:08
jdv if i coded in raku normally i likely wouldn't continue to forget
Altreus Potentially true. I'm constantly being put back into the P5 mindset where it's the context that's important 17:09
although I find P5's contexts to be a very elegant concept
lizmat fwiw, I find contexts in Perl the ultimate gotcha 17:14
and there are examples of serious issues in production code because of it
tonyo what is the "ultimate" gotcha on perl's contexts? 17:16
avuserow yeah, my example was simplified for IRC, but was real-world use 17:23
17:23 MoC left
avuserow I'm working on a module for generating SQL from data structures (think a simpler version of perl's SQL::Abstract) 17:23
and I thought I had a nice way of representing where clauses: lists, using pairs for equality, and hashes for custom comparison 17:24
so you would be able to write `[{:op<LIKE>, :$foo}]` and get `WHERE foo LIKE ?` with $foo as your bound param
Altreus Hmm, then the single-argument rule must be equivalent and it just requires experience in either situation
The only issues I've ever had with context have actually cropped up recently, and frankly you get what you deserve when you expose HTTP status codes to calling code that doesn't need to know 17:25
return ($code, $body) is NOT correct no matter how much you ignore me in code review :P 17:26
(The issue is that people not reading the docs called this in scalar context and accidentally got what they wanted, i.e. $body)
I guess things working by accident is way worse than things breaking by accident 17:27
17:28 Manifest0 joined
tonyo avuserow: db::xoos has a sql generator like that - the module was broken with some changes to the meta model six or so months ago 17:29
but that code exists and still works
avuserow it looks like it uses hashes for representing where clauses. how does it handle the need for duplicate columns? (e.g. to generate `WHERE a > ? AND a < ?`) 17:36
also I'm not fully able to use an ORM in this application, I need to run raw SQL fairly often. but for simple queries, I'd like to generate my own where clauses. 17:37
Altreus Sounds like SQL::Abstract, in which you do and => [ a => { '>', $val }, a => { '<', $val } ] or something similar 17:39
avuserow to get reasonable performance on some of my queries, I'm having postgres generate json directly: "SELECT json_agg(data) FROM ($sql) AS data"
Altreus i.e. you use an array and override the default behaviour, which is or
also for that you use between :) 17:40
avuserow between is not quite the same, it's <= and >=. which does not matter with integers but matters a lot with timestamps 17:41
Altreus ah you're right
but yeah if it's like SQL::Abstract it's usually quite simple
I prefer using data structures to represent SQL because SQL is great for humans to write and utter shite for computers 17:42
avuserow yeah, I've gotten a lot of mileage out of SQL::Abstract, though some of its stuff is maybe a bit more magic than I want these days
and after reading this (blog.kazuhooku.com/2014/07/the-json...ity.html), which I only _kind of_ agree with, I thought I would try my hand at making a less magic representation 17:44
tldr is if you accept JSON from a user, and put it in SQL::Abstract or friends, the user can change your comparison operators, and such
oh, also, by using an array for where clause, the signature of `update` does not have two Hashes in a row (for %set and %where), so I don't forget the ordering any longer 17:49
17:56 ufobat left 18:03 reportable6 left, reportable6 joined 18:05 Eddward_ left 18:10 aolko[m] joined
aolko[m] hi, i'm a curious php guy, curiously peeking into raku, feels a little weird 18:10
let's try starting off with:
1. is it possible to define your own keywords or redefine already existing ones?
* hi, i'm a curious php guy, curiously peeking into raku, feels a little weird, have some questions
lizmat depends on what you consider a keyword
aolko[m] for example `my` 18:11
18:11 notna joined
lizmat that would be tricky 18:11
aolko[m] i want it to be either `var` or `$`
18:11 notna left
lizmat so would this be about changing aspects of Raku, or to create an entirely new language ? 18:12
aolko[m] and yes most likely that would require building a separate module for that
18:12 notna joined
aolko[m] <lizmat "so would this be about changing "> something in-between the two 18:12
arrays, i feel like, would require the most tricks, since, you know, in php, there's only just arrays, no dicts, no hashes 18:14
gfldex aolko[m]: technically yes, but you would have to define a fairly brittle slang and we don't good a nice interface for slangs yet. 18:18
aolko[m] well, yes, but i'd rather go for a "toolkit module"
gfldex You can stick a slang into a module. 18:19
avuserow m: no strict; $foo = 1; say $foo # `no strict` exists, if you really want it?
camelia 1
aolko[m] unless you can spin a language of raku itself with those fixes as part of stdlib
gfldex You can "subclass" the Raku grammar and change it. This subclass is lexically scoped. 18:20
avuserow m: sub postfix:<!>(Int $n) {[*] 1 .. $n}; say 6! # defining a new operator is easy enough, for what it's worth
camelia 720
aolko[m] alright, so i can add to and change, what about "removing the fat"?
gfldex If you start removing stuff from the grammar you will have to re-write the compiler. 18:21
aolko[m] ouch
won't be easy for me
gfldex The compiler makes plenty of assumptions about the grammar.
aolko[m] can it be modified to be "unbiased"? 18:22
gfldex here is an example how far you can stretch a slang: raku.land/zef:tony-o/Slang::SQL
But, as I wrote, we don't got nice interfaces for slangs. That may change in the comming years. 18:23
aolko[m] it won't really be a slang, rather a mod
gfldex In Raku that is the same thing. 18:24
aolko[m] 🤷‍♂️
(if one can modify the compiler)
Kaiepi i tried that once 18:25
m: use nqp; BEGIN nqp::getcomp('Raku').^mixin: role { }
camelia ( no output )
gfldex slangs are hard. You need to know the grammar very well. 18:26
aolko[m] it's in java and c 🥲
<gfldex "slangs are hard. You need to kno"> what if instead, uhh, there would be a way to parse my own grammars? 18:27
Kaiepi huh, doesn't throw from a precomp context anymore
if memory serves me, at least
bisectable6, use nqp; BEGIN nqp::getcomp('Raku').^mixin: role { } 18:28
bisectable6 Kaiepi, Will bisect the whole range automagically because no endpoints were provided, hang tight
Kaiepi, Output on all releases: gist.github.com/48d47af045ea324546...7ce6a5c2c4
Kaiepi, Bisecting by exit code (old=2019.11 new=2020.01). Old exit code: 1
Kaiepi, bisect log: gist.github.com/3c4c4d19f5742b7d9a...9c82deb18f 18:29
Kaiepi, (2020-01-24) github.com/rakudo/rakudo/commit/b7...54ef5afd58
Kaiepi, Bisecting by output (old=2017.06 new=2017.07) because on both starting points the exit code is 1
Kaiepi, bisect log: gist.github.com/2ffdecf989df871eab...1d22eec28b
Kaiepi, (2017-07-08) github.com/rakudo/rakudo/commit/1a...2246c4c26c
Kaiepi, Bisecting by output (old=2017.05 new=2017.06) because on both starting points the exit code is 1
Kaiepi stahp
bisectable6 Kaiepi, bisect log: gist.github.com/fa3c4ba2ce4de3ba93...751c72ad25 18:30
Kaiepi, (2017-06-01) github.com/rakudo/rakudo/commit/c8...3cb5fd2068
Kaiepi, Bisecting by output (old=2016.09 new=2016.10) because on both starting points the exit code is 1
Kaiepi, bisect log: gist.github.com/dea4ba592230145532...c507c7063e
Kaiepi, (2016-09-27) github.com/rakudo/rakudo/commit/22...0f14b9c05c
Kaiepi, ⚠ New output detected, please review the results manually
Kaiepi, Output on all releases and bisected commits: gist.github.com/bbb128038b4cbe4620...cc6fd69b2f
gfldex aolko[m]: this might shed some light: www.youtube.com/watch?v=lwIXF25KJCo 18:31
Kaiepi aolko[m], if you try to modify the compiler, make sure it works when used from another module 18:32
aolko[m] i'd go full dog there i.kym-cdn.com/entries/icons/origin.../ihave.jpg 18:33
18:34 john joined 18:36 sono joined
Voldenet Same tbh, don't all programmers feel like that? 18:38
18:39 john left
aolko[m] no, after all you have languages popping left and right 18:39
as well as frameworks
so, at some capacity they know what they are doing and i'm not
Voldenet it's easy to make any framework and language, really - you just fork github code and sed-replace the name to your own one
please don't actually do that, it's a joke 18:40
aolko[m] and i meant from scratch
Voldenet I wouldn't use scratch programming language, but sure why not :> 18:41
aolko[m] and i meant "from zero", using just the vanilla source language :P
gfldex At least you will have something to do for the next 10 years. :) 18:42
aolko[m] nah, i don't have 10 years, i'm basically looking to replace a crumbling mess that is php7/php8 18:43
Voldenet Just read dragon book, it's only 1k pages of specialized jargon
aolko[m] therefore the need is hot
i don't do jargon, i do domain-specific knowledge
i.e. "knowledge-for-the-current-task/set-of-tasks only" 18:44
18:45 notna left
Voldenet aolko[m]: if you want to just declare your own keywords, perl5 has Keyword::Declare module for this 18:45
aolko[m] perl5 is dead, Jim
Voldenet no it's not, that's why perl6 renamed into raku 18:46
aolko[m] it is dead and will not recieve major updates, and it's not the channel for it
18:47 notna joined
Voldenet …perl7 was already announced though… 18:47
aolko[m] 🤷‍♂️
Kaiepi ohhh wait it was $*W i was trying to mess with, not the compiler 18:48
m: BEGIN $*W.^mixin: role { }
camelia ( no output )
Kaiepi and even then, only seems to happen when precomp is involved
could be other ways to shadow it though
aolko[m] and there seems to be no way of building a binary iirc 18:49
that [youtu.be/lwIXF25KJCo] was rather clumsy and didn't really clear things up 18:54
19:05 john joined 19:11 john left 19:24 john joined 19:36 john left 19:51 john joined 20:23 notna left 20:24 john left 20:27 patrickb left 21:25 Kaiepi left 21:26 Kaiepi joined 21:39 Altai-man joined 21:41 Altai-man left, john joined 21:51 Kaipi joined 21:52 Kaiepi left, john left 22:25 japhb left 22:31 swaggboi joined, japhb joined
SmokeMachine .tell avuserow have you taken a look at Red’s SQL generation? Mostly on how it converts Raku’s code into SQL? 22:44
tellable6 SmokeMachine, I'll pass your message to avuserow
SmokeMachine .tell avuserow it seems more magical than what you want… but maybe it worths taking a look 22:47
tellable6 SmokeMachine, I'll pass your message to avuserow
23:06 Eddward_ joined 23:08 RandalSchwartz joined 23:49 Doc_Holliwood left