»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
lue rakudo: say "10.25".fmt("%x") 00:00
p6eval rakudo 922500: OUTPUT«a␤»
pmichaud rakudo: say 10.25.base(16) 00:01
p6eval rakudo 922500: OUTPUT«Method 'base' not found for invocant of class 'Rat'␤ in main program body at line 22:/tmp/jyzgSFkeRO␤»
pmichaud rakudo: say (10.25).Real.base(16) 00:02
p6eval rakudo 922500: OUTPUT«Method 'base' not found for invocant of class 'Rat'␤ in main program body at line 22:/tmp/ZOewWMkxdX␤»
pmichaud hmm.
S32 defines .base but apparently it's NYI in rakudo.
lue Sure I could create my own sub to do it myself, I just think P6 should be able to go both ways [I don't recall such a function ever existing]
pmichaud S32 says .base should work on any Real
lue looks at S32
pmichaud S32:243 00:03
benabik pmichaud: benabik (Complicated, I know. ;-)
pmichaud benabik: I always confirm rather than assume. :)
benabik pmichaud: Safer that way. :-)
[Coke]: pmichaud: (Sorry for slow responses, I'm away from home and trying to pack up to go back.) 00:04
pmichaud benabik: you now have commitbit to perl6 repos
benabik pmichaud: I will use it irresponsibly. 00:05
pmichaud +1
benabik s/ir//
pmichaud either way works :)
lue so &base is a method inside the Real role? I feel like implementing it [but first, other stuff to do :/] 00:08
pmichaud it could be a method in Num, and Real delegates to it.
benabik How do you throw something in nom? die?
pmichaud yes, die works. 00:10
lue Is Num above Real, like Mu is above Any?
pmichaud Real is a role
Num does Real
Int does Real
benabik And it does! > die 1; CATCH { say $! } # OUTPUT«1␤» 00:11
lue I just thought of putting &base in Real, because that's where S32::Num says it goes :) 00:12
pmichaud Real is good... we can move it if we want a different factoring 00:15
dalek atures: 9adc9b2 | Coke++ | template.html:
spec? vs. code* - put spec first.
lue afk --nom-time 00:22
00:24 CrazyPotato joined, benabik left 00:34 [particle]1 is now known as [particle]
[Coke] ZOMG it's [particle] 00:35
00:47 PacoLinux left 00:48 CrazyPotato left 00:51 PacoLinux joined 00:53 whiteknight left
steampunkey what's a .pod? 00:53
00:56 meteorjay left
TimToady Plain Old Documentatoin 01:00
lichtkind good night 01:02
01:03 lichtkind left
jdhore TimToady, Did you create POD or did someone else? 01:03
crked just like a struct in C
TimToady I did the original 01:04
the new is mostly the work of @Damian 01:05
though I specced that =begin/=end had to work right
jdhore TimToady, Ah, nice. I had no idea if the original was you or if it came later.
01:11 tokuhirom left, tokuhirom joined 01:15 wolfman2000 left 01:16 tokuhirom left 01:31 fbass left 01:35 woosley joined 01:40 donri left 01:41 wolfman2000 joined 01:56 fbass joined 02:05 Reaganomicon left
crked Hi perl6, can I ask a question on perl5 ? 02:10
Someone else asked me and I really cannot figure out. It's about the perl -l usage with the here-doc structure 02:11
When I do perl -l <<EOF then $a = 1; then EOF. It seems the $a will be interpreted by bash first. 02:13
But when I do perl -l <<"EOF" the result is correct
I really don't know the difference between perl -l <<EOF and perl -l <<"EOF"
I am using perl 5.10
lue crked: I've never used Perl 5, but I know from using the Perl 6 commandline that using single quotes should keep bash from interfering with the variables. 02:17
Have you tried #perl ? That's a much better place to ask Perl 5 questions if you haven't tried that already.
crked Thanks, I will try there. 02:19
djanatyn Hey, has anyone here used YAML? 02:24
02:29 PacoLinux left 02:31 [particle]1 joined 02:33 [particle] left
djanatyn is going to write his static website generator, using YAML! :D 02:33
02:35 fbass left, fbass joined 02:40 am0c joined
djanatyn Also, *wow*. The Ratel library in the Web.pm module is really interesting. 02:48
How exactly would I install the Web module?
02:51 fbass left, fbass joined
dalek ast: 5e16d04 | lue++ | S32-num/base.t:
Added three non-integer tests to S32-num/base.t
Tene djanatyn: Thanks; I don't know if it's been worked on since I wrote the first draft a few years back (I think that was me...) 03:01
djanatyn Tene: did you see my first (well, kinda first) perl 6 code? 03:02
Tene no
djanatyn one second, let me edit out this bug
03:03 crked1 joined
djanatyn there we go! 03:03
03:03 crked left
djanatyn gist.github.com/1117266 <-- it's...somewhat messy. 03:03
also, forgot to implement that suggestion that masak had
03:03 steampunkey left
djanatyn But it runs, and uses a couple features from Perl 6 :) 03:04
crked1 slaps crked1 around a bit with a large trout
Tene nice
djanatyn ...that sounds...vaguely familiar. 03:05
Is that an irssi or mIRC plugin?
Or is crked1 an IRC bot? ;)
03:05 fbass left 03:11 envi joined 03:20 crked1 left 03:23 Su-Shee_ joined 03:25 jimmy1980 left 03:27 Su-Shee left 03:31 jimmy1980 joined 03:44 benabik joined 03:49 molaf joined 03:50 rdesfo left
sorear djanatyn: it's an old mIRC feature 03:52
djanatyn sorear: Ah. 03:56
03:57 soh_cah_toa joined
soh_cah_toa i saw on dev.perl.org that localtime() and gmtime() should be date() and utcdate() in p6. has this not been implemented yet in rakudo? i only see time() 04:00
04:03 molaf left 04:06 daniel-s joined 04:10 birdwindupbird joined 04:11 daniel-s left, daniel-s joined 04:13 satyavvd joined 04:15 daniel-s left 04:17 daniel-s joined
[Coke] OOC, where on dev.perl.org? 04:21
(you really want to look at perlcabal.org/syn/) - if you're looking at the old RFCs or apocolypses, those are out of date. 04:22
soh_cah_toa dev.perl.org/perl6/rfc/48.html
[Coke] soh_cah_toa: try: perlcabal.org/syn/S32/Temporal.html 04:23
the rfcs were the communities initial proposals, btw, a lot of that didn't survive Larry.
"community's" *sigh*
soh_cah_toa yeah, i usually do look at perlcabal. just couldn't find anything about time functions. clearly, i didn't look hard enough :) 04:24
ah, looks like DateTime was what i need 04:25
[Coke] is anyone from the channel working the dev.perl.org folks? If not, I can resurrect my old old thread with Robrt about the site and get some minor updates there. (like moving the SYN up to the top of the list.) 04:26
djanatyn Grr. :\
Is HTTP::Daemon a Perl 6 module, or a Perl 5 module?
[Coke] it is at least the latter. 04:28
soh_cah_toa djanatyn: perl 5
djanatyn ...oh.
So, Web.pm depends on a Perl 5 module.
[Coke] I would ping masak about that, perhaps semi-obviously. 04:29
djanatyn yep :) 04:30
dalek atures: 1220ece | larry++ | features.json:
clarify "multi-dim params" means LoL arg/params
sorear does Web use HTTP::Daemon:from<perl5>?
djanatyn Dunno. I think so.
Is there a way to forcibly install a module using Panda? :) 04:48
04:50 soh_cah_toa left 04:51 flatwhatson joined 04:55 flatwhatson left
Tene djanatyn: there's a Perl 6 version of HTTP::Daemon 04:56
djanatyn: check out the web module on masak's github, iirc
djanatyn o_e; 04:59
That's what I'm trying to do.
I've downloaded the web module, I've tried to copy files over into my perl6 library directory
the web module on github has a folder, "lib" 05:01
Am I supposed to just copy the contents of that folder into ~/.perl6/lib/ ? 05:02
05:03 birdwindupbird left
sorear no, you're supposed to use panda or ufo or proto or neutro 05:04
djanatyn But using panda doesn't work :P 05:05
panda complains about not havinng HTTP::Daemon, and when I try to install that, it can't find it in the ecosystem.
the ecosystem appears to be a repo on github, apparently 05:06
I've been looking in there, but I can't really find any HTTP::Daemons either.
benabik Huh. CATCH seems to work in nom, but try { CATCH } doesn't.
Oh, wait... 05:08
nom: try { die "a" ; CATCH { say $_ } } 05:09
p6eval nom: OUTPUT«a␤»
benabik nom: try { die "a" ; CATCH { say $_.uc } }
p6eval nom: OUTPUT«(timeout)»
benabik That segfaults after a long wait here.
So try { CATCH } works, but CATCH { $_.uc } doesn't. 05:10
nom: CATCH { .say }; die 'a' 05:11
p6eval nom: OUTPUT«a␤»
benabik nom: CATCH { .uc.say }; die 'a'
p6eval nom: OUTPUT«(timeout)»
benabik nom: Exception.new 05:12
p6eval nom: ( no output )
benabik Yeah, it doesn't like that.
get_pmc_keyed_str() not implemented in class 'Mu' 05:13
Ah! 05:14
nom: die 'a'; CATCH { .bogus }
p6eval nom: OUTPUT«(timeout)»
benabik Unknown methods on Exception causes segfault instead of an error message. LTA.
Should I just use issues on github, or is there another place for rakudobugs? 05:16
Ah. No github issues...
benabik submits rakudobug. 05:18
05:18 birdwindupbird joined
benabik nom: Exception.new 05:24
p6eval nom: ( no output )
benabik The interactive prompt crashes from that.
nom: say Exception.new
p6eval nom: OUTPUT«get_pmc_keyed_str() not implemented in class 'Mu'␤current instr.: 'Str' pc 675508 (src/gen/CORE.setting.pir:184163) (src/gen/CORE.setting:4507)␤»
benabik Probably related to that, although the fact that interactive crashes after the error is LTA. 05:25
perl6: die 'a'; CATCH { say .does('uc') } 05:28
p6eval niecza v8-9-g2bbb19a: OUTPUT«===SORRY!===␤␤Action method statement_control:CATCH not yet implemented at /tmp/0KbxqvQ3K9 line 1 (EOF):␤------> die 'a'; CATCH { say .does('uc') }⏏<EOL>␤␤Unhandled exception: Unable to resolve method statement_level in c… 05:29
..pugs: OUTPUT«*** a␤ at /tmp/Ruimp54ae2 line 1, column 1-8␤»
..rakudo 922500: OUTPUT«0␤»
benabik Hm. perl6: doesn't run nom yet.
TimToady er, .does('uc') makes no sense 05:30
did you mean .can('uc') ?
benabik Uh, yes?
TimToady 'uc' isn't a type name, and .does requires a type
a role, in fact
benabik Yes. I mixed up does and can. 05:31
TimToady .does(Hamlet) but .can('stab') 05:32
benabik TimToady: Is exception supposed to be able to .can('uc')? It's used in the Rosetta Code example for Exceptions. 05:33
TimToady nom: say Cool.can('uc') 05:34
p6eval nom: OUTPUT«uc␤»
benabik nom: say Exception.does(Cool)
p6eval nom: OUTPUT«Bool::False␤»
TimToady it can if the Exception is Cool, but that's not guaranteed 05:35
benabik I'm thinking about removing the .uc from the RC example, but don't want to if it's correct and rakudo is wrong. :-D 05:36
TimToady which one?
benabik rosettacode.org/wiki/Exceptions#Perl_6
TimToady it's probably useful to be able to pattern match an exception as a string 05:37
PerlJam TimToady: can a single block have multiple ENTER phasers? 05:40
TimToady yes
PerlJam and they are executed in which order?
(I assume LEAVE phasers are analogous but opposite to ENTER phasers) 05:41
TimToady S04:1380 05:42
PerlJam that doesn't say anything about execution order :)
TimToady no, but it was originally stated in A4, iirc 05:43
entering stuff (ENTER, BEGIN, START) happen in order declared
exiting stuff happens in opposite order
PerlJam okay, that's what I figured. 05:44
05:46 drbean left
jnthn morning, #perl6 05:48
05:49 koban joined
dalek ecs: c493227 | larry++ | S04-control.pod:
define normal order for init vs final phasers
05:49 koban left
PerlJam jnthn: good morning. 05:49
jnthn: I was just puzzling out how to add ENTER and LEAVE phasers to nom. Got any advice?
jnthn PerlJam: LEAVE is really hard. 05:50
PerlJam well, it's good I'm looking at ENTER right now then :)
dalek atures: b813c7c | larry++ | features.json:
give lambdas and placeholders their own entries
atures: 67b5637 | larry++ | features.json:
more codes
PerlJam jnthn: LEAVE is hard because of stack unwinding? 05:51
jnthn ENTER is probably should an unshift onto the start of the PAST::Stmts for the block
PerlJam: Right.
TimToady it'd be a push if you execute them in order
LEAVE would unshift, methinks
oh, the standments, not the ENTER list 05:52
PerlJam jnthn: the spec also says that they're available as a trait on the block. Not sure how to do that
jnthn hm
Is that true of phasers generally? 05:53
I guess can't be for BEGIN and CHECK...
benabik rakudo: die 'a'; CATCH { say .uc } 05:54
p6eval rakudo 922500: OUTPUT«A␤»
PerlJam I guess there's no trait_mod:<will> yet either 05:56
05:57 fhelmberger left
jnthn hm 05:57
There is
05:57 fhelmberger joined
jnthn I'm just curious what happens with multiple ENTERs. 05:57
See $*ST.apply_trait for examples of trait application in Actions.pm 05:58
TimToady pugs: ENTER { say "hi" }; ENTER { say "lo" }; LEAVE { say "HI" }; LEAVE { say "LO" } 05:59
p6eval pugs: OUTPUT«LO␤»
sorear hehehe
TimToady hmm
perl6: ENTER { say "hi" }; ENTER { say "lo" }; LEAVE { say "HI" }; LEAVE { say "LO" } 06:00
PerlJam last one wins?
p6eval pugs: OUTPUT«LO␤»
..niecza v8-9-g2bbb19a: OUTPUT«===SORRY!===␤␤Action method statement_prefix:ENTER not yet implemented at /tmp/FVl_SSeIqV line 1:␤------> ENTER { say "hi" }⏏; ENTER { say "lo" }; LEAVE { say "HI" }␤␤Action method statement_prefix:ENTER not yet implement…
..rakudo 922500: OUTPUT«===SORRY!===␤ENTER phaser not yet implemented at line 22, near "; ENTER { "␤»
TimToady should say hi lo LO HI
PerlJam pugs: ENTER { say "hi" }; ENTER { say "lo" }
p6eval pugs: OUTPUT«lo␤»
PerlJam pugs: ENTER { say "hi" }; LEAVE { say "what?" }; ENTER { say "lo" }
p6eval pugs: OUTPUT«lo␤»
jnthn (Mostly because will normally takes a block...)
PerlJam yep
sorear hasn't bothered to figure out how to implement LEAVE yet 06:01
jnthn omgz...commute time already!
sorear ENTER should be pretty easy though. I think niecza had ENTER pre-mm
PerlJam sorear: well, you can re-add it and update perl6.org/compilers/features and be ahead of rakudo in yet another area :) 06:05
benabik With control exceptions, I'd think that LEAVE would be something that catches return exceptions, calls the block, and rethrows. 06:07
PerlJam not just return exceptions though
TimToady you'd think, but that's not when LEAVE runs
benabik True. All exceptions, I guess.
TimToady it runs at stack unwind time
which is after any exception is handled 06:08
so it's only the stack unwinder that has to care
benabik P6 is specced as using stacks? Can't implement with CPS? 06:09
TimToady well, just do anything non-idempotent in a LEAVE :)
06:10 wtw joined
sorear benabik: cps is really a kind of stack if you squint right. A linked list stack. 06:11
TimToady so like, only close files in GC, not in LEAVE ;)
benabik sorear: So "stack unwind time" is "call continuation time"? LEAVE would wrap the caller continuation with a "call this block first" one? 06:12
PerlJam there's a GC phaser?!? ;-)
TimToady yeah, called DESTROY :)
sorear benabik: stack unwind time means when an exception has committed to not being resumable 06:13
benabik But LEAVE is called at both exception and return time, yes?
sorear: Well, then you're wrapping the "exception failed" continuation. ;-D
sorear benabik: exceptions are not built on continuations 06:14
unless they are
benabik If you're writing a compiler with CPS they should be.
TimToady in that case stack unwinding is also a form of GC, and you can't do it till the lower continuation is thrown away :) 06:15
basically, you shouldn't be mixing transactional commits with continuations that refuse to commit 06:16
maybe we should allow Shroedinger Files to be both open and closed at the same time :) 06:17
I note that Ruby is de-emphasizing continuations these days 06:19
continuations are problematic unless you can carry hypothetical universes along with them
benabik If I understand CPS correctly, then you should have a both a "commit" and a "abort" continuation for something that's supposed to be transaction like.
06:20 kjeldahlw joined
TimToady well, but in the case of a deep continuation, you need something more like "commit" vs "uncommit" 06:20
"Ha, ha, I didn't *really* close that file..." 06:21
06:22 drbean joined
benabik The real trick in CPS is passing around and wrapping the continuations properly. Whether things aren't saved until "commit" is called or things are undone when "abort" is called is really an implementation choice. 06:22
TimToady CPS doesn't really mix well with mutable state, and filehandles are mutable
all the mutable state must be inherent to the continuation for CPS to work well 06:23
06:23 Su-Shee_ is now known as Su-Shee
PerlJam needs some sleep before work (~6.5 hours from now) 06:23
I guess my ENTER adventure with nom will have to wait until later 06:24
PerlJam .zZZZ
TimToady much like we do with Cursors in perl6 grammars, where the mutable state is carried along with the current Cursor, and thrown away if you throw away the Cursor
night, PerlJam
benabik It's more that you need to ensure that any cleanup is called with all continuations. But you run into the same problem in any non-linear control flow. Early returns and exceptions do the same thing. 06:26
TimToady it almost makes you want to have an IO monad... :)
06:26 drbean left, drbean joined 06:27 drbean_ joined 06:28 drbean_ left 06:38 noganex_ is now known as noganex 06:44 mj41 joined 07:16 pernatiy left
mathw \o/ IO monad 07:16
sorear o/ mathw 07:17
mathw o/ sorear
07:17 pernatiy joined 07:19 wamba joined 07:20 pernatiy left 07:21 pernatiy joined, kjeldahlw left 07:25 lumi_ joined
moritz lue-- # not running the tests he commits 07:46
dalek ast: f450fca | moritz++ | S (4 files):
rakudo unfudges
ast: 9e531b5 | moritz++ | S32-num/base.t:
fix syntax error in base.t
shinobicl hi 07:59
sorear TimToady: consider class A { }; say $OUR::(A). Should this error because A !~~ Cool, or should it be treated like OUR::<$A()> ?
shinobicl: hi
shinobicl if i define an operator as part of a role
07:59 araujo left
sorear no 07:59
operators are subs, subs are lexically scoped
only visible in one brace-group unless exported from a module 08:00
...did I anticipate the wrong question? should have waited :( 08:01
shinobicl no, it is ok
08:01 kjeldahlw joined
shinobicl i had definen an operator inside a role. It didn't work 08:01
i guess i can oly use a class for that, then. Is just that the operator <-> is defined for a Date. 08:02
i would like to have a special <-> for Dates with certain role (role Workday) 08:03
sorear class versus role (should) make no difference
shinobicl role Workday { ...; method infix:<-> (Date $start, Date $target) { ... } } 08:04
my $d = Date.new does Workday; my $d2 = Date.new does Workday;
benabik role Workday {}; multi infix:<->(Workday $s, Workday $t) # Why not this? 08:05
shinobicl Workday is a role, not a class
benabik You should be able to use roles in multi signatures. 08:06
shinobicl say $d - $d2; # --- This should call my version of <->
sorear shinobicl: you don't write operators like that
shinobicl: infix:<-> *must* be a sub
not a method
shinobicl oh
sorear benabik models correct usage
08:11 mikehh left, kjeldahlw left 08:12 kjeldahlw joined 08:16 woosley1 joined
moritz note that operators are just subs, and subs are lexically scoped 08:16
08:17 kjeldahlw left
moritz shinobicl: so if you define an infix:<-> inside a role, it will only work inside that role by default 08:17
08:17 Coleoid_ left, kjeldahl joined, woosley left 08:19 daxim joined 08:21 espadrine` joined 08:29 shinobicl left
dalek ok: 920b6b4 | moritz++ | src/basics.pod:
avoid space in an identifer, qwebirc99822++
08:37 woosley1 left 08:46 stepnem left 08:51 noganex_ joined, stepnem joined, espadrine` left
dalek ecza: 77bc5f0 | sorear++ | src/ (2 files):
Name refactor part 4: basic names through <variable>
sorear out
08:54 noganex left
tadzik good morning #perl6 08:58
moritz good morning tadzik 08:59
moritz goes off to get some cake from a co-worker
tadzik o, a birthday? :) 09:00
09:07 noganex_ is now known as noganex 09:12 im2ee joined 09:20 eiro left 09:25 eiro joined 09:39 Reaganomicon joined
moritz tadzik: no, maternal leave 09:44
09:52 ab5tract joined 09:59 max joined, max is now known as Guest18070 10:00 Guest18070 left 10:08 pernatiy left 10:18 MayDaniel joined 10:22 kfo_ joined 10:23 Butterfly77 joined 10:24 Butterfly77 left 10:26 kfo left 10:30 frettled left 10:55 MayDaniel left, pernatiy joined 11:01 antonio_ joined, antonio_ is now known as odoacre 11:10 mls_ joined
mls_ hi perl6! 11:10
11:11 mls__ joined
mls__ jnthn: I made the last test in try.t work 11:12
patch: gist.github.com/1117955 11:14
11:15 mls_ left 11:20 araujo joined
mls__ One thing I noticed that should still be fixed is that the CATCH blocks appear *twice* in the genereated pir 11:22
same subid, same code, but different sub name 11:23
11:24 icwiener joined
mls__ afk, lunch... 11:25
11:36 jaldhar left 11:39 jaldhar joined
moritz nom: try { pir::throw__vP('foo'); CATCH { say $! } } 11:45
p6eval nom: OUTPUT«Not a throwable object␤»
moritz how do I make an object throwable? 11:47
11:49 gfldex joined
moritz lemme guess, one needs to actually create parrot Exception, and attach Perl 6 exception object as payload somehow 11:51
nqp: try { die("foo"); CATCH { say(pir::typeof($!) } }; 11:52
p6eval nqp: OUTPUT«Unable to parse blockoid, couldn't find final '}' at line 1␤current instr.: 'nqp;Regex;Cursor;FAILGOAL' pc 3863 (src/Regex/Cursor.pir:244)␤»
moritz std: try { die("foo"); CATCH { say(pir::typeof($!) } };
p6eval std 516268a: OUTPUT«===SORRY!===␤Unable to parse argument list at /tmp/LvMQeXrH4H line 1:␤------> try { die("foo"); CATCH { say⏏(pir::typeof($!) } };␤Couldn't find final ')'; gave up at /tmp/LvMQeXrH4H line 1:␤------> die("foo"); CATCH { say(pir…
moritz nqp: try { die("foo"); CATCH { say(pir::typeof($_) } }; 11:53
p6eval nqp: OUTPUT«Unable to parse blockoid, couldn't find final '}' at line 1␤current instr.: 'nqp;Regex;Cursor;FAILGOAL' pc 3863 (src/Regex/Cursor.pir:244)␤»
11:54 satyavvd left
moritz nqp: try { pir::die(pir::new__PS('Exception')); CATCH { say($_) } } 11:57
p6eval nqp: OUTPUT«␤»
moritz nqp: try { pir::die(pir::new__PS('Exception')); CATCH { say(pir::tyepof($_)) } }
p6eval nqp: OUTPUT«error:imcc:syntax error, unexpected PREG, expecting '(' ('$P1017')␤ in file '(file unknown)' line 156␤error:imcc:syntax error ... somewhere␤ in file '(file unknown)' line 170␤syntax error ... somewhere␤»
moritz nqp: try { pir::die(pir::new__PS('Exception')); CATCH { say(pir::typeof($_)) } }
p6eval nqp: OUTPUT«Exception␤»
11:57 JimmyZ joined 11:58 Alias joined
mls__ back from lunch... 12:06
gfldex perl6: sub test(Str $s){ say $s; }; my Str multi a(){ return "stringling" }; my Int multi a(){ return 9000 }; test(a()); 12:11
p6eval pugs: OUTPUT«stringling␤»
..niecza v8-10-g77bc5f0: OUTPUT«Unhandled exception: Ambiguous dispatch for &a␤ at line 0 (&a @ 0) ␤ at /tmp/OFoV4rI2vm line 1 (MAIN mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 1933 (CORE C906_ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 1934 (CORE module…
..rakudo 922500: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:()␤:()␤␤ in main program body at line 22:/tmp/9nNq78jk5M␤»
gfldex nom: sub test(Str $s){ say $s; }; my Str multi a(){ return "stringling" }; my Int multi a(){ return 9000 }; test(a());
p6eval nom: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:()␤:()␤␤current instr.: 'a' pc 592 ((file unknown):36813071) (/tmp/YMeagp5Hfw:1)␤»
gfldex looks like pugs wins in this case 12:12
moritz return types don't participate in MMD
no, it conforms to an outdate spec
gfldex what is the reason for that spec change? 12:13
moritz yes, computability
what if test() was a multi with one Int and one Str candidate?
gfldex it would be ambiguous and should trigger a nice error message 12:14
moritz multis make it impossible to determine what context a routine is called in
gfldex that makes the return type of a multi pretty much useless 12:16
flussence std: multi a(Int $) { ... }; multi a(Str $) { ... }; my $x; .?a($x); # probably doesn't work, just curious whether it did 12:19
p6eval std 516268a: OUTPUT«ok 00:01 123m␤»
flussence oh.
12:19 f00li5h left
flussence rakudo: multi a(Int $) { ... }; multi a(Str $) { ... }; sub b { 'str' }; .?a(b()); 12:20
p6eval rakudo 922500: ( no output )
flussence rakudo: multi a(Int $) { say 'int' }; multi a(Str $) { say 'str' }; sub b { 'str' }; .?a(b());
p6eval rakudo 922500: ( no output )
flussence rakudo: multi a(Int $) { say 'int' }; multi a(Str $) { say 'str' }; sub b { 'str' }; .?a(b()); say 'alive'
p6eval rakudo 922500: OUTPUT«alive␤»
flussence rakudo: multi a(Int $) { say 'int' }; multi a(Str $) { say 'str' }; sub b { 1234 }; .*a(b()); 12:21
moritz that doesn't do what you probably think it does
p6eval rakudo 922500: ( no output )
flussence I can see that :)
I'm surprised it's not a syntax error though
moritz it tries to call a method named 'a' on $_, which is Any
but since you say .?a, it doesn't error out when it can't find that method
flussence oh, makes sense.
would main{something-goes-here}.*a() work there? 12:22
rakudo: multi a(Int $) { say 'int' }; multi a(Str $) { say 'str' }; sub b { 1234 }; main::.*a(b());
p6eval rakudo 922500: OUTPUT«Could not find sub &main␤ in main program body at line 22:/tmp/2i1emIcEC_␤»
moritz flussence: what do you try to achieve? 12:23
flussence wondering if the .? .+ .* syntax would work on normal subs
moritz well...
nom: multi f(Real $x) { 'real' }; multi f(Int $x) { 'int' }; say 1.+&f 12:24
p6eval nom: OUTPUT«No applicable candidates found to dispatch to for 'f'. Available candidates are:␤:(Int $x)␤:(Real $x)␤␤current instr.: 'f' pc 476 ((file unknown):486) (/tmp/kkBgD0UTT7:1)␤»
moritz nom: multi f(Real $x) { 'real' }; multi f(Int $x) { 'int' }; say 1.&f
p6eval nom: OUTPUT«int␤»
moritz might be a bug that it doesn't work with .+
rakudo: multi f(Real $x) { 'real' }; multi f(Int $x) { 'int' }; say 1.&f 12:25
p6eval rakudo 922500: OUTPUT«int␤»
moritz rakudo: multi f(Real $x) { 'real' }; multi f(Int $x) { 'int' }; say 1.+&f
p6eval rakudo 922500: OUTPUT«===SORRY!===␤Cannot use .+ on a non-identifier method call at line 22, near ""␤»
moritz niecza: multi f(Real $x) { 'real' }; multi f(Int $x) { 'int' }; say 1.+&f
p6eval niecza v8-10-g77bc5f0: OUTPUT«===SORRY!===␤␤Modified method calls can only be used with actual methods at /tmp/8LskGshEdk line 1 (EOF):␤------> }; multi f(Int $x) { 'int' }; say 1.+&f⏏<EOL>␤␤Potential difficulties:␤ $x is declared but not used at /…
flussence well, at least the error messages are descriptive...
mls__ jnthn: gist.github.com/1118036 different version of patch, creates one "set" opcode less but also works 12:27
12:35 wtw left 12:39 icwiener left
gfldex if i have a function as a parameter, can i specify a