🦋 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.
00:06 yuplushi left 00:10 yuplushi joined 00:12 Altai-man_ joined 00:14 sena_kun left 00:37 phogg joined, phogg left, phogg joined 00:58 _jrjsmrtn left 00:59 __jrjsmrtn__ joined
raku-bridge <stu002> What would be an idiomatic equivalent to a function with generic type parameters in Raku? Something like this (not legal Raku) sub compare(::T \x, ::T \y, --> Bool) {...} 01:18
<stu002> Maybe using Any arguments and testing the type of y is ~~ that of x? 01:19
01:28 aborazmeh joined, aborazmeh left, aborazmeh joined 01:38 aborazmeh left 01:39 aborazmeh joined, aborazmeh left, aborazmeh joined 01:40 BR_ joined 01:43 Black_Ribbon left 01:49 molaf left 01:53 gabiruh left, gabiruh joined 01:55 aborazmeh left
guifa stu002: I’m not sure that there’s a super idiomatic version 01:57
02:01 jnthn left
guifa Probably most natural would be 02:02
02:02 molaf joined
guifa m: sub compare(::T \x, ::U \y where * ~~ T) { “ok” }; say compare Numeric, Int; say compare Str, “foo”; say compare Int, 2.5 02:03
camelia ok
Constraint type check failed in binding to parameter 'y'; expected anonymous constraint to be met but got Rat (2.5)
in sub compare at <tmp> line 1
in block <unit> at <tmp> line 1

ok
guifa If you want a better error message you can do 02:04
02:05 Manifest0 left 02:06 Manifest0 joined 02:07 finsternis left, gnufr33dom joined
guifa stu002: this would be a much preferrably signature IMO 02:12
m: sub compare(::T \x, ::U \y where {U ~~ T || die "{y.^name} must smartmatch successfully against {x.^name} (that is, {y.^name} ~~ {x.^name})" }) { "ok" }; say compare 1, "a"
camelia Str must smartmatch successfully against Int (that is, Str ~~ Int)
in sub compare at <tmp> line 1
in block <unit> at <tmp> line 1
02:12 sena_kun joined 02:14 Altai-man_ left
raku-bridge <stu002> @guifa That's very interesting thanks. 02:26
guifa Note that it’s no guarantee whether, .e.g, you could coerce between them or even whether they’re compatible 02:28
Because you’ll grab class info generally, plus mixin. You’d have to do a bit more stuff to figure out if any of the types smart match against any of the other types (but it’s not that hard) 02:29
02:41 dataangel left 02:46 Xliff joined
raku-bridge <stu002> Would it be possible to have callables like subs "does" some kind of Role? Maybe a generic role could help constraint the types? 02:47
02:51 dataangel joined
guifa2 I mean, sure. A callable is just something that implements CALL-ME 03:00
m: my &a = (sub ($a) { $a + $a }) but 5; say 1 + &a 03:01
camelia Cannot resolve caller Numeric(Sub+{<anon|1>}:D: ); none of these signatures match:
(Mu:U \v: *%_)
in block <unit> at <tmp> line 1
guifa2 err
actually, I'm not sure why that didn't work lol 03:02
Xliff o/
guifa2 m: my &a = sub ($a) { $a } but False; my &b = sub ($b) { $b } but True; say so &a; say so &b; 03:03
camelia False
True
guifa2 \o 03:04
03:13 yuplushi left 03:16 zacts left 03:17 zacts joined 03:52 yuplushi joined 04:04 mst left 04:12 Altai-man_ joined 04:15 sena_kun left
Xliff Anyone still awake? 04:48
raku-bridge <stu002> Middle of the afternoon here 04:53
04:58 OpenZen left
Xliff \o stu 05:08
moon-child is it possible to pass a string as input to a proc? 05:14
(stdin, that is)
run 'cat', :in("hi\n") doesn't work
rockxloose :m say "3 hours after noon here."; 05:19
moon-child that's m: 05:20
rockxloose m: say "3 hours after noon here."; say "Thanks, moon-child."; 05:21
camelia 3 hours after noon here.
Thanks, moon-child.
05:23 bocaneri joined
guifa2 moon-child: it's not quite like that 05:43
Try this 05:44
Xliff moon-child: Did you look into Proc::Async? 05:45
docs.raku.org/type/Proc::Async
See the example involving 'hexdump'
moon-child yes. I used that for something else, but need sync for this 05:46
guifa2 my $cat = run 'cat', :in, :out; my $in-pipe = $cat.in; $in-pipe.say: "Hello World!"; $in-pipe.close; say $cat.out.slurp
evalable6 Hello World!
moon-child figured it out, though
Xliff Oh. What did you end up with?
guifa2 you could simplify it to
moon-child what guifa showed, though without an intermediate variable
guifa2 my $cat = run 'cat', :in, :out; $cat.in.say: "Hello World!"; $cat.in.close; say $cat.out.slurp
evalable6 Hello World!
guifa2 ha that's probably what they did 05:47
moon-child haha, yep
Xliff Ah.
How would that work with something like /bin/more?
moon-child probably not very well 05:48
well, actually more might be ok. Less probably won't, though
guifa2 you could probably read the output as you're still inputting it 05:49
you just wouldn't close off input before reading the output pipe. But I dunno, haven't tried it
does anyone remember how to do that ecosystem search thing where you could see if anyone's actually ended up using $obscure-feature ?
Xliff Um. Greppable? 05:50
Or wqas that Sourceable?
I can't remember and I know I just used one of those recently.
05:50 Util left
guifa2 I think I've finally managed to fully make DateTime timezone aware 05:51
Xliff guifa++
guifa2 Problem is it's slightly incompatible with the :timezone parameter (ironically)
Not sure if anyone has ever bothered to use it for anything other than a whole hour interval (maaaaybe a half hour for those weird zones)
Xliff m: sourceable6: run 'thiscommand', :in, :out 05:52
camelia The spawned command 'thiscommand' exited unsuccessfully (exit code: 1, signal: 0)
in block <unit> at <tmp> line 1
Xliff sourceable6: run 'thiscommand', :in, :out
sourceable6 Xliff, github.com/rakudo/rakudo/blob/d4ba...c.pm6#L241
Xliff guifa: You mean this ^^
guifa2 soueceable: :timezone 05:54
sourceable6 guifa2, No idea, boss. Can you give me a Code object?
guifa2 okay 1- smart
2- boo
Xliff guida: It might be better to use greppable for that.
guifa2 greppable6: :timezone
Xliff sourceable needs something it can run.
greppable6 guifa2, 75 lines, 20 modules: gist.github.com/ab4ba70f9970eeee6b...f3b85821df
guifa2 okay, not suuuuuper commonly used 05:56
and always on hour offset which is good.
06:09 Util joined
guifa2 is there a way to detect if another module is used and use it if and only if it's installed? 06:12
ah yeah 06:13
06:13 sena_kun joined
guifa2 try require ::('foo') 06:13
06:15 Altai-man_ left 06:16 Xliff left 06:26 moon-child left, moon-child joined 06:31 moon-child left 06:32 moon-child joined
guifa2 can I muck with the name of a mixed in creation? 06:33
06:34 Geth_ joined 06:40 Geth left
guifa2 Ah yes. $foo.^set_name 06:40
06:44 Geth joined 06:48 Geth left 06:51 rindolf joined 06:57 zacts left
SmokeMachine m: sub compare(::T \x, T \y) { “ok” }; say compare Numeric, Int; say compare Str, “foo”; say compare Int, 2.5 06:59
camelia ok
Type check failed in binding to parameter 'y'; expected Int but got Rat (2.5)
in sub compare at <tmp> line 1
in block <unit> at <tmp> line 1

ok
07:02 xelxebar left, xelxebar joined 07:27 dakkar joined
SmokeMachine stu002: ^^ 07:28
07:29 dolmen joined 07:33 squashable6 left
guifa2 SmokeMachine: he asked about smart matching. Works most of the time but it's possible someone overrides the ACCEPTS method to give a different result 07:34
you know, someone who likes to do evil stuff
guifa2 pretends to not be evil
07:35 squashable6 joined
SmokeMachine guifa2: yes, makes sense... :) 07:37
07:49 BR_ left 08:13 lichtkind joined 08:16 JJMerelo joined 08:22 lichtkind left
raku-bridge <stu002> SmokeMachine: thanks! 08:23
<stu002> I'm starting to realize the depth of type-level constructions that are possible in Raku 08:24
<stu002> Making types objects opens up all kinds of possibilities.
<stu002> SmokeMachine: is that technique called "type capture"? 08:31
SmokeMachine stu002: sorry, idk 08:37
08:40 kensanata joined 08:43 Sgeo left
MasterDuke stu002: i believe so 08:50
08:53 JJMerelo left 09:12 Altai-man_ joined 09:14 domidumont joined, sena_kun left 09:18 raku-bridge1 joined, raku-bridge left 09:19 raku-bridge joined 09:20 raku-bridge1 left 09:43 cpan-raku left 09:47 cpan-raku joined, cpan-raku left, cpan-raku joined 10:20 JJMerelo joined
JJMerelo .tell tobs it's perfect the time you've already scheduled it. I'll dive it to add categories, tags and some minor editing, if you don't mind. 10:21
tellable6 JJMerelo, I'll pass your message to tobs
tobs JJMerelo: please do 10:28
JJMerelo Done already. Very nice article. I like the way you trace it through the Apocalypsis and then talk about modern Unicode heuristics. Love it, really. 10:29
tellable6 2020-08-04T09:42:03Z #raku-dev <moritz> jjmerelo we seem to have two posts scheduled for tomorrow. Please decide and move one around :-)
2020-08-04T09:53:36Z #raku-dev <lizmat> jjmerelo fixed the scheduling
JJMerelo Thanks, lizmat, moritz 10:44
11:18 dolmen left 11:21 Noisytoot left 11:22 Noisytoot joined 11:40 JJMerelo left 12:13 sena_kun joined 12:14 Altai-man_ left
[Coke] got an article in my rss feed this morning, clicked through, it wasn't there. 12:20
(the OO one). might have been a reschedule.
12:28 mst joined 12:56 domidumont left 13:08 dogbert17 joined 13:39 demostanis joined
demostanis guifa2: Would I need to modify HTTP::UserAgent's code just to get a progress bar? 13:41
tellable6 2020-08-03T23:10:39Z #raku <guifa2> demostanis: I don't see anything in HTTP::UserAgent that would give a hook for that
14:02 squashable6 left 14:04 squashable6 joined 14:12 Altai-man_ joined 14:15 sena_kun left 14:25 Sgeo joined 14:28 patrickb joined 14:30 lucasb joined 14:39 patrickb left 14:52 patrickb joined 14:59 gnufr33dom left 15:00 JJMerelo joined 15:22 JJMerelo left 15:25 markoong joined, patrickb left 15:27 Kaiepi left, Kaiepi joined 15:32 MilkmanDan left 15:33 MilkmanDan joined
codesections How do you access the Pod declarator block for a parameter? 15:50
For example, consider this code (which needs to be multi-line and thus won't work with camilla) 15:51
guifa .WHY
tellable6 2020-08-04T08:17:48Z #raku-dev <JJMerelo> guifa can you upload your artlcle to the WP site as a draft? Let me schedule it when it's more convenient.
codesections #| Performs the `foo` opperation
sub foo(
$thing #= The thing to `foo`
) {} 15:52
&foo.WHY gives me the main declartor block ('Performs the `foo` opperation')
but I'm trying to access the one for the parameter ('The thing to `foo`')
$thing.WHY returns nil from inside the sub 15:53
guifa say &foo.signature.params[0].WHY
codesections aha, thanks
guifa One of my next next next projects is to use the declarator blocks to create a reference website 15:54
but I wanna get the polish on DateTime first
codesections very cool. I'd be interested in helping out with that, when you get there :) 15:56
guifa I think the only major thing I have left with DateTime now besides massive testing is figuring out how to automate generating the TZif files. I’m cheating right now and stealing them from my macOS install hahaha 16:01
16:25 skids joined 16:26 MilkmanDan left 16:30 MilkmanDan joined
tbrowder hi, question on constraining args in a sub's signature. i would like to have the first arg be constrained to one of multiple types. i know i can do that with multis but would like to do something like: sub f($arg where { $_ ~~ Str or $_ ~~ List). 16:35
thoughts?
*List}) 16:36
Altai-man_ m: sub a($foo where Str|List) {} 16:37
camelia ( no output )
Altai-man_ m: sub a($foo where Str|List) { say $foo }; a('foo'); a(<a b c>) 16:38
camelia foo
(a b c)
Altai-man_ m: sub a($foo where Str|List) { say $foo }; a('foo'); a(<a b c>); a(42)
camelia foo
Constraint type check failed in binding to parameter '$foo'; expected anonymous constraint to be met but got Int (42)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1

(a b c)
Altai-man_ tbrowder, ^
tbrowder Altai-man_: THANK YOU i tried all combos i could think of. i could not find a good example in the docs (i'll file an issue). 16:40
Altai-man_ Rules are the same everywhere, e.g. `subset Foo where Int` or `given 42 { when Int {} }`, not even sure where this can be documented. 16:45
[Coke] probably worth a mention in docs.raku.org/type/Signature#Type_constraints
the subset constraint is already there. 16:46
Geth_ ¦ doc: tbrowder self-assigned Need example and words on constraint of an arg in a sub parameter to one of multiple types github.com/Raku/doc/issues/3548 16:49
tbrowder [Coke]: yes, that seems the best to me. there are voluminous but complex examples, and "simple" uses seem to get lost in the crowd. 16:55
16:56 molaf left
guifa2 You can also make a subset if you want to use a simpler signature 16:57
16:59 dakkar left
guifa2 subset StrOrList where Str|List; sub foo(StrOrList $bar) { … } 16:59
codesections Or, if you want to be more verbose, I guess you could do `subset StrOrList of Cool where Str|List`, right? 17:05
guifa2 I mean sure lol. Or of anything else they have in common (I think the default is of Any, but it might be of Mu, I forget) 17:07
Also nice. My DateTime hacking just under doubles the creation time. Given I literally create an intermediate DateTime, that's not bad at all. 17:09
codesections er, I guess I sounded odd saying "If you want to be more verbose". I was really thinking that the bare `subset` without the `of …` strikes me as semantically odd – it's nominally a subset, but here we're using it to create something that reads more like a *superset*
17:10 Xliff joined
codesections adding `of Any` (/cool/mu/whatever) clarifies that it *is* a subset 17:10
Xliff \o
codesections o/
Xliff Is there anyone familiar with the NativeCall guts who could take a look at R#3840 17:11
linkable6 R#3840 [open]: github.com/rakudo/rakudo/issues/3840 NativeCall Results not Consistent With C-Equivalent Code
17:11 domidumont joined
guifa2 codesections: That's very fair. Admittedly, I think I've used them more as supersets than as subsets in the past ha 17:11
codesections :D 17:12
17:13 sena_kun joined
tbrowder guifa2: thnx for hint on trailing decl pod with the sub.signature method. i've only recently looked a non-nqp source to assemble the trailing decl blocks completely, and i haven't looked or thought of that. 17:13
blinders off! 17:14
guifa2 tbrowder: no problem. As jnthn++ pointed out, Comma now can display that stuff as you're editing which is kind of cool
I'd *really* like it if we could attach the blocks to any random variable though 17:15
17:15 Altai-man_ left
guifa2 When porting the old C code for timezones, I kept going back and forth between making readable/logical names and maintaining consistency with the C code 17:15
codesections guifa2: me too. I opened an issue for it a couple of weeks ago, actually github.com/rakudo/rakudo/issues/3804 17:17
guifa2 because lets face it, anyone in the Raku world would read "tmp" as "temp(orary)". Not "time pointer". If I could say "my $tmp; #= Reference to Time object" and have that appear as a tooltip anywhere the variable were used, it would make code so much cleaner
codesections I'm pretty sure we *should* be able to write that, under S26 (though there isn't a Roast test for it) 17:18
17:19 patrickb joined
guifa2 codesections: agreed. POD hasn't had the same level of attention paid as the main Raku code (understandably so) although it's getting better 17:20
17:21 phogg left
guifa2 I think that over the past few months there's been a critical mass of us interested in improving it ithat it'll happen. There's definitely a positive feedback loop too. As it gets better, more people will use it. jnthn mentioned the other day that he really only started using declarator blocks once support was added to Comma. If more people use them because of that support, it'll shift even more attention into how they work 17:22
codesections Yeah definitely understandable. But Raku's introspection + self-documentation is *really* cool, so I'm optimistic 17:23
guifa2 I know tbrowder and shimmeringfairy are looking into and working on them
codesections guifa2: yeah agreed re: more people using declarator blocks because of Comma. I have a long-term plan/hope of adding better support for viewing that info in Emacs, which might give another small boost 17:24
(depending on how many people write Raku in Emacs, of course :) )
somewhat relatedly: the first of these works to set the `trailing` declarator block, but the second doesn't: 17:27
#| Leading doc
sub foo($thing) {}
#| Trailing doc
#| Leading doc
sub foo(
$thing
) {}
#| Trailing doc
is that worth opening an issue for?
guifa2 Trailing should be #=
codesections er, right
sorry, that's what I meant. 17:28
But the point stands that the multi-line parameter block breaks the trailing
guifa2 I actually don't like the first one tbh 17:29
sub foo($think) {} #= blabla
to me that's ambiguous
But if I had to tie break, I'd assign #= to $think, not to foo
sub foo($thing) {} [newline] #= blabla shoud be equivalent, with the same issue 17:30
codesections well, but that's with an empty body for foo. If `foo` has multiple lines, the `#=` after the `}` for foo seems pretty clear 17:31
imo
Also, the behavior you don't like *does* have a Roast test: github.com/Raku/roast/blob/fea1d16....t#L46-L55 17:33
guifa2 boo 17:34
17:36 xelxebar left 17:37 xelxebar joined
codesections Oh! I didn't read that Roast test all the way to the bottom. Now I see «skip 'declaration comments are NYI on variables', 7;» 17:37
So that's proof that it *is* supposed to be implemented, just Not Yet™ 17:38
17:42 raku-bridge left, raku-bridge joined, raku-bridge left, raku-bridge joined 17:46 cpan-raku left
guifa2 Ah perfect, I'd add that as a comment on the rakudo issue 17:49
SmokeMachine m: say 17:53
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 3say7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $_, or u…
SmokeMachine m: say "bla"
camelia bla
SmokeMachine m: #| Performs the `foo` opperation␤ sub foo(␤ $thing #= The thing to `foo`␤) {}␤say &foo.WHY 17:54
camelia Performs the `foo` opperation
SmokeMachine m: #| Performs the `foo` opperation␤ sub foo(␤ $thing #= The thing to `foo`␤) {}␤say &foo.WHY; say &foo.signature.params.head.WHY 17:56
camelia Performs the `foo` opperation
The thing to `foo`
SmokeMachine codesections: ^^
codesections SmokeMachine: Hm? is that an answer to the question I asked ~2 hours ago? If so, thanks :) (though guifa already provided a similar solution with `&foo.signature.params[0].WHY`) 18:00
If that's re: something more recent, I'm confused
SmokeMachine it was for the 2hours ago one, sorry, and it also shows how to run multiline code on camelia 18:02
codesections Aha, with you now – thanks!
SmokeMachine (I haven't seen guifa2 answer, sorry) 18:03
s/haven't/hadn't/
18:03 domidumont left
codesections np, good to get confirmation – apparently, great minds think alike :D 18:03
m: my $a = 42;␤ say $a; 18:06
camelia 42
codesections And *that's* good to know :) 18:07
m: my $a = 42; 18:09
camelia ( no output )
codesections hmm, I would have expected ^J to input a ␤. SmokeMachine, did you input ␤ as unicode U2424, or is there an easier way for when using Camelia? 18:12
moritz camelia turns newlines in the output into ␤ and vice versa in its input 18:13
SmokeMachine codesections: I usually copy it and past when needed
*paste
codesections moritz: Hmm, interesting. I guess I have a WeeChat issue then – when I paste text with a newline, I send multiple messages 18:14
not one with internal newlines
I should get around to switching to ERC – then the ways I enter unicode when coding would work fine here 18:15
or add more entries to my Compose list, I guess 18:16
tobs that's what I do
codesections Which one?
moritz I don't think IRC as a protocol supports messages with embedded newlines
codesections haha, that may be the case. So I guess I *do* need a way to enter ␤ 18:17
tobs codesections: add things to my compose list. I never even started getting used to ^V unicode input in vim and the compose key works in many places. 18:18
18:23 bocaneri left
codesections Yeah, that's what I should do. tobs, you don't happen to have made your compose file somewhere public/feel like sharing it, do you? 18:28
18:32 [Sno] joined
demostanis Why can't signal() take a Junction? signal(SIGINT|SIGHUP) won't work, I must use signal(SIGINT).merge: signal(SIGHUP) 18:33
18:33 sno left
tobs codesections: I haven't but 98% of it are from github.com/kragen/xcompose/blob/ma...otXCompose :) 18:33
codesections tobs ­ thanks :) 18:34
demostanis Nevermind, that was a dumb question, I can use an array 18:38
guifa2 new module (still super early tho) 18:39
weekly: github.com/alabamenhu/DateTimeTimezones
notable6 guifa2, Noted! (weekly)
guifa2 lizmat: I'll get it added to ecosystem by the end of the week I promise haha
lizmat ++guifa2 18:41
18:41 Black_Ribbon joined 18:44 manj-gnome_ joined
guifa2 Is there a way to specify a minimum version for module loading? 18:44
18:44 manj-gnome_ left
codesections (demostanis: I know you found a solution, and this is probably something you already know, but just to answer the "why" part of the question for my own benefit: because `signal` is a sub (or, rather, a multi) and its signature doesn't accept a Junction 18:45
m: say &signal.candidates.map({.signature}) 18:46
camelia ((*@signals, :$scheduler = Code.new))
SmokeMachine codesections: but than it should run twice in parallel...
codesections good point … 18:47
hmm
SmokeMachine m: sub bla(Int $a) { say "[$a]" }; bla 1|2|3|4
camelia [1]
[2]
[3]
[4]
SmokeMachine and return a new junction 18:48
m: sub bla(Int $a) { say "[$a]" }; say bla 1|2|3|4
camelia [1]
[2]
[3]
[4]
any(True, True, True, True)
guifa2 Junctions are strange beasts ha
tobs that is what happens, but running it twice and getting the supplies back into a junction is not useful for signal() 18:49
codesections aha, so it would normally work, but in this case would "work" by returning something useless. So the src has this line: 18:51
tobs signal registers a signal handler, it can't make use of this superposition gibberish that "may be SIGINT or SIGHUP or anything in between at any time"
codesections if @signals.grep( { !nqp::istype($_,Signal) } ) -> @invalid { |, Found invalid signals: SIGHUP
die "Found invalid signals: @invalid.join(', ')" | in block <unit> at <unknown file> line 1
}
tobs since you can't get the components out of a junction in Raku, array is the correct concept for passing multiple signals to catch 18:52
codesections Ok, thanks, I understand much better now. (Great example of Cunningham's Law in action!) 18:55
demostanis Isn't this module very very very vulnerable? modules.raku.org/dist/Sparrowdo::R...teFile.pm6 18:56
tasks(location => "; echo "vulnerable" #") 18:57
s/"vulnerable"/'vulnerable'/
If a program takes user input and passes it as location's value 19:05
tbrowder another question about our Remarkable Raku language: could one somehow use a Capture to define alias names for a subroutine instead of repeating multi subs with? 19:09
19:12 Zero_Dogg left, Altai-man_ joined
tobs m: multi sub f (Int $x) { "inty" }; multi sub f (Str $x) { "stringy" }; multi sub g (|c) { f |c }; say g(10); say g("x") # tbrowder: like this? 19:13
camelia inty
stringy
tobs in that case you can also just `my &g = &f` and you get all of &f's candidates in &g. 19:14
(g is the alias for f)
19:14 sena_kun left
codesections m: sub f() {say 'f ran' }; my &g = &f; g 19:16
camelia f ran
codesections I'm kind of surprised that works :) 19:17
lizmat m: my &a; a
camelia Cannot invoke this object (REPR: Uninstantiable; Callable)
in block <unit> at <tmp> line 1
tbrowder no, i would like equiv of: sub f($a), sub g($a), ..., sub z($a) where they all have the same parameter signature and can ba called by different names. looks like that's what you are demoing. 19:18
lizmat foo is just syntactic sugar for &foo() :-)
tbrowder will it work as exported names in a module...i assume ot will.
it
tobs uhh, so same signature but different implementations? No idea about that. 19:19
anyway, gotta go
tbrowder no, same implementation. 19:20
i think you just showed it!
uh, codesections showed it! 19:21
codesections m: my &f = my &h = sub f() {say 'called f'}
camelia 5===SORRY!5=== Error while compiling <tmp>
Redeclaration of routine 'f'. Did you mean to declare a multi-sub?
at <tmp>:1
------> 3my &f = my &h = sub f() {say 'called f'}7⏏5<EOL>
codesections m: my &g = my &h = sub f() {say 'called f'} 19:22
camelia ( no output )
codesections (a more concise version)
19:23 |Sno| joined
tbrowder m: my sub a($a) {say "called $a"}; my &b = a; b('a'); 19:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling a() will never work with declared signature ($a)
at <tmp>:1
------> 3my sub a($a) {say "called $a"}; my &b = 7⏏5a; b('a');
19:25 sena_kun joined
codesections m: my sub a($a) {say "called $a"}; my &b = &a; b('a'); 19:25
camelia called a
19:25 [Sno] left
tbrowder |o| three point field goal, yaaay 19:26
19:26 Altai-man_ left
tbrowder way to go, codesections and other helpers 19:27
codesections I was just implementing what tobs++ said – I had no idea that'd work before they said it! 19:28
but I'm probably going to use it some now :D
tbrowder well it works in a module, too! 19:35
19:36 Xliff left
tbrowder i did this first in the module: our &alias is export = &defined-sub; 19:37
then defined the sub: sub defined-sub($arg1, :$arg2) {} 19:38
then in a test file used each name and got same result--that is exciting...be still my heart! 19:39
Raku is Really Regal 19:40
codesections :D
tbrowder or as teenagers might say: Raku is Really Radical or, in some other time, Raku is Really Righteous 19:42
* [shrug, "whatever"] 19:44
back to serious -Ofun
codesections I hate to break it to you, tbrowder, but I'm pretty sure those *both* qualify for the "in some other time" label :D
19:45 phogg joined, phogg left, phogg joined
tbrowder been there, but not as hip 19:45
uh, maybe earlier ;-) 19:46
19:47 Sgeo left 19:49 MilkmanDan left
tony-o just as an fyi, the ecosystem grant proposal has been updated: news.perlfoundation.org/post/grant..._ecosystem 19:50
19:55 MilkmanDan joined 19:59 Sgeo joined
moritz tony-o++ 20:08
20:15 rindolf left 20:21 phogg left 20:31 phogg joined, phogg left, phogg joined
tony-o hope that clears a bit up for moritz - if it doesn't i'd be happy to respond more to your comments on the grant 20:32
demostanis No comment about what I've said for modules.raku.org/dist/Sparrowdo::R...teFile.pm6 ? 20:42
tobs my comment is you're probably right, but it depends on who the attacker is. I don't know Sparrow6 or what it does, so maybe loading code from a config file isn't critical. 20:50
demostanis I will try to provide an example
tobs it certainly could use some argument quoting
20:50 kensanata left
codesections Yeah, I also don't know Sparrow6. From a quick look, it looked less like a vulnerability and more like a deliberately non-secure design 20:51
(it looked like the idea was to execute code from a remote file, which is inherently non-secure unless you *really* trust that file)
demostanis It doesn't execute it, it only downloads it? 20:52
codesections but, again, I don't have the context to know. Which is why I didn't say anything
Geth_ advent: 11e634f73d | p6steve++ (committed using GitHub Web editor) | 20th/articles/rfc54
Create rfc54
codesections Oh
demostanis I am getting an example wait wait wait
codesections Will do :) 20:53
Geth_ advent: f2de77b614 | p6steve++ (committed using GitHub Web editor) | 2 files
Update and rename rfc54 to rfc54.md
20:54
advent: b7bd99d55d | p6steve++ (committed using GitHub Web editor) | 20th/README.md
adding rfc54.md
20:56
moritz tony-o: I think you answered most questions. I still want to know which faults the new thingy will tolerate, and how 21:05
demostanis Nevermind, I was unable to reproduce a working example, the code sucks 21:15
In a docker container as root, sparrowdo tried to run sudo... 21:16
But I believe it's dangerous 21:17
21:24 Altai-man_ joined 21:26 sena_kun left
demostanis I've found an example, but with Sparrowdo (something RemoteFile is made for, by the same author) 21:32
sparrowdo --ssh_user="; echo Proof #"
Will echo "Proof"
Now what if a program takes user's input to spawn a sparrowdo process 21:33
my $input = $*IN.slurp;
run("sparrowdo", "--ssh_user", $input); 21:34
21:34 lcfc2016 joined
demostanis We run this script and pipe "; echo Proof #" to it 21:34
Boom.
RemoteFile might have the same issue 21:35
codesections I guess I'm still not sure I follow the usecase for Sparrowdo. I thought it was intended for local configuration management, and thus has fairly privileged access to the system. In your example, it seems like the vulnerability is exposing a local config-management tool to user input 21:36
Or am I confused about Sparowdo's usecase?
m: run <echo Proof> # this also works, but it doesn't mean Raku has a vulnerability 21:37
camelia Proof
21:38 lcfc2016 left 21:39 Kaeipi joined, Kaiepi left
demostanis There may have some cases where it needs to take user input, even if it most of the time isn't the case. That's still something that shouldn't happen, and which should be fixed 21:40
codesections No argument from me. But it might also be worth adding a note to the README that it's not intended to be exposed publicly – it seems like it's hard to back-port that type of security in, if a system wasn't built with the idea of handling untrusted user input from the start 21:42
(not a bad idea to try, just hard/easy to miss things)
but just my ¢2 21:43
raku-bridge <stu002> I'm looking for examples of "subset" type restrictions on function signatures. This is so I restrict the types of callback functions used, e.g. sub does-callback(%[named type here]:cb) 21:52
<stu002> That's not valid Raku though.
tobs @stu002 that question was recently asked on the mailing list, too 21:57
MasterDuke m: subset Five of Int where 5; sub a(Five $a) { say "$a better == 5" }; a(5); a(4);
camelia 5 better == 5
Constraint type check failed in binding to parameter '$a'; expected Five but got Int (4)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
MasterDuke like that?
tobs www.nntp.perl.org/group/perl.perl6...g8963.html 21:58
21:58 linkable6 left
tobs MasterDuke: I think this is about a subset constraining the signature of an argument to a function that is itself a callable 21:58
a callbackable
21:58 nicholatian left
MasterDuke ah, a little more complicated 21:59
but i thought the docs had some examples of exactly that
tobs They have using signature literals. That question on the mailing list was about putting a name on a signature and using that name instead of the signature literal in constraints. I imagine stu is after the same. 22:01
and the &callback:(Int --> Int) syntax does not work anymore when the signature is not a literal.
22:02 nicholatian joined 22:06 bisectable6 left, bisectable6 joined 22:10 bisectable6 left
raku-bridge <stu002> MasterDuke:, tobs: that's very useful thanks. 22:12
22:12 aluaces left
raku-bridge <stu002> Having the named constraints helps with making intent clearer. 22:13
rypervenche Is there a way to run a for loop that doesn't set $_? Something like how this Perl code does it: tio.run/#%23K0gtyjH9/18l3lY9pLCiIl...SZPqfb/fwA 22:38
demostanis .quit 22:42
Shit
22:42 demostanis left, linkable6 joined
MasterDuke m: for ^3 -> $i { say $i; say $_ } # rypervenche like this? 22:46
camelia 0
(Any)
1
(Any)
2
(Any)
tbrowder tobs: a Capture might be a solution...
rypervenche Ah yeah, I guess I would have to assign it to a variable. Thanks. 22:47
22:47 leont left 22:55 linkable6 left, squashable6 left, vike left, nativecallable6 left, notable6 left, greppable6 left, coverable6 left, tellable6 left, shareable6 left, benchable6 left, evalable6 left, releasable6 left, sourceable6 left, guifa2 left, a3r0 left,