🦋 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: ... | 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 8 June 2022.
00:01 linkable6 joined, evalable6 joined 00:07 reportable6 left, reportable6 joined 00:55 Sankalp left 00:56 Sankalp joined 01:04 clarjon1 joined 01:09 Khwarizmi joined
Khwarizmi Is anyone available to answer a few beginner questions? #raku-beginner seems dead 01:34
01:42 Khwarizmi left 01:58 p6steve left 02:00 p6steve joined 03:00 coverable6 left, quotable6 left, bloatable6 left, sourceable6 left, greppable6 left, linkable6 left, tellable6 left, committable6 left, statisfiable6 left, releasable6 left, unicodable6 left, reportable6 left, benchable6 left, shareable6 left, notable6 left, nativecallable6 left, evalable6 left, bisectable6 left 03:01 quotable6 joined, reportable6 joined, bisectable6 joined, sourceable6 joined, coverable6 joined, evalable6 joined 03:02 nativecallable6 joined, tellable6 joined, statisfiable6 joined, linkable6 joined, releasable6 joined, greppable6 joined, benchable6 joined, notable6 joined, bloatable6 joined 03:03 committable6 joined, shareable6 joined 03:04 unicodable6 joined 03:15 deoac joined, deoac left, deoac joined 03:16 deoac left 03:19 deoac joined 03:20 deoac26 joined, deoac left 03:26 andinus left 04:00 deoac26 left 04:35 [Coke] left 05:35 quotable6 left, bloatable6 left, sourceable6 left, statisfiable6 left, notable6 left, evalable6 left, unicodable6 left, reportable6 left, bisectable6 left 05:36 linkable6 left, benchable6 left, greppable6 left, nativecallable6 left, tellable6 left, shareable6 left, coverable6 left, committable6 left, releasable6 left, [Coke] joined, notable6 joined, releasable6 joined, unicodable6 joined, quotable6 joined, bloatable6 joined, sourceable6 joined, shareable6 joined 05:37 greppable6 joined 05:38 bisectable6 joined, evalable6 joined, reportable6 joined, linkable6 joined, benchable6 joined, committable6 joined, coverable6 joined, nativecallable6 joined 05:39 tellable6 joined, statisfiable6 joined 05:58 frost joined 06:07 reportable6 left 06:10 reportable6 joined 06:28 cmburn joined
cmburn Sorry if this is a stupid question, I *want* to use raku, but is there a maintained web framework out there? Best I can tell, only one I saw was abandoned 06:32
Currently use Mojolicious
kjp cmburn: The usually used web solution for raku is cro -- cro.services 06:35
cmburn Oh great, I hadn't seen that at all, all I'd seen was Bailador which seemed dead 06:38
Thanks!
:) 06:39
07:04 frost left 07:11 frost joined, lichtkind joined 07:44 kjp left 07:51 kjp joined 08:20 Guest3 joined 08:23 Tirifto_ left 08:54 Sgeo left 08:56 lichtkind left 08:57 lichtkind joined
Guest3 Is there any way to replace a method with augment? Still trying the same as yesterday, but "Cannot have a multi candidate for 'message' when an only method is also in the package 'X::Syntax::Confused'" 09:07
m: augment class X::Syntax::Confused { method message() { "I am confused" } } 09:08
09:08 clarjon1 left
camelia ===SORRY!=== Error while compiling <tmp>
augment not allowed without 'use MONKEY-TYPING'
at <tmp>:1
------> augment class X::Syntax::Confused⏏ { method message() { "I am confused" }
expecting any of:
generic role
09:08
Guest3 m: use MONKEY; augment class X::Syntax::Confused { method message() { "I am confused" } }
camelia ===SORRY!=== Error while compiling <tmp>
Package 'X::Syntax::Confused' already has a method 'message' (did you mean to declare a multi method?)
at <tmp>:1
09:17 cmburn left
lizmat m: class X::Foo is X::Syntax::Confused { method message { "I am foo" } } # why not subclass ? 09:22
camelia ( no output )
Guest3 I want to change compile time errors' messages 09:36
There's not much usefulness to this so it's not a big problem if that's not possible 09:37
lizmat Guest3: why do you want to change them? Do you think they're unclear / wrong? 09:38
if that's the case, maybe a PR would be a better solution ?
Guest3 Just for fun, to see how much Raku's internals can be changed, just like we can change the grammar 09:41
lizmat well, you appear to be going for one of the most difficult ones: changing the error message of a compile-time error 09:42
then again: 09:44
m: class X::Syntax::Confused is X::Syntax::Confused { method message() { "foo" } }; 32 45
camelia ===SORRY!=== Error while compiling <tmp>
foo
at <tmp>:1
------> fused { method message() { "foo" } }; 32⏏ 45
expecting any of:
infix
infix stopper
statement end
statement modifier
lizmat but that would only be in *that* lexical scope
09:47 Guest331 joined
Guest331 lizmat: sorry, lost my internet (and nickname apparently) 09:47
09:47 Guest3 left
Guest331 Is there any way to change the compile time error message? 09:47
lizmat m: class X::Syntax::Confused is X::Syntax::Confused { method message() { "foo" } }; 32 45
camelia ===SORRY!=== Error while compiling <tmp>
foo
at <tmp>:1
------> fused { method message() { "foo" } }; 32⏏ 45
expecting any of:
infix
infix stopper
statement end
statement modifier
lizmat create a subclass with the same name :-) will work lexically 09:48
m: class X::Syntax::Confused is X::Syntax::Confused { method message() { "foo: " ~ callsame } }; 32 45
camelia ===SORRY!=== Error while compiling <tmp>
foo: Two terms in a row
at <tmp>:1
------> d message() { "foo: " ~ callsame } }; 32⏏ 45
expecting any of:
infix
infix stopper
statement end
sta…
Guest331 Damn that's awesome 09:49
lizmat generally speaking: if you want to make changes to the language in a lexical scope, that's pretty easy 09:50
changing things globally is a different ballpark and generally not advisable
Guest331 Why can't I augment a non-multi method tho? Also why can't I augment roles? 09:52
lizmat again, you can do that lexically 09:55
m: role Associative does Associative { }
camelia ( no output )
Guest331 Why doesn't augment allow this?
lizmat as to the why? because it introduces action at a distance, and that is generally thought to not be a good thing 09:56
Guest331 Isn't augmenting class an action at a distance too? 09:58
lizmat indeed 10:03
whereas lexical subclassing isn't 10:04
Guest331 Then allowing augmenting of classes but not of roles
lizmat well, augment was decided upon very early in the development process of Raku 10:08
but later, when pre-compilation of modules was developed, turned out to be a design mistake
well, at least in my opinion :-)
in a language without pre-compilation, and everything is looked up at runtime, this is different, such as in e.g. Perl 10:09
need to go afk now&
10:14 Tirifto joined
nine If augmenting is the answer to your problem, you may be trying to solve the wrong problem 10:18
Geth doc/operator-table-fix: 68ca383047 | (Daniel Mita)++ (committed using GitHub Web editor) | assets/js/main.js
Fix precedence table ordering

Table header names changed in #4031. Closes #4085.
10:25
doc: m-dango++ created pull request #4086:
Fix precedence table ordering
10:26
10:33 andinus joined
Guest331 augment should be deprecated, shouldn't it? 11:10
11:11 lichtkind_ joined 11:14 lichtkind left 11:21 vrurg_ joined, vrurg left 11:39 frost left 12:07 reportable6 left 12:08 reportable6 joined 12:29 frost joined 12:43 lichtkind_ left 12:56 lichtkind joined 13:08 Guest331 left 13:59 frost left 14:10 Guest3 joined 15:10 benchable6 left, reportable6 left, evalable6 left, coverable6 left, releasable6 left, notable6 left, tellable6 left, shareable6 left, bloatable6 left, greppable6 left, committable6 left, bisectable6 left, quotable6 left, unicodable6 left, linkable6 left, statisfiable6 left, sourceable6 left, nativecallable6 left 15:11 nativecallable6 joined, greppable6 joined, sourceable6 joined, reportable6 joined, linkable6 joined, benchable6 joined 15:12 quotable6 joined, unicodable6 joined, shareable6 joined, committable6 joined 15:13 evalable6 joined, tellable6 joined, coverable6 joined, releasable6 joined, bisectable6 joined, bloatable6 joined, notable6 joined, statisfiable6 joined
Anton Antonov At some I heard in this forum the idea to implement a global setting that prevents random order in hash objects. Is this considered in a more serious manner or it is still "just an idea" ? 15:28
At some point I heard in this forum the idea to implement a global setting that prevents random order in hash objects. Is this considered in a more serious manner or it is still "just an idea" ?
16:13 linkable6 left, evalable6 left 16:16 evalable6 joined, linkable6 joined 16:22 Guest3 left
japhb Depends what you mean. Associatives are sorted when writing keys out during precomp, so that precomp is repeatable. There are also Hash::Ordered and Map::Ordered modules if you want to have associatives in your own code that track insert order (I use Hash::Ordered fairly regularly, in fact). 16:53
17:01 sena_kun left
Anton Antonov @japhb Thank you! I will try Hash::Ordered in next 1h... 17:02
17:02 sena_kun joined
Voldenet I don't think it's sane idea to depend on order of hashes 17:05
japhb Voldenet: There are definite use cases for ordered hashes. For example guaranteed round-trip ordering from unsorted inputs such as config files, so that any changes your code makes to the config hashes don't trash the user's layout. 17:14
Anton Antonov @Voldenet Depends what you want to do. Mathematica, Python, R and have ordered hashes -- very useful feature in data wrangling and visualizations and machine learning algorithms. 17:15
@Voldenet Depends what you want to do. Mathematica, Python, and R have ordered hashes -- very useful feature in data wrangling and visualizations and machine learning algorithms.
Voldenet but it is usually more useful to simply use arrays or lists 17:16
Sure, you get bad Big-Theta lookups with simply using iterables 17:17
but you can just extract (ref -> index) hash for faster lookups 17:18
japhb Voldenet: One idiom I use is to load data from a file into an ordered hash, so I get the associative I need elsewhere without forgetting the file's ordering, and then cache the .keys and .values from that ordered hash into positionals or iterables for use where those are what I want instead. 17:25
So I get the ordering, the associativity, and the steady-state performance. 17:26
Voldenet Ha, I don't even use the ordered hash
japhb In that case, you're probably doing something similar, with extra steps. :-) 17:27
Voldenet m: my @foo = "A".."X"; my &m = {.ord}; @foo.map(&m).first(* ~~ 70).say; my %k = @foo.map({ m($_) => $_ }); say %k{70}
camelia 70
F
Voldenet that's basically what I do 17:28
imo using a library _is_ an extra step
m: my @foo = "A".."X"; my &m = {.ord}; @foo.first({ m($_) ~~ 70 }).say; my %k = @foo.map({ m($_) => $_ }); say %k{70} 17:29
camelia F
F
Voldenet more like this
japhb I mean ... to each their own, I suppose. 17:30
Voldenet In the core Hash::Ordered works similarly, but it's hard to apply different indexing strategies that way 17:33
so I believe that keeping things as plain data structures inside a class allow easier performance tweaks later
m: my @foo = "A".."X"; my &m = {.ord}; @foo.first({ m($_) ~~ 70 }).say; my %k = @foo.kv.map({ m($^v) => $^i }); say @foo[%k{70}] 17:38
camelia F
F
Voldenet that's what would Hash::Ordered do 17:39
Anton Antonov @Voldenet When I try to execute your first two code examples above I am get the error: [No such method 'ord' for invocant of type 'Any']. (Sorry for being ignorant...) The last one works.
Voldenet hm, that would mean that &m was executed without topic variable 17:42
it's possible that `my &m -> $_ {.ord};` would work
erm
`my &m = -> $_ {.ord};`
(it's not directly the style I use, I just posted it as an example of the approach I use) 17:46
Anton Antonov I think during copy-and-paste some characters got lost. On my Discord window I see the code giving errors as [email@hidden.address] m($) => $ })" -- I assume it has to be "$_" , not "$". 17:47
I think during copy-and-paste some characters got lost. On my Discord window I see the code giving errors as "@foo.map({ m($) => $ })" -- I assume it has to be "$_" , not "$".
Nemokosch Yeah
Voldenet Ah, that makes sense 17:48
Anton Antonov @Voldenet Thanks for posting those examples -- I am trying to _not_ use Hash::Ordered.
Nemokosch I don't see why using a library (whatever even counts as a library and not the language itself) would be an extra step anyway 17:49
Also, in Python, the ordering in hashes made it to the standard, for example 17:50
Voldenet I've got this irrational fear of dependencies caused by seeing too many react projects 17:51
m: role Indexed[$indexer] { method AT-KEY($k) { self.first({ $indexer($_) ~~ $k }) }; }; my $a = [] but Indexed[{.ord}]; $a.push("a"); say $a{97} 17:52
camelia a
moritz Voldenet: call it "learned" and not "irrational"
Nemokosch Well it's rather a Pavlovian reflex 17:55
"Learned" in that sense
Voldenet indeed :)
Nemokosch When you implement something by hand, that can very well be a "dependency" - an internalized one 17:57
As long as you depend on stuff you are really using, it definitely has certain advantages (as well)
Voldenet it can lead to reinventing the wheel (along with the cart, the horse and the road) 18:00
18:02 evalable6 left, linkable6 left, linkable6 joined
Nemokosch This reminds me of the "wisdom culture" in the programmer community 18:03
It's so common to have visionary opinions about programming languages, infrastructure, paradigms and so on 18:04
18:05 evalable6 joined
And honestly they are often interesting 18:06
But they have to be taken with multiple grains of salt because your average wise programmer likes to reduce their model so that only their one key vision remains
18:08 reportable6 left, reportable6 joined
Voldenet It's always specific to problems encountered in the past 18:10
Nemokosch And often those problems are viewed through the lens of some preconception 18:14
Which, again, may not be a problem but it's definitely worth keeping in mind
Just take a look at the Perl-Raku split... 18:16
18:19 mexen joined
Voldenet true, the split only was needed because of the preconception that p6 will eventually replace p5 18:22
and the insanity is that p7 is only caused by that as well 18:23
18:32 Sgeo joined
Nemokosch And then everyone has strong feelings and some wisdom why Perl failed, didn't fail, sucks, sticks, you name it 18:47
19:00 mexen left 19:38 sena_kun left 19:39 sena_kun joined 20:35 cine joined 20:47 cine left 20:55 cine joined 20:56 cine left
Geth doc: uzluisf++ created pull request #4088:
Fix URL (#4087)
21:34
21:34 linkable6 left 21:35 linkable6 joined
p6steve m: sub sbv( %h --> Seq ) {%h.sort(*.value).map(*.key)}; my %x = %(a=>2,b=>0,c=>1); %x.&sbv.say; 21:40
camelia (b c a)
p6steve # sorts Hash by value, returns keys (poor woman's Ordered Hash)
m: sub sbv(%h) {%h.antipairs.sort.map(*.value)}; my %x = %(a=>2,b=>0,c=>1); %x.&sbv.say; 21:50
camelia (b c a)
p6steve (first seems more legible to me) 21:51
Voldenet but not "ordered" like search tree, but "retrievable by stored order" 22:02
p6steve I like this because (i) can use standard raku Hash forward as eg. an index from column label to column number very fast and clear, (ii) sort on column labels is native raku sort on couple hundred items - quite quick (0.95s for 100,000 pairs) 22:05
Voldenet: that's right - but my main use case is forward lookup as an index (label => col id) and I imagine that a native raku hash is fast in this direction, the ordered aspect is secondary (eg. to view a list of column name), and is cheap and stateless to do it this way 22:10
and I like that hashes are deliberately unordered -- that means there are two just concepts Array || Hash that can be blended to do a wide range of behaviours 22:15
(too much perl in my youth) 22:20
22:32 Sgeo left
Geth docker: MadcapJake++ created pull request #49:
Update Rakudo Star to 2022.04
23:17
23:32 evalable6 left, linkable6 left, evalable6 joined 23:34 linkable6 joined 23:41 lucs left 23:42 lucs joined 23:48 lichtkind left