🦋 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.
nemokosch raku.land/github:masak/Alma having * as version is not nice 15:24
antononcube 🙂 The corresponding GitHub repository has 217 open issues, (and 223 closed ones.) 15:37
nemokosch Including several by Mäsak himself since he stopped doing anything substantial 16:11
lizmat masak is behind the great firewall nowadays *and* busy with other stuff 16:18
nemokosch regardless, a *-versioned distribution popping up in raku.land is probably an anomaly 16:42
sitting on top of "recent dists" simply because some textual modification
lizmat I've created a PR with suggestion of publishing on zef 16:48
we can also of course remove Alma from the ecosystem 16:49
leont repeats his rant about versions versus version ranges 17:18
librasteve looking again at Alma - seems like there are some familiar things from the recent AST work … and yet I do not recall seeing any info on macros in the recent AST material … did I miss anything?
antononcube @leont Please summarize your recent publishing of "SQL::Abstract" in Zef ecosystem. 🙂 17:23
leont antoncube: in what way do you mean that? 17:24
antononcube @leont Agh, something you already did here: github.com/Leont/sql-abstract/blob/main/Changes 17:25
I should start keeping "Changes" files in my packages... 17:26
lizmat at the Raku Core Summit we agreed to look at what macros are going to do *after* the rest of RakuAST has materialized 17:30
librasteve lizmat: makes sense... I look forward to being able to instantiate objects via macros so that they can be precomped 18:04
coleman m: sub foo(@*cmd) { say @*cmd }; foo(<123>); 18:10
camelia Type check failed in binding to parameter '@*cmd'; expected Positional but got IntStr (IntStr.new(123, "123"))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
coleman m: sub foo(@*cmd) { say @*cmd }; foo(<123 456>); 18:11
camelia (123 456)
coleman I was expecting <123> to work
[Coke] m: sub foo(@*cmd) { say @*cmd }; foo(|<123>)
camelia Type check failed in binding to parameter '@*cmd'; expected Positional but got IntStr (IntStr.new(123, "123"))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
coleman m: sub foo(@*cmd) { say @*cmd }; foo(('123'));
camelia ===SORRY!=== Error while compiling <tmp>
Calling foo(Str) will never work with declared signature (@*cmd)
at <tmp>:1
------> sub foo(@*cmd) { say @*cmd }; ⏏foo(('123'));
[Coke] m: sub foo(@*cmd) { say @*cmd }; foo(<123>,) 18:12
camelia Type check failed in binding to parameter '@*cmd'; expected Positional but got IntStr (IntStr.new(123, "123"))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
nemokosch <123> is an Allomorph, not a list
coleman m: sub foo(@*cmd) { say @*cmd }; foo(@('123'));
nemokosch that's not going to work
camelia (123)
[Coke] Note the @* parameter, I am assuming that's why he thought it might.
(instead of a simple @)
coleman m: sub foo(@*cmd) { say @*cmd }; my @x = <123>; foo(@x);
camelia [123] 18:13
nemokosch that gets consumed by the bridge
as markdown
[Coke] m: <123>.WHAT.say 18:14
camelia (IntStr)
nemokosch oh, it's *@, not @*
[Coke] m: <123 2345>.WHAT.say
camelia (List)
nemokosch @* is dynamic
(and you should really be using **@ because *@ auto-flattens the received arguments) 18:15
Coke: good that you are here, I have a wholesome issue for zef-deps 18:16
zef broke one of the tests
coleman I am indeed mixing up *@ and @*; But the type of <123> was surprising
nemokosch I would say it kinda makes sense, given the round parens 18:17
but then
m: <foo >.WHAT.say
why doesn't it run
Raku eval (Str)
nemokosch so yeah, not even the whitespace helps here 18:18
[Coke] m: qqw{123}.WHAT.say' 18:19
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> qqw{123}.WHAT.say⏏'
expecting any of:
infix
infix stopper
statement end
statement modifier
stat…
[Coke] m: qqw{123}.WHAT.say
camelia (Str)
[Coke] m: qqw{123 234}.WHAT.say
camelia (List)
[Coke] I believe it's just nice syntax for a q*w op. 18:20
coleman it seems like only @( ) guarantees a "list literal"
nemokosch [] kinda does, too, but that's also just a coercion call
so [[whatever]] and [whatever] are the same
gfldex m: sub foo(@*cmd) { say @*cmd }; foo(@<123>) 18:21
camelia (Nil)
nemokosch @( ) calls .list and [ ] calls .Array iirc
gfldex m: sub foo(@*cmd) { say @*cmd }; foo(@(<123>))
camelia (123)
gfldex Anon got me again!
nemokosch sigils without the paren should be forbidden, change my mind 🐸 18:22
I don't think it would be even hard to implement that "ban" 18:23
just check why $[0, 1] works and remove the matching grammar rule 18:24
gfldex <123> is a plural form for a singular thing. Instead of whining Raku will invode the single argument rule and convert to a singular form. 18:25
m: %h = :1a, :2b; say %h<a>.WHAT; 18:26
camelia ===SORRY!=== Error while compiling <tmp>
Variable '%h' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏%h = :1a, :2b; say %h<a>.WHAT;
gfldex m: my %h = :1a, :2b; say %h<a>.WHAT;
camelia (Int)
gfldex %h<a> does not return a plural form. I my eyes that makes sense.
m: sub foo(@*cmd) { say @*cmd }; foo(123,); 18:27
camelia ===SORRY!=== Error while compiling <tmp>
Calling foo(Int) will never work with declared signature (@*cmd)
at <tmp>:1
------> sub foo(@*cmd) { say @*cmd }; ⏏foo(123,);
gfldex m: sub foo(@*cmd) { say @*cmd }; foo (123,);
camelia (123)
gfldex That's the one I don't like much.
[Coke] gfldex: do you mean to be using @* and not *@ ? 18:28
we switched halfway through. :)
gfldex Well, the need of *@ is kinda a consequence of the single argument rule for literals. And to make feed operators work. 18:29
nemokosch opened the issue for zef-deps 18:30
[Coke] nemokosch: thanks for the bug report, will drop a new version this weekend.
nemokosch thank you 18:31
librasteve dons hard hat 18:38
m: say (123) ~~ Iterable
Raku eval False 18:39
librasteve m: say (123, 456) ~~ Iterable
Raku eval True
librasteve m: say <123> ~~ Iterable
Raku eval False
librasteve m: say <123 456> ~~ Iterable
Raku eval True
librasteve BUT, the angle brackets are also shorthand for Allomorph literal 18:40
m: say <123>.WHAT
Raku eval (IntStr)
gfldex I strongly advice not to use `~~ Iterable`. 18:41
librasteve AND, also shorthand for qqw
m: dd <a b c>
Raku eval ("a", "b", "c") 18:42
librasteve gfldex: why's that then?
gfldex There is lots of stuff that got a .iterable but does not do Iterable.
librasteve so what's the best way to test for plurality? 18:43
nemokosch or not even .iterable but .list
looking at you, Blobs and Bufs 18:44
gfldex In doubt, don't test for plurality and call .map or .grep . And no, I don't like that answer either. 18:45
Iterators where added quite late to the language and clash with some of the design.
`for` used to forward to .map and still does when you `do for`. 18:46
librasteve m: 1.map(*.say) 18:47
Raku eval 1
gfldex Before lizmat added iterators, all you had to do for a custom type was to overload .map and .grep and iteration was covered. 18:48
Any got .map .
librasteve so I call map on a single item and get "True" ... how do I use that to test for plurality?
gfldex Sadly, gather/take is quite slow and that makes iterators useful. 18:49
librasteve m: my Buf $b .= new(^10); say $b ~~ Iterable; 18:50
Raku eval False
gfldex You can't really test for plurality. Nor should you need to care. That's what the one argument rule and slurpy arguments are for.
m: Buf.^mro.say;
camelia No such method 'mro' for invocant of type
'Perl6::Metamodel::ParametricRoleGroupHOW'
in block <unit> at <tmp> line 1
librasteve so my Buf has a list method but is not iterable ... well that's fine by me
gfldex m: Buf[8].^mro.say;
camelia No such method 'mro' for invocant of type
'Perl6::Metamodel::CurriedRoleHOW'
in block <unit> at <tmp> line 1
librasteve gfldex: I like that usually I don't have to care - but sometimes it may be that I want to care 18:51
anyway - I'll put on my back burner for now 18:52
gfldex I have the same urge. Raku is not the answer. At least not v6.d and v6.e .
librasteve that's the f burner then 18:53
nemokosch you can't not care when literally most of the essential data constructions may give you a sole instance or a list depending on the data they receive 19:20
librasteve m: sub plural(\x) { my $c++ for |x; ($c-1).so } say plural <123>; 19:56
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Strange text after block (missing semicolon or comma?) at /home/glot/main.raku:1 ------> plural(\x) { my $c++ for |x; ($c-1).so }⏏ say plural <123>; expecting any of: infix infix stopper statement end statement modifier statement modifier loop
librasteve m: sub plural(\x) { my $c++ for |x; ($c-1).so }; say plural <123>; 19:57
Raku eval False
gfldex @librasteve .elems is not a bad idea until you hit 1..* :-> 19:59
But then, one could argue an infinite list to be just _one_ things. 20:00
Plural is equally hard then singular, it seems.
librasteve well, maybe need ot guard things like infinite ranges... 20:02
gfldex You can't really do that, because of iterators. 20:03
librasteve sub plural(\x) { return True with x[1]; my $c++ for |x; ($c-1).so } 20:05
gfldex In Raku custom types can be infinite and lazy but wont tell you unless you try to iterate 'til the end. 20:05
gfldex And they don't have to implement AT-POS, either. 20:06
nemokosch .elems is usually not a good idea unless you really want to get an exact number 20:09
m: (1..*).elems.say 20:10
Raku eval Exit code: 1 Cannot .elems a lazy list onto a Range in block <unit> at main.raku line 1
nemokosch bang
(the bogus error message has been fixed since)
librasteve thought about .pull-one but then that is not idempotent 20:11
so basically raku is lisp under the hood 20:13
gfldex In Lisp, everything is a list. It does not have singular. Raku clearly does. However, it it not your concern to force conversion between singular and plural. You just tell the compiler what you want to do. And then the "strangly consistent"-thing happens. 20:15
nemokosch this is not the "strangely consistent" part, this is the "do what I mean" part 20:18
lizmat gfldex: for foo { } is basically foo.iterator.sink-all under the hood 20:59
foo.map is basically foo.iterator.push-all(@result) 21:04
it *is* the same mechanism under the hood, just different methods being called on the iterator
melezhik o/ 21:41
Announcement for SparrowCI users - dev.to/melezhik/sparrowci-has-move...ences-110o
weekly: dev.to/melezhik/sparrowci-has-move...ences-110o
notable6 melezhik, Noted! (weekly)
ugexe I’m pretty sure there are precompilation releases for arm 23:19