»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by moritz on 25 December 2014.
colomon oh, making automatic proxies. yes, that sounds like MOP 00:00
psch where "stuck" means "not sure if that's the best way to solve it, but the only way i can think of"
(and "make" means "has the following observation attached" ...) 00:01
err, *"means" means
i'm getting tired i think :)
00:02 jack_rabbit left
mickcy_ca kjs: mortiz sleeping 00:05
00:06 aborazmeh joined 00:09 virtualsue left
mickcy_ca psch: if you don't know if your tired ... who else could? 00:17
00:21 tinyblak left
psch mickcy_ca: i'm not sure i quite follow 00:21
00:22 tinyblak joined
mickcy_ca You must be really tired then. 00:22
;)
00:26 tinyblak left
psch well, g'night o/ 00:33
00:35 Mso150_j_i joined, Mso150_j left 00:37 kjs_ left, psch left 00:40 spider-mario left
raydiak wonders about the semantic differences between 'is pure' and 'is cached' 01:12
naively, it seems like they may ultimately be implying the same set of restrictions, or close to it 01:23
.oO( all these humans and their sleeping...such a tragic necessity )
01:28
timotimo o/ 01:56
anything exciting happen while i was away?
raydiak yes! 01:57
github.com/masak/007 masak.github.io/007/
timotimo cute, i like 02:01
02:20 rmgk is now known as Guest69048, rmgk_ joined, Guest69048 left, rmgk_ is now known as rmgk 02:22 mickcy_ca left 02:56 Ven left 03:03 Mso150_j_i_h joined 03:06 Mso150_j_i left 03:10 aborazmeh left 03:12 gfldex left 03:13 aborazmeh joined 03:36 telex left 03:38 telex joined 03:42 xinming left 03:43 xinming joined 03:47 noganex joined 03:49 noganex_ left 04:01 aborazmeh left 04:07 aborazmeh joined 04:13 dj_goku_ left 04:16 mickcy_ca joined 04:19 gfldex joined
mickcy_ca Another grammar question ... aside from the $/<> nomenclature for accessing the results, is there any other way to get to them, perhaps as a hash? 04:21
04:21 dj_goku joined
mickcy_ca For instance, I see a LOT online about how to make them ... but I have not seen an easy way to access the results. 04:22
04:28 Mso150_j_i_h left 04:32 Mso150_j_i_h joined 04:33 Mso150_j_i_h left
Timbus mickcy_ca, uh. that is accessing them as a hash.. 04:35
mickcy_ca Timbus: ... just figured that one out ... 04:36
04:37 adu joined
mickcy_ca Is there a hash dumper for P6 that does something like Data::Dumper for P5? 04:41
04:43 jack_rabbit joined
skids .perl and .gist builtins. 04:43
mickcy_ca Now, my problem is accessing anything but the first two levels of my match object. My gist is at pastebin.com/WnqHTPvV and gives the basic framework for my problem. Accessing the parameter list, for instance, in a way that I can use it has proven to be a problem for me. 04:52
Timbus there was a rly good advent post about building objects from parse trees 04:54
no it was a.. presentation or something. hm 04:56
mickcy_ca OK ... I was wondering about that because I have been avidly reading the advent posts and didn't notice one on that particular topic.
Timbus www.jnthn.net/papers/2014-fosdem-perl6-today.pdf 04:57
here ya go
mickcy_ca Thanks ... will go through it.
04:57 jack_rabbit left
Timbus its pretty pertinent to what you're doing, youll probably have a eureka or two at the Actions class bit. but try to read it all (its not too long) 04:58
mickcy_ca Maybe not what I'm doing ... but what I'm attempting.
05:05 jack_rabbit joined
mickcy_ca Timbus: Great read, lots of good information. Is it true that MoarVM still does not integrate the concurrency capabilities of Rakudo, and that the only option for concurrency is running on the JVM? 05:17
Timbus no
but the jvm is more stable for sure
mickcy_ca OK.
Timbus light, simple use of threads generally doesnt cause a crash. 05:18
mickcy_ca That is good to know ... I will probably be using some of those features if this project actually gets off the ground. 05:20
05:28 jack_rabbit left 05:36 mr-foobar left 05:37 jack_rabbit joined
mickcy_ca Timbus: do you know what the *% means in that pdf link you sent to me ... the line is 05:45
submethod BUILD(:%info (:Name($!name), :Country($!country), *%), :@!data)
Where :@ is : @ 05:46
Timbus slurpy parameter with no name
to catch everything, i guess? 05:47
m: sub foo(*%) { 42 }; say foo(a => 'b')
+camelia rakudo-moar ce1e74: OUTPUT«42␤»
mickcy_ca I figured that the array was for that ...
05:47 aborazmeh left
mickcy_ca I guess that was all it takes to compute the answer the life, the universe, and everything. 05:48
Timbus from what i can see, :@data is just a named parameter 05:49
mickcy_ca All it does is store the temperature information. 05:50
Timbus :%info (:Name($!name), :Country($!country), *%) is unpacking the args into the %info hash
mickcy_ca That I understood ... what I don't understand is why a slurpy unamed parameter would need to be used in this case. 05:51
As it appears that anything it got is thrown out anyway. 05:52
Timbus m: sub foo(%thing ( *% )){ say %thing.perl }; foo({foo => 'bar', asdf => 'fdsa'}); 05:54
+camelia rakudo-moar ce1e74: OUTPUT«("asdf" => "fdsa", "foo" => "bar").hash␤»
Timbus hes keepin it by letting it pass through 05:55
raydiak it makes the dispatch not fail when there are other named args passed to bless, like for instance inherited attributes
mickcy_ca Ah.
Timbus raydiak, that would be if the slurpy was outside of the unpack 05:58
raydiak Timbus: aren't we talking about the submethod BUILD in the pdf still? I just went ^F*% and looked at the first result :) 05:59
sorry if I jumped in confused 06:00
Timbus well, yeah. but the *% isnt in the param list, its in ( :%info ( *% ) ) 06:01
raydiak oh! m)
I see it, my bad
so it makes dispatch not fail if there are other entries in the hash 06:02
Timbus yeah
sub-signature! thats the word for it. the sub-signature would fail if info had extra keys 06:03
m: sub foo(:%info (:Name($a), :Country($b)) { say %info }; foo(info => {asdf => 1, Name => 'wot'}) 06:05
+camelia rakudo-moar ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/J0WXWiJFPP␤Missing block␤at /tmp/J0WXWiJFPP:1␤------> ub foo(:%info (:Name($a), :Country($b)) ⏏{ say %info }; foo(info => {asdf => 1, N␤»
Timbus m: sub foo(:%info (:Name($a), :Country($b))) { say %info }; foo(info => {asdf => 1, Name => 'wot'})
+camelia rakudo-moar ce1e74: OUTPUT«Unexpected named parameter 'asdf' passed in sub-signature of parameter %info␤ in sub foo at /tmp/PA5r2HIT2b:1␤ in block <unit> at /tmp/PA5r2HIT2b:1␤␤»
Timbus that
m: sub foo(:%info (:Name($a), :Country($b), *%)) { say %info }; foo(info => {asdf => 1, Name => 'wot'})
+camelia rakudo-moar ce1e74: OUTPUT«"Name" => "wot", "asdf" => 1␤»
Timbus should cover it 06:06
and possibly just as important to note is $a and $b will be available in the sub 06:07
06:09 [Sno] joined
raydiak oh right there is a *% implicitly added to your BUILD, that's what I was thinking of 06:11
m: class{ ( submethod BUILD () {} ).signature.say } 06:12
+camelia rakudo-moar ce1e74: OUTPUT«:(<anon>: *%_)␤»
skids r: use Pod::To::Text; class MyPod does Pod::To::Text { } # any guesses as to why it is not composable? 06:13
+camelia rakudo-{parrot,moar} ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Pod::To::Text is not composable, so MyPod cannot compose it␤at /tmp/tmpfile:1␤------> ␤»
raydiak is it a class instead of a role? 06:14
skids yes.
doh.
raydiak I knew we could use roles as classes...didn't know we could go the other way
skids no you're right. 06:15
I'm just so used to using roles.
raydiak I've been wanting to use them more, I hear they make things much cleaner in a lot of ways 06:16
mickcy_ca Timbus: I saw $a and $b once and noted their importance ... but have since lost the reference. Can you elucidate me on why they are so important? 06:17
Timbus no, not the names of them 06:18
raydiak afk
skids raydiak: Well, yes mostly. Except when you need to reference them without referring to a pun class. Which I haven't figured out how to do in some cases.
Timbus its that the function has declared $a and $b as parameters along with %info
mickcy_ca Ah. 06:19
Timbus m: sub foo(:%info (:Name($z), :Country($x), *%)) { say $z }; foo(info => {asdf => 1, Name => 'wot'})
+camelia rakudo-moar ce1e74: OUTPUT«wot␤»
mickcy_ca Didn't notice that .... 06:20
Timbus this is how BUILD is initializing the class attributes 'automatically'
mickcy_ca OK ... I am curious why one would a hash ... would the same results of implicit assignment be achieved with only an ordered list of parameters? 06:22
That is aside from nice notation on the call to new. 06:23
Timbus the hash is because we're passing two hashes in the fist place and need a way to separate them 06:24
mickcy_ca Ok.
Timbus in a simpler case you can (and do) use submethod BUILD(:$!attrib){}
this way merely pulls an attribute out of a hash that was passed, for convenience 06:27
mickcy_ca Looking for information on the make keyword.
Found it ... very sparse but if anyone has a more verbose explanation than doc.perl6.org/routine/make I would like to see it. 06:30
Timbus thats basically all I know of it 06:31
make creates the data you later pull out with .ast
skids In other words it just sets the .ast member of the Match object, which is your scratchpad. 06:32
mickcy_ca With .ast, are we mucking around with internal structures?
Timbus basically turning your named match into node of data
mickcy_ca Thank you. Very nice way to put it.
skids You have to build up the .ast tree as you see fit -- the individual .ast elements are not linked to each other unless you do it. Which is why you see stuff like make $/<octet>>>.ast in action methods a lot. So you get to regraft the tree to remove uneeded nodes. 06:38
mickcy_ca Alchohol and programming don't go well together. 06:47
skids mickcy_ca: xkcd.com/323/ 06:49
mickcy_ca LOLOLOLOLOLOL 06:50
06:50 rindolf joined
mickcy_ca Good night #perl6 06:53
skids o/
06:54 mickcy_ca left
skids Well, I guess Pod::To::* stand currently as examples of how bunches of subs in a package don't lend themselves to tweaking. 07:03
07:03 jack_rabbit left 07:09 gfldex left
raydiak yeah istr ::to::html feeling kinda crufty 07:10
skids I want to use the new .WHY stuff but having newlines in signatures makes Text not look very manpageish. 07:15
The DOC INIT stuff seems to actually work, though, so that's good. 07:17
raydiak where should I be reading to catch up to the new stuff you're talking about? :) 07:20
skids Specwise it's not new, just a lot of S26 was implemented. 07:21
raydiak isn't sure where to read news like that w/o p6weekly 07:23
skids r: #| The sub does foobar␤sub f { }; &f.WHY.say 07:24
+camelia rakudo-{parrot,moar} ce1e74: OUTPUT«The sub does foobar␤»
skids Yeah I just saw the IRC chat when it was being worked on. 07:25
raydiak oh I saw someone use that a few days ago...yeah that's gonna be neat stuff to use
I see what you meant...if you want to document each argument, you can't really read the signature as a whole very easily 07:32
s/argument/parameter/ 07:33
skids Not sure parameters are things that can have a WHY. 07:37
raydiak was reading advent day 10, says you can now document arguments and attributes too 07:38
oh right, so the word parameter...was wrong 07:41
or maybe not, I was thinking of S06 where it says "In Perl 6 culture, we distinguish the terms parameter and argument; a parameter is the formal name that will attach to an incoming argument during the course of execution, while an argument is the actual value that will be bound to the formal parameter." 07:43
skids Right.
raydiak so an argument would be the value you pass in 07:44
if I read it right
skids signatures have parameters, invocations (capture I guess) have arguments
raydiak we're not talking about putting documentation inside the signature on each parameter?
skids No, just that To::Text puts newlines in there. Which I guess makes sense when you have really long signatures but mostly makes a mess visually. 07:45
07:45 xfix joined
raydiak ah the output from the module...got it 07:46
skids It's kind of something that needs hand editing. You may not want to doc each multi, for example. So there will always be chafe between automation and what reads right. Or layout versus emantic markup for that matter. 07:47
e.g. it's easier to say "sub foo($a)/nThis does foobar, $a can be Int|Str" rather than have two WHYs for multi sub foo(Int$a) and multi sub foo(Str $a) 07:49
xfix Isn't Int|Str pretty much Cool type?
raydiak yeah it'll always just have to make a dumb guess one way or the other 07:50
skids xfix: maybe not the best example.
xfix (although, I guess that Int|Str only applies to Int, not other numeric types) 07:51
skids So maybe better than everyone writing DOC INIT sections to clean those up an override for user-visible POD signature might be in order. 07:53
Or just a way to tell POD not to try to render the attached object, just render the WHY.
Anyway, I'm up way too late. 07:55
raydiak g'night skids 07:57
skids o/
08:08 virtualsue joined 08:09 xinming left 08:10 xinming joined 08:16 darutoko joined
Timbus so i think i need to split 'bind' and 'listen' apart in moarvm. or perhaps allow a bind address to be passed to listen / connect 08:31
moritz \o 08:34
08:35 tinyblak joined, virtualsue left 08:36 tinyblak left, makapa joined, tinyblak joined, avalenn joined 08:39 makapa left, rindolf left
raydiak o/ moritz 08:45
08:46 tinyblak_ joined 08:50 tinyblak left 08:52 kaare_ joined 08:58 BenGoldberg left 08:59 virtualsue joined 09:01 denis_boyun_ joined 09:04 denis_boyun___ joined 09:06 denis_boyun_ left 09:10 rindolf joined 09:11 tinyblak_ left 09:12 tinyblak joined, gfldex joined 09:16 tinyblak left
raydiak good night #perl6 09:32
09:38 virtualsue left 09:45 tinyblak joined 09:50 kjs_ joined
moritz offline for traveling& 09:58
10:05 adu left 10:07 kjs_ left 10:11 rurban joined 10:36 mickcy_ca joined 10:40 spider-mario joined 10:46 denis_boyun_ joined 10:48 denis_boyun___ left
mickcy_ca I would like to process a string letter by letter ... How can I do this in Perl 6? 10:57
xfix for $string.comb { } 11:02
mickcy_ca: ^
mickcy_ca .comb does by letter ... no matter what is processed? 11:03
xfix r: say 'abc'.comb
+camelia rakudo-{parrot,moar} ce1e74: OUTPUT«a b c␤»
xfix mickcy_ca, well, without arguments, yes. 11:04
mickcy_ca OK ... will try.
xfix doc.perl6.org/type/Str#routine_comb
11:10 kjs_ joined 11:28 denis_boyun_ left, mickcy_ca left 11:40 tinyblak left, rurban left, tinyblak joined 11:53 64MABGFJ3 left 12:04 tinyblak left, tinyblak joined 12:06 tinyblak_ joined 12:09 tinyblak left 12:11 zakharyas joined 12:22 rindolf left 12:35 sirdancealot left 12:37 mr-foobar joined 12:53 mvuets joined
mvuets hi #perl6 12:56
can Inf be coerces to Int? 12:57
FROGGS mvuets: Int can't store Inf yet, but it should according to the design docs 13:03
Num can though
mvuets FROGGS: so it's TBI, cool, it answers my question. thanks! 13:05
FROGGS exactly :o) 13:06
though, I dunno why we should actually do that, what's the benefit of storing Inf in Int instead of Num? 13:07
colomon just type clarity
like you'd like to be able to say a sub returns Int but still allow it to return Inf
there was another proposal that Inf and NaN should be distinct numeric types of their own, which still intrigues me 13:08
mvuets m: for 1 .. Inf { say $_.WHAT; last } 13:09
+camelia rakudo-moar ce1e74: OUTPUT«(Int)␤»
mvuets m: Inf.Int
+camelia rakudo-moar ce1e74: OUTPUT«Unhandled exception: Cannot coerce Inf or NaN to an Int␤ at <unknown>:1 (/home/camelia/rakudo-inst-2/languages/perl6/runtime/CORE.setting.moarvm:throw:4294967295)␤ from src/gen/m-CORE.setting:13875 (/home/camelia/rakudo-inst-2/languages/perl6/runti…»
mvuets kinda DWIM 13:10
but not when asked explicitly 13:12
m: my Int $i = Inf # also this; i guess the same issue what colomon said 13:13
+camelia rakudo-moar ce1e74: OUTPUT«Type check failed in assignment to '$i'; expected 'Int' but got 'Num'␤ in block <unit> at /tmp/WmwaHFDCDn:1␤␤»
13:17 kjs_ left 13:22 aborazmeh joined, aborazmeh left, aborazmeh joined 13:23 tinyblak_ left 13:24 tinyblak joined 13:25 psch joined
psch hi #perl6 \o 13:25
13:27 aborazmeh left 13:29 dakkar joined 13:32 tinyblak_ joined 13:34 tinyblak left 13:36 tinyblak_ left 13:37 tinyblak joined 13:48 tinyblak_ joined 13:50 tinyblak_ left, tinyblak_ joined 13:52 tinyblak left 13:56 aborazmeh joined 13:59 tinyblak joined
dakkar what emacs mode do people use to edit p6 code? 14:00
14:02 BenGoldberg joined, tinyblak_ left
psch hm, RoleHOW is gone? did it just get split up into Curried~, Parametric~, etc? advent post 2010-12-22 is rather old... 14:06
14:12 mvuets left 14:14 hekmek joined 14:21 aborazmeh left 14:23 kjs_ joined 14:26 rindolf joined 14:37 tinyblak left 14:43 tinyblak joined
timotimo could very well be 14:54
psch i'm stuck with how to compose :/ 14:58
oh, but i think i'm actually approaching this wrong
i already have a HOW for the classes, so i don't need to build a role that does the Proxy 14:59
but JavaHOW doesn't do any of the MethodHOWs... 15:02
15:04 bjz_ left 15:05 bjz joined 15:16 rurban joined 15:17 ggoebel111111115 joined 15:18 ggoebel111111114 left
dakkar grr. calling «sub foo(Str:D :$named)» as «foo()» results in an error… because not passing an argument is the same as passing some undef to it, apparently 15:25
TimToady then give it a default that works 15:26
or add a multi with :U 15:27
or just remove the :D
dakkar I removed the :D
TimToady :D
15:27 H2O1 joined
dakkar I'm porting from P5, where (via Type::Params) I can say "if you give me this parameter, it has to be a defined string" 15:28
15:28 H2O1 left 15:29 spider-mario left
TimToady we usually use defaults for that sort of thing, I guess 15:30
15:31 spider-mario joined
dakkar vaguely related: (in rakudo) when a multi dispatch fails, it would be useful to know why each alternative failed 15:31
I had to de-multi my sub to figure out what the problem was…
15:31 Rounin joined
dakkar (is it obvious that this is the first time I write non-trivial code in p6?) 15:32
psch m: multi foo(Str:D :$n) { $n }; multi foo(Str:U :$n) { "undef" }; say foo :5n 15:34
+camelia rakudo-moar ce1e74: OUTPUT«Cannot call 'foo'; none of these signatures match:␤:(Str:D :n($n))␤:(Str:U :n($n))␤ in sub foo at /tmp/LlMQE7Iq5f:1␤ in block <unit> at /tmp/LlMQE7Iq5f:1␤␤»
psch i suppose adding what the capture contained would be pretty neat 15:35
TimToady usually we split those into one missing the arg and one that requires the arg with !
psch i.e. "supplied capture of (Int $) doesn't match any of these signatures: {...}" or somewhat like that
TimToady: yeah, the snippet was from testing with camelia if it DWIMs like that, which i wanted to test :) 15:36
s/wanted to test/wasn't sure about/ 15:37
dakkar psch: I assure you, printing the capture is not helpful enough 15:39
psch dakkar: what else would have helped? 15:40
dakkar the error message that a non-multi failure prints, instead, contains exactly what I needed ("that parameter was passed a type object, but wanted a defined value")
15:45 hekmek left
psch dakkar: the information which signature wants a type object or a value is in the signatures 15:45
dakkar: giving the capture as well would tell whether the method was called with type objects or values 15:46
i fail to see how that's not the same information
m: sub test(|c) { say c.perl; say c ~~ :(Int:U) }; test Int; test 5 15:47
+camelia rakudo-moar ce1e74: OUTPUT«Capture.new(list => (Int,))␤True␤Capture.new(list => (5,))␤False␤»
dakkar psch: sub foo(Str:D :$arg) called as foo(); I didn't know that that was equivalent to calling as foo(Any)
hence the capture not having any 'arg' value looked correct to me
psch oh. i see
dakkar once I saw the error "arg wanted a defined Str, a type object was passed instead" the problem became obvious 15:48
psch that's because nameds are optional. making the named required would've shown that as well
but i guess it strongly depends on context whether you want that 15:49
dakkar coming from p5, where named args are in hashes or hashrefs, and "defined" and "exists" are obviously different concepts, "not passing a named" or "passing it with undef as a value" look different to me 15:50
which is why it took me one hour to see what was going on
I got there in the end
xfix Type objects are undefined values. 15:51
psch m: multi foo (:$!) { say "this cand" }; multi foo () { say "other cand" }; foo # this is WAT :)
+camelia rakudo-moar ce1e74: OUTPUT«this cand␤»
dakkar I'm not even sure the distinction between "argument not provided" and "argument provided as Any" is useful
psch: ok, that's *weird*
xfix When most languages have single null, in Perl 6, there are many nulls that are type instance. 15:52
If you define class Something { }, null is Something.
psch dakkar: MMD does have a few bumps left
err, SD i guess
sub dispatch
or MSD 15:53
x)
fwiw, i'd almost say anonymous named params are utterly insane, but i don't know if forbidding them should be the right reaction 15:55
m: sub f(:$($a)) { say $a }; f :("a") # too few positional 15:56
+camelia rakudo-moar ce1e74: OUTPUT«Too few positionals passed; expected 1 argument but got 0 in sub-signature␤ in sub f at /tmp/iRPMSxhgPe:1␤ in block <unit> at /tmp/iRPMSxhgPe:1␤␤»
psch "well, make it optional!"
m: sub f(:$($a?)) { say $a }; f :("a") # too few positional
+camelia rakudo-moar ce1e74: OUTPUT«Too many positionals passed; expected 0 arguments but got 1␤ in sub f at /tmp/JRzlvFotua:1␤ in block <unit> at /tmp/JRzlvFotua:1␤␤»
psch "too many...?" 15:57
there's probably a sensible reason for this behavior
i think "subsignatures and anon nameds don't play well together" is a decent start to look into this, although i haven't looked much at dispatch logic 15:58
...and i actually wanted to fiddle around with the JavaHOW prototype
b2gills m: sub test ( --> Nil ){ Any }; test 16:01
+camelia rakudo-moar ce1e74: OUTPUT«Type check failed for return value; expected 'Any' but got 'Any'␤ in any return_error at src/vm/moar/Perl6/Ops.nqp:649␤ in block <unit> at /tmp/NuED6ddbkM:1␤␤»
b2gills ^ Should have said `expected 'Nil' but got 'Any'` 16:02
16:08 zakharyas left 16:12 xinming left 16:16 xinming joined 16:39 naddiseo left
dakkar «sub foo(Pair @a)»: how do I call this sub? foo([a=>1]) doesn't work 16:53
(expected Positional[Pair], got Array)
16:54 Ven joined
dakkar or, in other words, how do I say "this subroutine wants an array of pairs"? 16:58
Ven o/, #perl6.
dakkar temporarily drops the type constraint, adds a comment
Ven nice, perl6weekly now redirects :P 17:03
xfix In theory List[Pair], but... 17:05
Array*
Type check failed in binding $a; expected 'Array[Pair]' but got 'Array'
Array of Pair works, but the is no implicit cast from Array. 17:06
timotimo correct 17:13
you have to be specific
i mean, in declaring the array up front 17:14
Ven ... which is arguably something that should be fixed at some point in the future :) 17:15
timotimo because if you don't put a declaration "up front", you could append non-matching elements into the array, even from the outside after you've "type casted"
otherwise passing arrays by reference becomes impossible 17:16
17:25 telex left 17:26 telex joined 17:30 BenGoldberg left
dakkar timotimo: sorry, I don't follow… 17:30
timotimo imagine this:
sub frob(Array[Int] $a) { say $a; blubber; say $a }; my @foo = 1, 2, 3; frob(@foo); sub blubber { @foo.push: "ohai" } 17:31
Ven timotimo: what should happen is that – the type "outside" should be inferred to be Array[Int] 17:32
17:32 BenGoldberg joined
timotimo it should? 17:32
my @foobar = 1, 2, 3; @foobar.push: "hi" # so this will be incorrect?
dakkar timotimo: ok, I see, passing by ref becomes a mess if you have to propagate type constraints all over the place 17:33
timotimo that's not the problem
dakkar so, how do I insure that my sub can only be called with an array of pairs?
timotimo if you pass an Array[Int] explicitly, no problem
Ven timotimo: if I try to use a List[?] as a List[Int], yes, i think it should be inferred to be a List[Int]
timotimo Ven: so how should my code behave 17:34
Ven timotimo: it should fail
timotimo the one that passes @foo to frob and pushes a string from inside frob
Ven timotimo: my @a = 1, 2; sub f(Array[Int] $a) {}; f(@a); # <- this marks the type of @a to be Array[Int] 17:35
languages like scala will just infer the first time you declare it. ie: List(1, 2) will be inferred as List[Int] 17:36
List(1, 2.0) wil l be List[Double]
and List(1, "foo") will be List[Any]
timotimo why not List[Cool]?
Ven timotimo: which part? the sub? Because the subs needs it to be a list[Int] 17:37
timotimo: really, you can go both ways. Either force you to explicitly declare it as the correct type everytime or infer it 17:38
timotimo: but if you force it to be explicit, it's going to be really painful to return typed lists
skids You could use a type constraint for loose evaluation at the start of a function. Just be real careful with async. 17:39
dakkar skids: ?
Ven (scala uses insanity in this case, as in – CanBuildFrom)
dakkar is feeling very confused 17:40
I'm even getting confused by try blocks!
skids e.g. :@foo where { # check for all pairs }
dakkar skids: oh :/ also, why async?
Ven dakkar: two functions modifying the same array at the same time
skids Well, if anotherthread can alter your params while your sub is running.
I guess that's a more general async problem, though. 17:41
dakkar ah, of course, pass-by-ref, not copy
Ven I can't panda-install v5, apparently
also, getting a "Unhandled exception: ctxlexpad needs an MVMContext" when trying to run the debugger 17:43
(my rakudo is from yesterday)
timotimo right; the call to frob that requires @foo to be of Array[Int] would have to force @foo itself to get a different type constraint in its container
dakkar uh… what's the return value of a try block??
timotimo not sure if want
Ven m: say do try { 5 }; # dakkar 17:44
+camelia rakudo-moar ce1e74: OUTPUT«5␤»
dakkar m: say do try { 5; CATCH { 0 } }
+camelia rakudo-moar ce1e74: OUTPUT«Nil␤»
dakkar surprise!
m: say do try { die; CATCH { 0 } }
+camelia rakudo-moar ce1e74: OUTPUT«Died␤ in block <unit> at /tmp/kIn0_vt26G:1␤␤»
dakkar also, wtf?
Ven you're not catching anything here.
timotimo dakkar: should be the last statement 17:45
Ven if you put a CATCH block, you need to catch stuff
dakkar m: say do try { die; CATCH { default { } }
+camelia rakudo-moar ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/1gdcC1c1yu␤Unable to parse expression in block; couldn't find final '}' ␤at /tmp/1gdcC1c1yu:1␤------> say do try { die; CATCH { default { } }⏏<EOL>␤»
dakkar m: say do try { die; CATCH { default { 0 } } }
+camelia rakudo-moar ce1e74: OUTPUT«Nil␤»
dakkar stil…
timotimo the return value of a CATCH block may be undefined
consider my $foo = CATCH { ... }
but i'm not sure
also, i'm quite tired and distracted
bbl :)
dakkar I was hoping to get the same behaviour as p5's Try::Tiny, but clearly p6 has different ideas :) 17:46
timotimo the CATCH block doesn't need to be in the last position in the block 17:48
dakkar true, but: 17:49
- depending on its position to get the correct result is fragile
- I can't get at the result of the CATCH anyway 17:50
timotimo its position inside a block doesn't matter
at least not to my knowledge
it gets called "as a PHASER" so to speak anyway
japhb Nativecall is failing tests on r-m: t/06-struct.t .......... Failed 14/19 subtests 17:51
dakkar m: say do try { 5; CATCH { 0 } }
+camelia rakudo-moar ce1e74: OUTPUT«Nil␤»
japhb Is this known?
dakkar m: say do try { CATCH { 0 }; 5 }
+camelia rakudo-moar ce1e74: OUTPUT«5␤»
dakkar the position of the CATCH *does* matter
timotimo in that sense, yes
but only for the "last statement in the block" thing
dakkar eh. so I can't use a p6 try block the same way as I would use a p5 Try::Tiny try/catch "block" 17:52
17:52 sirdancealot joined
timotimo has no clue of perl5 17:54
dakkar fair enough :)
«my $x = try { 5 } catch { 0 };» would set $x to 5;
«my $x = try { die } catch { 0 };» would set $x to 0;
timotimo for something like that, i'd recommend "orelse" 17:55
m: say (die "oh no!" orelse 5);
+camelia rakudo-moar ce1e74: OUTPUT«oh no!␤ in block <unit> at /tmp/p_hBLcPN98:1␤␤»
timotimo oh
m: say ((die "oh no!") orelse 5);
+camelia rakudo-moar ce1e74: OUTPUT«oh no!␤ in block <unit> at /tmp/De31Rrn0jD:1␤␤»
timotimo that's obviously wrong
m: say ((try die "oh no!") orelse 5);
+camelia rakudo-moar ce1e74: OUTPUT«5␤»
japhb timotimo: orelse is for fail, not die, no?
timotimo m: say ((try die "oh no!") // 5);
+camelia rakudo-moar ce1e74: OUTPUT«5␤»
dakkar *almost* correct 17:56
timotimo you are right, ja
japhb
japhb It worked both ways. :-)
timotimo m: say (try die "oh no!" orelse 5);
+camelia rakudo-moar ce1e74: OUTPUT«Nil␤»
dakkar unless my function can return a fail, or an undef…
timotimo that has different precedence
you usually want orelse between statements
dakkar anyway, I have now ported my partial p5 port of a js library to p6
timotimo er ... or something
gotta go find food :)
moritz \o 17:57
dakkar good plan!
japhb dakkar: Are you actually wanting to differentiate a block returning Failure and Exception and respond with fundamentally different actions?
s/and/versus/
dakkar I don't know, it might make sense in some weird cases 17:58
japhb My gut reaction is that such a specialized differentiation deserves to be de-huffmanized. 17:59
.oO( Man it feels good to be talking Perl 6 again. Visitors are great, but boy do they get in the way of hacking. )
18:00
timotimo dakkar: i think orelse is exactly what you want to replace "catch" with 18:05
literally
dakkar so «$x = try { some_function_that_may_die() } orelse some_fallback_function()» 18:06
timotimo i think so, yes
in that case, // may also work just fine 18:07
dakkar github.com/dakkar/Net-Hawk ← the stuff I'm writing
I was going to write it in p5, but then I noticed that Digest::SHA and Digest::HMAC exist in p6 already, and I wanted to write something non-trivial in p6, so… 18:11
I should ask for a code review :)
I'll retire (from IRC) for the day, expect more perplexity (and perplexing code) in the coming days 18:15
18:15 dakkar left
skids r: role A [ :$a = 1, :$b = $a * 2] { method foo { say "$a $b" } }; role B does A[:a(1)] { }; role C does A[:a(2)] { }; B.new.foo; C.new.foo; 18:15
+camelia rakudo-parrot ce1e74: OUTPUT«1 2␤2 4␤»
..rakudo-moar ce1e74: OUTPUT«1 2␤2 2␤»
skids r-p++
18:19 rurban left 18:29 zby_home joined 18:30 zby_home left
b2gills Ven: The problem with v5 is `@*MODULES[-1]` should be written as `@*MODULES[*-1]` at github.com/rakudo-p5/v5/blob/maste...der.pm#L87 18:39
18:39 denis_boyun_ joined
Ven ys 18:39
good catch
18:44 virtualsue joined
skids filed RT123511 for above role stuff. 18:50
18:53 sqirrel_ joined 18:54 denis_boyun_ left
b2gills m: my \b = *-*; my &b = *+*; my $b = * * *; say (b.(3,2), b(3,2), $b(3,2), $b.(3,2)); 18:54
+camelia rakudo-moar ce1e74: OUTPUT«1 5 6 6␤»
b2gills Unsigiled vars are more unique among other vars than their name would suggest 18:56
19:10 rindolf left, Ven left
sergot hi o/ 19:19
19:21 Ven joined 19:22 mvuets joined
japhb m: my \b = *-*; my &b = *+*; my $b = * * *; say (b.(3,2), b(3,2), &b(3,2), &b.(3,2), $b(3,2), $b.(3,2)); 19:24
+camelia rakudo-moar ce1e74: OUTPUT«1 5 5 5 6 6␤»
japhb b2gills: That's because the second form there is sugar for the third.
(Not because unsigaled vars are special, but because sub call syntax is special.) 19:25
*unsigiled
19:32 sqirrel_ left 19:34 kaare_ left 19:35 Ven left 19:42 kaare_ joined 19:48 Sqirrel left
moritz m: my Int a 19:51
+camelia rakudo-moar ce1e74: OUTPUT«===SORRY!===␤Type 'Int' is not declared. Did you mean 'int'?␤at /tmp/2bS0K2J7Q8:1␤------> my Int ⏏a␤Malformed my␤at /tmp/2bS0K2J7Q8:1␤------> my Int ⏏a␤␤»
moritz wtf? type Int is declared!
19:52 FROGGS left, FROGGS[tab] left
pmichaud good afternoon, #perl6 19:53
+dalek c: 26d8fec | moritz++ | lib/Type/X/Syntax/Malformed.pod:
document X::Syntax::Malformed
psch m: my Int a;
+camelia rakudo-moar ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/hip86ikiUM␤Malformed my (did you mean to declare a sigilless \a or $a?)␤at /tmp/hip86ikiUM:1␤------> my Int a⏏;␤»
moritz good pm, pm
psch moritz: there's a ticket for that
moritz psch: good, then I don't have to open one 19:54
psch i looked at it a few hours ago, but i lost it
kjs_ moritz: ping
psch o/ pmichaud
moritz it's probably backtracking somewhere where it shouldn't
kjs_: pong
kjs_ moritz: I’ve tried to send you an email, but it kept bouncing
moritz kjs_: use moritz.lenz@gmail.com instead 19:55
kjs_ okay.
moritz kjs_: sorry for the inconvenience
kjs_ no bother.
psch RT #120831 for reference
synopsebot Link: rt.perl.org/rt3//Public/Bug/Displa...?id=120831
pmichaud So, I'm unfamiliar with how perl6-community-modules works. How do I submit an issue ticket for URI::Escape?
moritz psch++ 19:56
pmichaud should it go back to colomon's original repo, or is p6-c-m now its official home?
nwc10 good UGT heresey, pmichaud
(andIhave no idea about your question)
pmichaud <-- heretic, no doubt
timotimo ohai mister michaud :)
colomon p6-c-m is now its official home
pmichaud oh, wait, now I see the issues link 19:57
moritz pmichaud: github.com/perl6-community-modules/uri/issues
pmichaud I didn't see it earlier.
moritz pmichaud: I just enabled issues for that repo
pmichaud: it seems that github disables issues for cloned repos by default
pmichaud moritz++
colomon and I did not originally write it, I just forked it because the original author seemed to have abadoned it.
moritz++
moritz I guess I should go through the list of modules and enable issues for them all 19:58
xfix m: promptt 20:05
+camelia rakudo-moar ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/raoGEDZ5Qj␤Undeclared routine:␤ promptt used at line 1. Did you mean 'prompt'?␤␤»
xfix p: promptt
+camelia rakudo-parrot ce1e74: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix Hm...
colomon moritz++ # again
xfix p: prampt
+camelia rakudo-parrot ce1e74: OUTPUT«===SORRY!=== Error while compiling /tmp/2aiGezg06R␤Undeclared routine:␤ prampt used at line 1. Did you mean 'prompt'?␤␤»
xfix Any idea why promptt requires ICU, but prampt doesn't? 20:06
moritz xfix: no; but Perl 6 without Unicode support makes no sense whatsoever, so the question is kinda moot
xfix moritz, also, camelia should have Parrot Rakudo compiled with ICU. 20:07
moritz xfix: +1
20:07 Rounin left
moritz and rakudo should refuse to configure without ICU 20:07
xfix I agree. Perl 6 without Unicode support isn't Perl 6. 20:09
github.com/rakudo/rakudo/blob/2975...2014.10.md
"This is last release of Rakudo to support parrot without ICU."
moritz seems time to make that threat come true
20:10 sirdancealot left 20:11 sivoais left
hoelzro o/ #perl6 20:13
+dalek kudo/nom: 7fca945 | moritz++ | Configure.pl:
Require ICU support on the Parrot backend

  ... as announced in the 2014.10 release announcement.
pmichaud I do so like GitHub's issue trackers. :)
github.com/perl6-community-modules/uri/issues/1
timotimo yeah, it's not bad
pmichaud I'd submit a fix and pull request, but I don't have panda etc installed on my machine at the moment 20:14
and I'm not keen on submitting untested patches :)
moritz pmichaud: I'll give it a shot right now
20:15 zakharyas joined
pmichaud out of curiosity, do we want to require "icu support" or do we just want to test that the required Unicode operations are available? 20:16
moritz github.com/perl6-community-modules...ape.pm#L11
pmichaud: well, testing capabilities would be nicer, but also much more work
pmichaud I'm fine with testing for "icu support" for now. 20:17
I agree it's probably not worth pumping a lot of time / energy into it.
colomon pmichaud++ 20:18
hoelzro I found some interesting behavior when mixing sockets and threads: gist.github.com/hoelzro/d7d7b8056016292639ef 20:20
in short, I can't read from a socket if that socket was created in a thread other than the one I'm reading in
I'm wondering if MoarVM has some sort of guard on its socket objects so that you have to use them from their creating thread
20:23 FROGGS joined 20:30 Ven joined
moritz hoelzro: if that's the case, it should certainly throw an exception, not simply return the empty string 20:35
20:35 darutoko left 20:37 sivoais joined 20:42 Rounin joined 20:45 Ven left
hoelzro agreed 20:52
I'm testing it on all backends, and will file a bug 20:53
20:57 Sqirrel joined 21:06 Mso150 joined 21:11 bjz left, bjz_ joined 21:13 kaare_ left 21:32 Ven joined
b2gills m: say (3 div 2, -3 div 2); # is div always supposed to round down? 21:34
+camelia rakudo-moar ce1e74: OUTPUT«1 -2␤»
21:34 makapa joined
timotimo towards -inf, iirc 21:36
xfix It's floor division, not integer division.
m: say -22 div 10 21:37
+camelia rakudo-moar ce1e74: OUTPUT«-3␤»
xfix Anyway, the reason is that we want, i = (i div j) * j + (i mod j). 21:38
m: say -190 mod 12
+camelia rakudo-moar ce1e74: OUTPUT«2␤»
xfix We show 2 here, not -10, therefore division has to return -3.
(the reason why we show 2 here is that it's generally more useful, for example, if you have a clock showing 10:00, and you are curious what it showed 200 hours ago, you want -190 % 12 == 2, not -190 % 12 == -10) 21:39
s/We show/Perl 6 shows/
s/that we want/that you probably want/ 21:40
psch is reminded of the discussion that brang forth "abstruncate"
21:42 zakharyas left 21:44 xfix left
hoelzro ok, bug filed: github.com/MoarVM/MoarVM/issues/165 21:45
21:48 mvuets left
b2gills I just wonder if there is a way to write Perl6 code which can be JITed to the DIV x86 instruction (which returns the whole number and the remainder) in a way that you don't have to call it twice if you want both 21:50
sub as-fraction ( Rational:D $ ( :$numerator, :$denominator ) --> Str ){ Int($numerator / $denominator) ~ ' + ' ~ abs($numerator) mod $denominator ~ '/' ~ $denominator } 22:00
jnthn evening, #perl6 22:09
+yoleaux 27 Dec 2014 20:04Z <FROGGS> jnthn: can you please take a look at that gist? line 28 triggers the shows error (I want to make `do while` work): gist.github.com/FROGGS/98e1a97434c3753dc081
27 Dec 2014 21:14Z <lizmat> jnthn: I don't see how those methods could not be public, unless you want to go all getattr ?
jnthn .tell FROGGS doing that at QAST level is absolutely wrong, I think. It will pessimize every loop that doesn't care for the rsults, and worse it'd be useless for Perl 6 which needs lazy execution. This ties into GLR's proposed LoopIter, and I think we likely want to leave it for that. 22:11
+yoleaux jnthn: I'll pass your message to FROGGS.
jnthn b2gills: That sounds in the realm of something a VM with an optimizing JIT could do. 22:13
(Spot the fact we need both results, and do one operation to get them.)
b2gills Yeah but would the sub I just posted get JITed in that way 22:14
I would think it would be more likely to do so if I could write it in a way that it rounds towards 0 instead of -Inf since it works on unsigned ints ( at least according to the docs I printed in the 90s ) 22:16
jnthn b2gills: Not with Int, I doubt, because that defaults to big integer semantics. 22:18
You'd have to be dealing with native integers. 22:19
22:24 Mso150 left
b2gills Couldn't Rat be Rational[int,uint64], then it would be working with natives if you create a multi that deals only with Rat ( or the VM creates one that's possibly hidden from introspection ) 22:27
jnthn I find it highly unlikely we'd make the default Rat type not have Int as its numerator. 22:30
Other instantiations should be possible with natives, though.
(Won't work out today, but should in the future.) 22:31
Ven jnthn: can you confirm that the debugger is broken, or does it happen to be me? 22:33
jnthn Ven: I've no clue. 22:34
Ven fair enough.
jnthn I'm on vacaitn, and not really interested in fixing things.
*vacation
Will have a look some other time.
Ven sorry! :) 22:35
jnthn np :)
Ven hope you have great holidays, and will be back with some awesome pictures.
jnthn Well, this is more "relax with family and catch up on a huge sleep deficit" :) 22:36
(Doing OK on both. :))
Just dropping by here now and then in case I can quickly answer things that unblock others while I'm getting some rest
22:37 rurban joined
japhb jnthn: Did you see my question about NativeCall failing tests on r-m? 22:46
jnthn japhb: Yes, only thing I could guess is version skew if you're not building master of All The Things.
japhb: That and I think there are still lingering 32-bit issues. 22:47
japhb I was building on 64-bit, and I usually build with versions at 'whatever rakudo's configure wants' 22:48
So perhaps nqp and rakudo need a moar bump 22:49
jnthn Maybe, but I thought that happened since the last round of NativeCall changes.
'cus it was quite a while ago
(Like, well over a week)
japhb shrugs
Build completed at 9:36 this morning my time 22:50
jnthn If it ain't either of those, no idea.
japhb shakes his fist at errors
jnthn wanders off to sleep some more 22:52
japhb Good sleeps 22:53
22:57 kjs_ left 23:26 psch left 23:35 makapa left 23:40 rurban left 23:41 aborazmeh joined
skids r: my $i = 0; <package module class role>.map: {$i++; EVAL "$_ Foo{$i}" ~ q« { our sub foo { }}; say keys » ~ "Foo$i" ~ "::"} 23:42
+camelia rakudo-{parrot,moar} ce1e74: OUTPUT«&foo␤&foo␤&foo␤␤»
23:51 sirdancealot joined 23:59 virtualsue left