🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
moritz fwiw I have a very good use case for a codepoint-based strings 06:10
JSON::Tiny had a bug where it didn't parse a string delimiter because it was followed by a combining character 06:11
having a codepoint-based string that I could do grammars on would have been the right fix 06:12
instead I had to do a very ugly workaround with :ignoremark and later extract the combining character in the action method
cpan-raku New module released to CPAN! Raku-GitHub-Workflows (1.0.5) by 03PMQS 07:54
lizmat clickbaits rakudoweekly.blog/2020/07/13/2020-28-bridges-7/ 09:18
jnthn ShimmerFairy: I was thinking more along the lines of introducing a .subuni and so that way you always know which units you are using and what you expect to get back. Also mirrors having .chars and .codes. I think ultimately we want them supported by the runtime's string subsystem rather than the current VMArray-based REPR of them, though... 09:19
Xliff \o jnthn 09:41
How goes RakuAST?
gfldex is there any way to force a segfault with Rakudo? 09:46
jnthn Xliff: Moving along steadily. I'm currently working through designing/implementing the RakuAST nodes for regexes. 09:48
gfldex: Well, nativecall and pass a junk pointer somewhere I guess will do it :) 09:49
m: use NativeCall; sub free(Pointer) is native {*}; free(Pointer.new(1))
camelia (signal SEGV)
gfldex tyvm that is just what I need. 09:50
I need to test error handling with Proc::Async and a segfault is as good as errors can get. :)
Xliff jnthn: Oh, excellent! 09:52
jnthn: Will RakuAST::Regex be able to walk the AST and rebuild the regex string? 09:55
jnthn Xliff: I've not really thought about going back in that direction... Do you have a use case? 09:57
Xliff jnthn: Not a practical one, as yet. 09:58
However I have been working with native code and GLib has a GRegex class: developer.gnome.org/glib/stable/gl...sions.html
jnthn OK. I didn't really have one either aside from a Perl-alike deparse thingy 09:59
Xliff And I have been wondering about interoperability with Perl5 and Perl6 regexs
Xliff jnthn: Is EVAL the only way to evaluate string containing a regex (including metachars)? 10:00
Or would that be a better question posed to moritz?
jnthn Well, if you're embedding it in a regex, you'd do /<$regex-string>/
jnthn Which does EVAL under the hood 10:01
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($r ~~ /<$r)/).gist.say 10:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in metachar:sym<assert>; couldn't find final '>' (corresponding starter was at line 1)
at <tmp>:1
------> 3 = 'a (b) c'; my $s = "abc"; ($r ~~ /<$r7⏏5)/).gist.say
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($r ~~ /<$r>/).gist.say
camelia Nil
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say 10:02
camelia 「abc」
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say ($s ~~ /a (b) c/).gist.say 10:03
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3; my $s = "abc"; ($s ~~ /<$r>/).gist.say7⏏5 ($s ~~ /a (b) c/).gist.say
expecting any of:
infix
infix stopper
statemen…
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say; ($s ~~ /a (b) c/).gist.say 10:03
camelia 「abc」
「abc」
0 => 「b」
Xliff m: my $r = 'a \(b\) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say; ($s ~~ /a (b) c/).gist.say
camelia Nil
「abc」
0 => 「b」
Xliff m: my $r = 'a \\\(b\\\) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say; ($s ~~ /a (b) c/).gist.say
camelia Nil
「abc」
0 => 「b」
Xliff m: my $r = 'a (b) c'; my $s = "abc"; ($s ~~ /<$r>/).gist.say; ($s ~~ /a (b) c/).gist.say
camelia 「abc」
「abc」
0 => 「b」
Xliff Odd.
Xliff So why isn't the grouping picked up in the first regex? 10:04
m: my $r = 'a (b) c'; my $s = "abc"; (EVAL "\$s ~~ /<$r>/").gist.say; ($s ~~ /a (b) c/).gist.say
camelia 5===SORRY!5=== Error while compiling <tmp>
EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma
to override this error but only if you're VERY sure your data contains
no injection attacks).
at <tmp>:1
------> 3c'; my …
moritz m: my $re = 'a (b) c'; say 'abc' ~~ /$<foo>=<$re>/
camelia 「abc」
foo => 「abc」
0 => 「b」
moritz Xliff: you can get the capture like this 10:04
Xliff m: use MONKEY-SEE-NO-EVAL; my $r = 'a (b) c'; my $s = "abc"; (EVAL "\$s ~~ /<$r>/").gist.say; ($s ~~ /a (b) c/).gist.say
camelia No such method 'a' for invocant of type 'Match'. Did you mean 'at'?
in block <unit> at EVAL_0 line 1
in block <unit> at <tmp> line 1
moritz m: my $re = 'a (b) c'; say 'abc' ~~ /$0=<$re>/
camelia 「abc」
0 => 「abc」
0 => 「b」
Xliff moritz++: But that makes the first Match object different from the second. 10:05
Thanks for the hint!
moritz yes, it's wrapped in one layer of capture 10:06
Xliff m: use MONKEY-SEE-NO-EVAL; my $r = 'a (b) c'; my $s = "abc"; (EVAL "\$s ~~ /<\$r>/").gist.say; ($s ~~ /a (b) c/).gist.say
camelia 「abc」
「abc」
0 => 「b」
moritz I don't think there's a way around it with <$re>
Xliff m: use MONKEY-SEE-NO-EVAL; my $r = 'a (b) c'; my $s = "abc"; (EVAL "\$s ~~ /\$r/").gist.say; ($s ~~ /a (b) c/).gist.say
camelia Nil
「abc」
0 => 「b」
Xliff m: use MONKEY-SEE-NO-EVAL; my $r = 'a (b) c'; my $s = "abc"; (EVAL "\$s ~~ /$r/").gist.say; ($s ~~ /a (b) c/).gist.say 10:07
camelia 「abc」
0 => 「b」
「abc」
0 => 「b」
Xliff ^^ That's what I'm looking for. 10:07
Have to use EVAL
jjatria I was surprised yesterday to realise that IO::Notification::Changed objects have a `.path` attribute that returns a Str rather than an IO.Path. Is there a reason for this? 10:09
I had to use an awkward looking `.path.path` 10:10
sena_kun jjatria, hmm, not `.path.IO`?
I think you can argue it either way, but Str is probably cheaper and not always you want to have a IO::Path object, sometimes just path is enough. 10:11
jjatria sena_kun: I didn't think about it at the time. `.path.IO` does look better 10:12
I think I was just surprised that it would return a Str, but I guess I can see why that is
jnthn Honestly, I suspect oversight more than anything, though. 10:14
lizmat yeah, IO::Path in that sense is a bit of a mess 10:20
jjatria Maybe it's for consistency with IO::Path.path, which returns a Str? 10:21
lizmat m: dd $*CWD.^name
camelia "IO::Path"
lizmat so, an IO::Path stores a $*CWD value (which is an IO::Path) as a Str :-)
jjatria Is this something that we'd be willing to change? If so, I'd love to take a stab at it 10:24
lizmat jjatria: be careful what you're getting yourself set up for 10:28
jnthn It's one of those "in principle yes, but we don't have the mechanism for doing it with back-compat yet", I think. 10:29
lizmat I think the best thing would be to actually create a module that takes on IO::Path's functionality
jjatria I thought hubris was a requirement :P
lizmat and then by the time the newdisp branch has landed, we could think of integrating it as a language version change
jnthn: would that assessment be correct ? 10:30
jnthn lizmat: tbh, I'm not sure there'd be much of a module to write here, but yes, waiting until we have the means to do that (and somehow not forgetting...) makes sense. 10:37
And I suspect new-disp will be involved in the solution 10:39
jjatria What is new-disp? 10:43
sena_kun jjatria, a branch where the work is ongoing on rewriting current dispatching mechanism, see gist.github.com/jnthn/e81634dec57a...b92c722959 if interested. 10:46
jjatria sena_kun: Thanks! 10:54
Petr37 Can i set sub as hash value? 11:32
lizmat m: my %h; %h<a> = &sum; say %h<a>(42,666) 11:33
camelia 708
lizmat Petr37 ^^ 11:34
Petr37 Thanks!
So easy )
lizmat yup!
of course, it can be anything Callable 11:35
m: my %h; %h<a> = { $^a + $^b } ; say %h<a>(42,666)
camelia 708
lizmat m: my %h; %h<a> = * + * ; say %h<a>(42,666) # shorter still
camelia 708
Petr37 Great 11:36
Petr37 Can anyone provide me lambda example? )) 11:44
Petr37 Can't find any info 11:45
elcaro Petr37: there's a few ways, but eg. -> $a, $b { $a + $b } 11:47
m: my $x = -> $a, $b { $a + $b }; say $x(3, 4)
camelia 7
elcaro or you could declare it and call it in one go 11:48
m: say (-> $a, $b { $a + $b })(3, 4)
camelia 7
elcaro but a lambda this simple could be defined as `* + *`
m: say (* + *)(3, 4) 11:49
camelia 7
Petr37 Thanks 😊
Petr37 What means $^a ? 11:59
Special variable?
lizmat docs.raku.org/language/variables#i...LEX_ACCENT
Petr37 Understood 😊 12:02
Xliff m: $~Regex.say 12:58
camelia Slang.new(:grammar(Perl6::RegexGrammar), :actions(Perl6::RegexActions))
Xliff Does that imply I can add metachars to the P6 regexes?
The example given doesn't explain that enough, although I know that might not be its intended purpose. 12:59
pilne odd question, but here goes nothing! 13:40
can i use rakubrew to install raku to a usb stick for portable funzies? 13:41
dakkar probably? I think the main problem might be if full pathnames are stored somewhere 13:42
I say try it and see 13:43
(it's going to be easier and faster than reading all the source involved ☺)
pilne the part that "worries" me is that it says to change the location of where it puts the files, i need to modify .bashrc or the equivalent (so i'm assuming "environment variables" on win10) 13:44
tadzik heh, your nickname means "urgent" in polish O)
pilne lol!
never knew that
i just almalgamated pi, ln, and e :D
dakkar pilne: well yes, you need to change PATH at least
jnthn tadzik: Curious, in Czech it's more like "diligent" :) 13:45
pilne i should open a ticket asking for that to be something that can be changed in the program and not as an environment variable. 13:46
dakkar pilne: no, that's not possible
your command interpreter / shell has a list of places where it looks for programs to run 13:47
tadzik jnthn: huh, I didn't know the czechs were such false friends ;)
dakkar the only way to have it look in another place is to tell it
and due to the way processes and environment variables work, a program executed from the shell can't change stuff inside the shell itself
pilne yeah 13:48
i just have most of my free time to program these days during lulls at work
but anything i want to use has to run off of a usb stick for reasons :D
pilne things like zerobrane (for lua) and strawberry perl work just fine (swi-prolog too with the portableapps.com version). 13:49
pilne but i'm assuming that raku is significantly more complicated due to it also having a vm. 13:49
dakkar how do you run strawberry from the command line?
(no, it should work very much the same way) 13:50
pilne i installed strawberry on the stick at home, and it just works when i launch it's dedicated shortcut to a "perl cmd window"
dakkar aha!
that's your trick
that "perl cmd window" sets the environment up for you
look at how that works, and do the same thing for your "portable raku" 13:51
pilne so, the concept would be to manually make a folder with the moarvm/raku on the usb stick
and then a shortcut like that one
dakkar "manually"… I'd let rakubrew make it
but yes
pilne so, install rakubrew
open a window, set the rakubrew_home variable 13:52
even if temporarily
install it to the stick
pilne and then use the strawberry perl one as a template 13:52
dakkar that should be very close to everything you need, I think
pilne 104
errr 10-4
dakkar oh, also: write an article explaining what you did ☺
so that lizmat can include it in the weekly 13:53
pilne :D
dakkar even (especially) if there complicated parts, or if it doesn't work!
known problems are much easier to fix that unknown ones
pilne ngl, i'm still damn infatuated with prolog, but that's only driven me to try and make a "inline::Prolog" kinda thing, or just a grammar that "kinda" does some prolog-y things. 13:54
declarative/logic is an interesting paradigm, like all the others it has some areas where it makes things stupidly simple, and others where i sit around wondering what the fucking mess of code i wrote is going to do when trying to do something that would be "simple" in raku/perl/lua/scheme (my 13:56
non-prolog loves)
tyvm for the brain food
hopefully i can give it a whirl later today
dakkar keep the channel informed!
patrickb dakkar, pilne: It's actually really simple to get raku running off a USB stick. You don't need rakubrew for that. 14:20
Download one of the precompiled releases from rakudo.org/downloads They are all relocatable.
pilne O.o 14:21
patrickb They do contain a script in /scripts/set-env.bat/sh that will set the PATH variable in your current shell.
pilne zef will behave too?
patrickb Yet, it will.
*Yes
pilne mind blown
dakkar dammit, no new article then!
😁 14:22
pilne even on windows huh (i noticed your script reference was in *nix style)
patrickb dakkar: An article still be a good idea, as obviously noone in the last half an hour or so knew about this (I don't count as I'm responsible for all the relocatability stuff) 14:23
So if you are actually thinking about an article, please do write about it!
Have to leave. o/ 14:25
pilne tyvm
pilne so the process has changed to "download this relatively small zip folder, extract it to my usb, and then figure out the magic going on in the strawberry perl cmd shortcut and apply my knowledge :D" 14:25
pilne now for the elephant in the room though, can comma run off a usb stick? 14:33
dakkar again, probably? try ☺ 14:34
pilne if no, i don't mind using a basic text editor for my dabblings at work :D
well, it takes a lot of time to try usually, since i do the install at home, and test it at work :D
dakkar I don't have any Windows machine, so I can't really say if/how it will work for you 14:35
pilne hehe
i only went back to windows to game better with the gf, our "at home quality time" often consists of pvp in world of warcraft (: i really do miss having my linux boxes setup too. 14:36
dakkar on a linux box, I'd expect it to JustWork™, regardless of the path where I'd unpack the tarball
dakkar a thing that will probably not magically work on windows is file association 14:37
but last time I looked at how that was implemented, we were still running 98 and NT3
pilne i don't really need file association for what i'm doing at work, as long as i can open comma, and point it at the files it needs, it should just work 14:38
jnthn pilne: On Linux, I think comma off USB stick probably just works out, because it runs wherever you unpack the tarball. For Windows, I'm not sure, but there's a decent chance it'll work out too. 14:39
pilne the day can't come too soon that i can have at least two computers and 3 monitors setup :D 14:40
but thanks for the reassurance that it's at least worth a shot jnthn (: 14:41
dakkar not related, pilne, but: why are some of your smileys turned one way, and some the other? 14:42
pilne too much time on android where it makes the :) into an emoji way more often than i like
dakkar ooohh! lol
fair 14:43
[Coke] did a build of head. run make spectest, it says inline::p5 isn't installed, gives me a line to run to install it. do so, and rerun spectest... it's still not found. 14:45
ISTR mentioning this a few months ago. would ticket go in roast or rakudo? 14:46
[Coke] updates R#2815 14:51
linkable6 R#2815 [open]: github.com/rakudo/rakudo/issues/2815 Inline::Perl5 integration tests are no longer run
Petr37 Have Raku html parsing module? 15:45
jdv79 should be on modules.raku.org
last time i tried to use some (2y ago?) i fell back on Perl/Mojo. maybe they are better now. 15:47
JJMerelo Petr37 there's DOM::Tiny modules.raku.org/dist/DOM::Tiny:cpan:HANENKAMP But you can use via Inline::Perl5 any perl module too 15:48
Petr37 several more too if you search HTML in modules.raku.org modules.raku.org/search/?q=HTML 15:49
jdv79 iirc HTML::Parser::XML is afflicted with perf issues cause grammars. and gumbo used to have a mem issue? 15:52
Petr37 What about Bailador? 15:57
sena_kun jdv79, gumbo is quite okay and the old issues were fixed IIRC. 15:58
Petr37 Can't find Mojo last updated 15:59
jdv79 i was referrring to Mojo::DOM, sorry. 16:01
Petr37 Ok)) 16:02
jdv79 sena_kun: i noticed that lately but haven't had a chance to try it again. 16:02
Petr37 Anyone know GUI library for Raku? 16:03
I need something like webview 16:05
JJMerelo There's Gtk3 16:06
It works pretty well. Don't know about webview. If it's a bit like Electron, no, I don't think we have that yet. 16:07
Geth_ ecosystem: 1a2182c735 | (Richard Hainsworth)++ (committed using GitHub Web editor) | META.list
Add Generic Pod Renderer to ecosystem

Distribution contains Pod::To::HTML, Pod::To::MarkDown, and a Graphical README.md generator from Pod in Module file. Generates TOC and Glossary and puts them in HTML. Customisable CSS and favicon. Implements P<> format code (old Pod::To::HTML does not do this). Pod::To::HTML in this distribution passes all old Pod::To::HTML tests All output determined by customisable Templates (Mustache engine but this can be changed by subclassing) Lots of Documentation on usage and subclassing.
16:10
ecosystem: ccec92e3fc | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Merge pull request #516 from Raku/finanalyst-patch-3

Add Generic Pod Renderer to ecosystem
Petr37 Where i can find lazy list example? 16:42
moritz m: my @squaress = (1..*).map(-> $x { $x * $x }); say @squares[12] 16:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@squares' is not declared. Did you mean '@squaress'?
at <tmp>:1
------> 3ss = (1..*).map(-> $x { $x * $x }); say 7⏏5@squares[12]
moritz m: my @squares = (1..*).map(-> $x { $x * $x }); say @squares[12]
camelia 169
moritz Petr37: ^^ there you go
m: my @squares = (0..*).map(-> $x { $x * $x }); say @squares[12] # if you want the index to align :D
camelia 144
moritz raku-musings.com/gather-take.html for some other examples 16:46
Petr37 Thank you 😊
lucs Speaking of squares, I've never noticed anyone observing the totally useless fact that the number of RFCs that were submitted for the Perl 6 design happens to be 19 squared, the number of intersections on a Go board. 16:47
JJMerelo He
lizmat :-) 16:48
codesections lucs: that raises the question of how well AlphaGo would have done at merging those RFCs 16:57
lucs codesections: Heh :) 17:03
[Coke] 151271 18:29
oh noes, my 2 factor code!
kawaii m: say "hello, world!"; 18:41
camelia hello, world!
kawaii Who is responsible for maintaining camelia? :)
kawaii Ah, found it, perl6/evalbot repo. 18:45
holyghost J,R,R Wall :-) 19:35
Xliff vrurg: You aroun? 19:56
vrurg Xliff: in a minute I'm all yours. :)
Xliff vrurg: vrurg.github.io/arfb-publication/0...ing-raku/. In section "Roast". Second sentence. "And it defines what Raku language is" seems to be better read as "And it defines what the Raku language is" 19:57
Xliff goes back to reading.
vrurg: Third paragraph. "and letting a compiler develoipers" → "and letting compiler developers" 19:58
Want me to take this to PM? 19:59
vrurg Xliff: event better as an issue at github.com/vrurg/vrurg.github.io/ if you don't mind. Thank you! 20:01
Xliff Ah! OK! 20:05
I will still needlessly poke you with unnecessary PMs so I can put it all in one massive issue. 20:06
Just coz I <3 this article.
vrurg Xliff: Thanks for it! I'm blush. :D 20:11
Xliff hehe
Petr37 Where i can find "type exceptions" info (X::IO for example) ? 20:18
sena_kun Petr37, docs.raku.org/type/X::IO <- like this? 20:22
lizmat Petr37: if you want the source, look at src/core.c/Exception.pm6 20:26
Petr37 Thanks 20:37
Petr37 Sorry for stupid question... How can i print unicode simbol? 20:46
lizmat m: say "🐓"
camelia 🐓
lizmat ?
Petr37 Yes
Like this 20:47
lizmat m: say "\c[ROOSTER]"
camelia 🐓
lizmat m: say "\c[BUTTERFLY]" 20:48
camelia 🦋
Petr37 Ok, thanks)) 20:49
lizmat m: say "BUTTERFLY".uniparse 20:50
camelia 🦋
lizmat m: dd "BUTTERFL".uniparse 20:51
camelia Failure.new(exception => X::Str::InvalidCharName.new(name => "BUTTERFL"), backtrace => Backtrace.new)
Petr37 Can you provide me any good article s about Unicode? 20:52
lizmat in the context of Raku, or generally ? 20:55
Petr37 Yes, Raku. Sorry for my questions))
lizmat docs.raku.org/language/unicode # Petr37 21:05
Petr37: if you feel something is missing there, please make a doc issue :-)
Petr37 Thanks so much 😊
lizmat yw 21:06
lucs I'm using urxvt in Linux, but a lot Unicode glyphs just show up as '�'. 21:08
What should I be doing to try to fix that?
lizmat update your support of unicode? 21:10
looks like it is a few versions behind ?
lucs Yeah, I guess, but I'm not sure where that happens exactly :/ 21:11
lucs I suppose it's a terminal font or something. 21:11
[Coke] I did a google search (dont use urxvt) and there were some very hopeful responses there. 21:12
lucs Oh, hmm...
So I'd need a different terminal emulator?
lucs will google 21:13
lucs [Coke]: "(dont use urxvt)": is that your personal recommendation or what google appears to suggest? 21:17
oddp_ Yeah, I gave in and ditched urxvt a while ago. Maintainer is sitting on so many patches for years now. The color patch especially.
lucs oddp_: What do you use?
oddp_ Fat terminal that's coming with my DE.
lucs DE?
oddp_ desktop environment. KDE + Konsole in my case. 21:18
lucs Oh, right.
rypervenche Even "st" has better support for unicode, and that's a very minimal terminal emulator. 21:25
[Coke] lucs: sorry, was too short: I don't use it, so I don't have anything personal to say about it, but I googled, ... 21:25
lucs Ah, I see, thanks :) 21:26
rypervenche: I'll check it out.
oddp_ Don't, unless you like to use tmux/screen along with it. It can't scroll back up. ;) 21:28
pilne ok, looks like rakubrew sucessfully installed on my desktop, i've got vim setup with raku hilighting, i'd say i'm off to a good start :D the repl will launch off the copy i have on a usb stick (so that's good too) 21:29
worst comes to worst i'll just have a very "honky rigged" setup on the usb stick
lucs oddp_: Yeah, I use tmux, so with a bit of luck, it should be good.
rypervenche lucs: Ahh, that was just an example. st is meant to be very minimal and you're supposed to edit the source code to edit its config file. Not for beginners. 21:37
lucs rypervenche: I'm not quite a beginner, but I'm pretty lazy :) 21:39
Freshly compiled, our /topic butterfly still shows up as '�'. 21:40
lucs I'll give urxvt googling another go (I unsuccessfully tried to fix this a few months back). 21:41
lucs is probably just using an improper font. 21:44
rypervenche Try installing Noto Emoji.
lucs Ah, okay.
lucs needs to figure out how to install this nice font, right after dinner! :) 21:46
pilne is there a list somewhere of the environment variables I need to set, and folders I would need to create for my USB install of raku? 21:59
(going to use a .bat file or similar to set them in a cmd window)
Petr37 What is dd in Raku? 22:03
oddp_ docs.raku.org/programs/01-debuggin...x-entry-dd 22:07
The docs page has a search bar at the top right for cases like this.
Just make sure to enable javascript.
rypervenche So I just realized that when I have variables at the top of my script, I don't need to add parameters for my subroutines for them... I guess that makes sense, since they're in the same scope. I've been stupidly adding parameters for them in my scripts >< 22:22
guifa2 rypervenche: heh. I had a similar revelation once when I was repeatedly passing variables down a chain of function calls 22:24
Then I had the epiphany of dynamic variables :-)
codesections it can be helpful to be explicit in all the variables a sub uses, though (or at least the functional programmers would have us believe…) 22:25
guifa2 codesections: yeah, I definitely think twice before opting to go the "proper" functional route, but clarity can be often gained from brevity (esp if passing lots of vals) 22:31
pilne if i'm "starting fresh" and using .raku and a #!raku line, should i be using a "use v6;" line these days? 23:22
codesections :pilne My understanding is that it's not necessary. At the least, I can say that, as someone who came to Raku recently, I've not used `use v6` and haven't run into any issues 23:25
m: sub f(@foo) { @foo.sum }; f(<a b c>) 23:27
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5a' (indicated by ⏏)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
codesections How do I put a type constraint on `f`, above, that requires it to take an Array of Ints? 23:28
I thought it would be `sub f([Int] @foo)` or `sub f(Array(Int) @foo)`, but neither of those work 23:30
m: sub f(Array(Int) @foo) { @foo.sum }; f([1, 2, 3]) 23:31
camelia Type check failed in binding to parameter '@foo'; expected Positional[Int] but got Array ($[1, 2, 3])
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
codesections That error message makes me think that's on the right track, but it also confuses me. Why does it expect a `Positional[Int]` when I just told it to expect an Array? 23:32
pilne codesections - ty , i wasn't expecting issues from not using it, i was just wondering if it was "good practice" (: 23:35
codesections Er, wait, `Array(Int)` probably *isn't* on the right track – that looks like it's using the `Coercion type` syntax – that is, saying I want an Int and want to coerce it to an Array. Which isn't what I want at all 23:35
holyghost I am going to drink something, started 3 C# projects for work 23:40
elcaro codesections: kind of like `sub f(Int @foo) { ... }`, however, your code will still fail when you call `f([1, 2, 3])` 23:52
because `[1, 2, 3]` is an `Array` not an `Array[Int]`. If you create `my Int @a = 1, 2, 3` and pass `@a` to `f` it will work 23:53
or you could call `f(Array[Int].new(1, 2, 3))`
codesections Aha, thanks! And, now that you explain it, that makes sense – `f(Int @foo)` requires an Array that can *only* hold `Int`s. And `[1, 2, 3]` isn't constrained to only hold Ints. It *happens* to only have Ints in it right now, but that's not part of its type. 23:58