»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by sorear on 25 June 2013.
00:00 jaldhar left 00:01 jaldhar joined 00:02 Woodi left, Woodi joined 00:20 logie joined 00:25 logie left 00:36 raiph joined 00:46 dayangkun joined 00:55 FROGGS joined 00:57 thundergnat left 01:00 Chillance_ left 01:05 xilo_ joined 01:12 FROGGS_ joined 01:15 Chillance_ joined, FROGGS left
BenGoldberg rn: cwd.say 01:17
camelia niecza v24-86-g39ab531: OUTPUT«Unhandled exception: cwd may not be used in safe mode␤ at /home/p6eval/niecza/lib/CORE.setting line 0 (cwd @ 0) ␤ at /tmp/FpjaWRGa0g line 1 (mainline @ 3) ␤ at /home/p6eval/niecza/lib/CORE.setting line 4579 (ANON @ 3) ␤ at /home/p6eval/niecza/lib/CORE.…
..rakudo 567941: OUTPUT«/home/p6eval␤»
01:18 hypolin left 01:21 hypolin joined
BenGoldberg rn: enum E <A B>; A.pick.say 01:32
camelia rakudo 567941, niecza v24-86-g39ab531: OUTPUT«B␤»
BenGoldberg rn: enum E <A B C D E>; C.pick.say
camelia niecza v24-86-g39ab531: OUTPUT«===SORRY!===␤␤Illegal redeclaration of symbol 'E' (see line 1) at /tmp/elqXXYbwW1 line 1:␤------> enum E <A B C D E>⏏; C.pick.say␤␤cannot bind constant value at /tmp/elqXXYbwW1 line 1:␤------> enum E <A B C D E>[3…
..rakudo 567941: OUTPUT«B␤»
BenGoldberg rn: enum E <A B C D F>; C.pick.say
camelia rakudo 567941: OUTPUT«B␤»
..niecza v24-86-g39ab531: OUTPUT«A␤»
BenGoldberg rn: enum E 'E'; E.say 01:33
camelia niecza v24-86-g39ab531: OUTPUT«===SORRY!===␤␤Undeclared name:␤ 'E' used at line 1,1␤Undeclared routine:␤ 'enum' used at line 1␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 1502 (die @ 5) ␤ at /home/p6eval/niecza/src/STD.pm6
..rakudo 567941: OUTPUT«===SORRY!===␤Undeclared name:␤ E used at line 1␤Undeclared routine:␤ enum used at line 1␤␤»
BenGoldberg rn: enum E <E>; E.say
camelia rakudo 567941: OUTPUT«(E)␤»
..niecza v24-86-g39ab531: OUTPUT«===SORRY!===␤␤Illegal redeclaration of symbol 'E' (see line 1) at /tmp/l7fFE0F7_a line 1:␤------> enum E <E>⏏; E.say␤␤cannot bind constant value at /tmp/l7fFE0F7_a line 1:␤------> enum E <E>⏏; E.say␤␤…
01:42 raiph left 01:43 raiph joined
[Coke] updated gist.github.com/coke/5879701 01:50
nice new failure mode:nextsame/nextwith/callwith is not in the dynamic scope of a dispatcher
sorear nice 01:55
total errors are down?
timotimo huh, rakudo is still regressing? 01:58
on parrot?
sorear timotimo: where? 02:04
timotimo in the last few days os cokes updates
github.com/coke/perl6-roast-data/b...pass_rates - used to be 26020 on the third entry, now it's still on only 25717
anyway, i should be going to bed 02:05
[Coke] ~.
timotimo: there's no failures on rakudo.parrot - possible tests were removed or something. 02:07
timotimo yes, i didn't see that. in the skip column there was a bump 02:09
sorear mostly just the "plan" column falling 02:10
02:10 abnorman joined
JimmyZ hmm, when I typed nmake, I saw 'perl -MExtUtils::Command -e cp src/stage2/nqp.jar .' and similar things about 9 times once. 02:14
sorear JimmyZ: were you building nqp for the jvm?
JimmyZ yes
and saw 'perl -MExtUtils::Command -e mkpath src/stage2/gen' many times 02:15
sorear JimmyZ: does github.com/perl6/nqp/blob/master/t...VM.in#L330 look familier?
02:15 abnorman left
JimmyZ sorear: yes 02:16
sorear or: "Yes, it's supposed to do that"
JimmyZ nope, It's not suppoesed 02:17
sorear what do you mean?
JimmyZ sorear: gist.github.com/zhuomingliang/5897963 02:18
sorear: also 'perl -MExtUtils::Command -e mkpath src/stage2/gen' 02:19
sorear Oh, I thought you meant "9 times" as in "it copies 9 files"
JimmyZ :D 02:20
02:20 ggoebel joined
benabik I can do it. I will do it nine times. 02:21
02:26 dayangkun left 02:28 hypolin left, hypolin joined 02:35 mdxi joined 02:38 ManAmongHippos joined
ManAmongHippos Is there going to be a full fledged perl6 reference implementation? 02:39
02:40 hypolin left, hypolin joined
sorear ManAmongHippos: No, we use a reference test suite instead 02:44
[Coke] I doubt there will anything called a reference implementation. There are multiple implementations in progress, with rakudo being the most complete. 02:45
sorear ManAmongHippos: see github.com/perl6/roast/
[Coke] sorear++ # better answer.
ManAmongHippos Ok that answers my question. Thanks
[Coke] r: say (1|2)+(3|4) 02:46
camelia rakudo 567941: OUTPUT«any(any(4, 5), any(5, 6))␤»
[Coke] is there a way to flatten that to any(4, 5, 6) ?
flussence come to think of it, I've never seen anything computing related of this scale where a single group's produced both a solid spec and a good reference design. 02:47
sorear flussence: To be fair, we've produced quite a few bad reference designs 02:48
[Coke]: I don't think so 02:49
03:03 FROGGS_ left 03:22 xinming left 03:24 xinming joined 03:33 SamuraiJack_ joined 03:37 ManAmongHippos left 03:39 FROGGS joined 03:51 preflex_ joined, ChanServ sets mode: +v preflex_ 03:52 preflex left, preflex_ is now known as preflex 03:57 fridim__ joined 04:00 chayin joined, chayin_ left 04:15 FROGGS left 04:27 Psyche^ joined 04:32 Patterner left, Psyche^ is now known as Patterner 04:36 ManAmongHippos joined, ManAmongHippos left 04:41 FROGGS joined 04:48 birdwindupbird joined 04:53 ilbot_nextgen joined 04:58 konundra left 05:08 atroxaper joined 05:09 hypolin left, hypolin joined 05:18 lawrmcfa joined 05:19 lawrmcfa left 05:20 xenoterracide left 05:23 raiph left
segomos moritz: you around for a DBIish q? 05:28
05:29 xilo left
moritz segomos: yes-ish 05:36
segomos with the mysql portion i'm preparing a simple insert stmt and getting 'Any' as the errstr being returned for the statement..not even sure where to start debugging - i looked at DBDish BUILD and didn't see much there to try 05:37
moritz segomos: so, no error occured? 05:38
segomos doesn't appear to have occurred but the statement doesn't execute
moritz have you set RaiseError? 05:39
segomos yes
moritz segomos: can you show me the code?
segomos no error is caught and (try CATCH) and the $! variable is empty
moritz (which all indicates that no error actually happened)
segomos yea let me throw it up on a gist
:q 05:40
hugme hugs segomos, good vi(m) user!
segomos lol, sorry - gist.github.com/tony-o/5898608 05:43
i have user/password/database set properly in the script where i can successfully prepare/execute SELECT statements 05:44
and the db user has full privs
moritz but the entry isn't written? 05:45
segomos correct 05:46
moritz that's very weird
because I know I've successfully inserted many rows with pretty much the same code 05:47
maybe something broke recently :/
segomos: if you set up the credentials correctly in t/25-mysql-common.t (in the DBIish repo), do the tests pass? 05:48
segomos moritz: i'll check it now 05:49
05:51 FROGGS left
segomos moritz: yes 'All tests successful.' 05:52
05:52 abnorman joined, ecocode joined
segomos going to try 10- 05:52
05:59 fridim__ left 06:02 mstefanko left 06:05 Chillance_ left, kingbeast left
moritz segomos: are you quite sure you're checking the right database and right host when checking whether the row was written? 06:05
06:06 mstefanko joined
moritz 'cause when the tests pass, DBIish shouldn't be *that* busted that it doesn't even report an error 06:06
segomos yea - i think i have a problem with the way panda installed the lib. i'm getting kind of sleepy and fat fingering a bunch of stuff so i'm going to take a look in the morning but cloning your repo and running tests is passing and running the same tests against what's in my global @*INC is failing 06:07
06:07 ecocode left 06:08 abnorman left
segomos moritz: thanks for the leads 06:11
06:17 salv0 left 06:31 FROGGS joined
rs0_ is there a direct perl6 equivalent of while (<>)? 06:31
lizmat $file.lines as .lines is lazy 06:32
06:33 salv0 joined
rs0_ well, while(<>) reads from either stdin or from files given as script arguments 06:33
i don't know if there's a similar shorthand in perl 6. some ancient web page i found claimed that for =<> is a direct equivalent, but that didn't compile 06:34
sorear $*ARGFILES is a magical filehandle with the same behavior
you can do for $*ARGILES.lines { }
just for lines() { } might also work 06:35
FROGGS it does
morning btw
sorear yeah
(the parens are not optional in this case)
r: for lines() { .say } 06:36
camelia rakudo 567941: OUTPUT«Land der Berge, Land am Strome,␤Land der Äcker, Land der Dome,␤Land der Hämmer, zukunftsreich!␤Heimat bist du großer Söhne,␤Volk, begnadet für das Schöne,␤vielgerühmtes Österreich,␤vielgerühmtes Österreich!␤␤Heiß umfehdet, wild umstritten␤liegst dem Erdteil du inmi…
sorear ok, one more difference: lines() autochomps 06:37
rs0_ interesting stuff 06:38
sorear there was a = prefix operator in ancient versions of p6, but it was ripped out before I joined the project 06:39
rs0_ oh, something else i was wondering about was whether there is a perl6 equivalent of Java's @Override annotation, such that you get a compile-time error if a corresponding method cannot be found in the class hierarchy
sorear no
rs0_ i think i saw in the logs that someone was looking at adding that feature but i'm pretty sure he was doing it on spec 06:40
sorear would be relatively easy to add as a module though, if anyone's interested
"on spec"?
rs0_ on spec, made, built, or done with hopes of but no assurance of payment or a sale; without commitment by a client or buyer: ad illustrations done on spec; luxury homes built on spec and sold before completion.
06:41 hypolin left 06:42 hypolin joined, hypolin left, hypolin joined, hypolin left 06:43 hypolin joined 06:44 hypolin left, hypolin joined
BenGoldberg r: $*ARGILES.say 06:44
camelia rakudo 567941: OUTPUT«Dynamic variable $*ARGILES not found␤ in method gist at src/gen/CORE.setting:10477␤ in method gist at src/gen/CORE.setting:913␤ in sub say at src/gen/CORE.setting:11365␤ in method say at src/gen/CORE.setting:910␤ in method say at src/gen/CORE.setting:909␤ in …
rs0_ r: $*ARGFILES.say
camelia rakudo 567941: OUTPUT«Too many positional parameters passed; got 2 but expected 1␤ in method print at src/gen/CORE.setting:911␤ in method print at src/gen/CORE.setting:11545␤ in method print at src/gen/CORE.setting:11543␤ in method say at src/gen/CORE.setting:11557␤ in method say a…
sorear r: say ~$*ARGFILES 06:45
camelia rakudo 567941: OUTPUT«(Any)␤»
sorear r: say $*ARGFILES.gist
camelia rakudo 567941: OUTPUT«use of uninitialized value of type Any in string context in block at /tmp/lc8R9ZnYWQ:1␤␤IO::Handle<>(closed)␤»
BenGoldberg r: .say for $*ARGFILES 06:46
camelia rakudo 567941: OUTPUT«Too many positional parameters passed; got 2 but expected 1␤ in method print at src/gen/CORE.setting:911␤ in method print at src/gen/CORE.setting:11545␤ in method print at src/gen/CORE.setting:11543␤ in method say at src/gen/CORE.setting:11557␤ in method say a…
BenGoldberg r: .print for $*ARGFILES
camelia rakudo 567941: ( no output )
sorear probably because of the sandbox
also you should never pass a filehandle directly to print or say
the method might get confused and think you wanted to print *to* the filehandle 06:47
because someone thought it would be cute ~sigh~
FROGGS r: use Test; is (-4..-1 X+> 1..3), (-2,-1,-1,-2,-1 xx 8), ""
camelia rakudo 567941: OUTPUT«not ok 1 - ␤# got: '-2 -1 0 -1 0 0 -1 0 0 0 0 0'␤# expected: '-2 -1 -1 -2 -1 -1 -1 -1 -1 -1 -1 -1'␤»
FROGGS locally: # got: '-4 -4 -4 -3 -3 -3 -2 -2 -2 -1 -1 -1' 06:48
06:49 hypolin left, hypolin joined
BenGoldberg r: $*OUT.say('', $*ARGFILES, '') 06:49
camelia rakudo 567941: OUTPUT«use of uninitialized value of type Any in string context in block at /tmp/v_QvaacYs7:1␤␤IO::Handle<>(closed)␤»
BenGoldberg r: $*OUT.say('', ~$*ARGFILES, '')
camelia rakudo 567941: OUTPUT«(Any)␤»
sorear someday there's going to be a Perl6::BeLike::SOREAR module that permanently enables fatal, removes sink context and failures, hides the non-parametric multis for say, print, sort, makes for loops actually for loops, and anything else I think of >.> 06:50
FROGGS .oO( use Sanity; ) 06:53
rs0_ is this up to date? perlcabal.org/syn/ 06:54
FROGGS rs0_: I think so, yes 06:55
these pages should be autogenerated every hour
rs0_: ahh, scroll to the bottom and read the last line
BenGoldberg How is perl6's sink context different from !defined(wantarray()) in perl5 ? 06:56
rs0_ ah, i wasn't familiar with the mu repo 06:57
wasn't hard to find though
sorear FROGGS: i'm not mlehmann
FROGGS r: my $x = 1, 2; say $x 06:58
sorear i do not have the hubris to name a pragma common::sense. sorearish::sense maybe.
camelia rakudo 567941: OUTPUT«WARNINGS:␤Useless use of "," in expression "my $x = 1, 2" in sink context (line 1)␤1␤»
sorear std: my $x = 1, 2; say $x 06:59
camelia std d4cc5ab: OUTPUT«ok 00:00 44m␤»
sorear std: my $x = 1, $y = 2; say $x
camelia std d4cc5ab: OUTPUT«===SORRY!===␤Variable $y is not predeclared (declarators are tighter than comma, so maybe your 'my' signature needs parens?) at /tmp/wpkZubHoB0 line 1:␤------> my $x = 1, ⏏$y = 2; say $x␤Check failed␤FAILED 00:00 44m␤»
sorear r: my $x = 1, $y = 2; say $x
camelia rakudo 567941: OUTPUT«===SORRY!===␤Variable '$y' is not declared␤at /tmp/hbuMYayQo1:1␤------> my $x = 1, $y⏏ = 2; say $x␤ expecting any of:␤ postfix␤»
FROGGS BenGoldberg: it is not comparable much to P5 due to precedence
or the number of things of the lhs...
BenGoldberg r: my ($x, $y) = (1, 2); $y.say 07:01
camelia rakudo 567941: OUTPUT«2␤»
BenGoldberg goodnight 07:03
FROGGS gnight 07:07
07:08 BenGoldberg left 07:10 sqirrel joined, bbkr joined, bbkr left 07:16 lawrmcfa joined 07:17 xinming left 07:18 xinming joined 07:21 lawrmcfa left 07:22 hypolin left, domidumont joined 07:23 hypolin joined 07:25 xinming left 07:27 xinming joined
lizmat good morning #perl6! 07:40
r: my Int $a=1; $a=Nil # should this bomb? I think not? 07:41
camelia rakudo 567941: OUTPUT«Type check failed in assignment to '$a'; expected 'Int' but got 'Nil'␤ in block at /tmp/WCWcMsBHOY:1␤␤»
07:45 xinming left 07:46 domidumont left 07:47 xinming joined 07:49 domidumont joined 07:53 kaleem joined
moritz no; known NYI 08:01
08:04 xinming left
lizmat something in an .ACCEPTS that needs to be fixed? 08:04
JimmyZ nope, I think. It's compile time, not runtime 08:05
08:06 xinming joined
moritz assignment of $scalar = Nil should reset $scalar to its default value 08:06
but that default value isn't available at run time anymore
lizmat but default values are also NYI at the moment, right? 08:07
so the default value of a scalar *is* Nil at the moment, no? 08:08
moritz no
r: my $x; say $x
camelia rakudo 567941: OUTPUT«(Any)␤»
moritz the default value is Any
r: my Int $x; say $x; # the default values is Int
camelia rakudo 567941: OUTPUT«(Int)␤»
lizmat ah, in that ballpark: this seems odd
r: use Test; my Int @a=1,Nil,3; say @a.of; is( @a.of,'(Int)', "que? {@a.of}" ) # the test fails ? 08:09
camelia rakudo 567941: OUTPUT«(Int)␤use of uninitialized value of type Int in string context in block at /tmp/Kdx3Cc5ZAT:1␤␤use of uninitialized value of type Int in string context in sub is at lib/Test.pm:81␤␤not ok 1 - que? ␤use of uninitialized value of type Int in string context in sub …
lizmat because @a.of inside the test apparently is undef ?
while outside it *is?
08:10 crab2313 joined
nwc10 sorear: not totally. No-one seemed to realise that the question was "does gather/take on Rakudo on the JVM cause it to pass spectests that Rakudo on Parrot doesn't pass? If so, then it's false to assume that Rakudo on JVM can't pass more spectests than Rakudo on Parrot" 08:10
lizmat r: sub a (@a is copy) { say @a.of }; my Int @a=1; say @a.of; a(@a) # looks like "is_copy" loses type information, rakudobug? 08:11
camelia rakudo 567941: OUTPUT«(Int)␤(Mu)␤»
lizmat r: my Int @a; my @b=@a.clone; say @a.of; say @b.of # looks like .clone has the same problem, or *is* the same problem 08:12
camelia rakudo 567941: OUTPUT«(Int)␤(Mu)␤»
08:15 domidumont left
moritz (fwiw there are known problems with gather/take on parakudo) 08:15
08:15 domidumont joined
lizmat r: my %h; %h<a>=Nil; say %h.exists("a") # according to S02:2286, one could argue that assigning Nil to a hash element, would be deleting it 08:26
camelia rakudo 567941: OUTPUT«True␤»
lizmat TimToady: would you agree with that interpretation, and is this an NYI/rakudobug? or does this work as intended? 08:27
moritz wonders how that's supposed to work under the hood 08:28
lizmat as well, but that doesn't change the question :-) 08:29
actually, this could only work at compile time, as you cannot "keep" the value Nil in a variable, or can you? 08:31
moritz you can return Nil from a function 08:32
so not amendable to static analsys
08:35 daxim joined 08:37 Celelibi left 08:38 Celelibi joined
lizmat grrr, you're right, moritz++ 08:39
08:40 dakkar joined
dalek ast: f962b6d | (Elizabeth Mattijsen)++ | S02-types/undefined-types.t:
Added some more Nil related tests, mostly todo and skup atm
lizmat *skip :-)
08:51 domidumont left, domidumont joined 08:53 lelf``` joined 08:54 domidumont left, lelf`` left, crab2313 left, domidumont joined
masak good antenoon, me hearties. 08:56
08:56 raiph joined 08:57 hypolin left 08:58 fhelmberger joined, hypolin joined
masak .oO( you are all less than three to me! ) 08:58
tadzik so, I've been given 18446744073709551616 IPv6 addresses
masak ooh, 2**64 08:59
tadzik that's 2^64, so, if I count correctly, it's the current number of IPv4 addresses. Squared.
will be useful once I officially open my private earth
masak it will happen, you know it.
tadzik yep 09:00
DrEeevil tadzik: so you can use a new IP for every http request ;)
tadzik DrEeevil: you live up to your name :>
moritz has a /48 net
r: say 2**(128 - 48)
camelia rakudo 567941: OUTPUT«1208925819614629174706176␤»
DrEeevil tadzik: hey, fully dynamic DNS!
moritz and now I have separate IPv6 addresses for sites that I serve as virtual hosts over IPv4 09:01
tadzik I have a serious trouble imagining that it'll ever be useful
moritz so I use less than a dozen of those addresses :-) 09:02
tadzik ports are obsolete
moritz DNS doesn't resolve ports :-) 09:03
tadzik yeah :) How fun that'll be. ssh.tadzik.foo, http.tadzik.foo
moritz tadzik: at least you can now route packets to your army of nanorobots! 09:04
tadzik oh yeah! 09:08
moritz and when they attack, I'll counter with a DELETE on the RIPE database :-)
09:09 Celelibi left 09:10 Celelibi joined 09:13 mj41 left, dayangkun joined
dalek ast: 34ef6de | (Elizabeth Mattijsen)++ | S02-types/undefined-types.t:
Removed some bogus tests, added some more Nil related tests
jnthn morning, #perl6 09:17
lizmat morning jnthn!
r: my Int $a is default(1); say $a # this *should* say "a", right? 09:23
camelia rakudo 567941: OUTPUT«(Int)␤»
lizmat "1" I mean :-) 09:24
r: my Int $a is default(42); say $a # this *should* say 42, right?
camelia rakudo 567941: OUTPUT«(Int)␤»
moritz is 'is default' even specced?
lizmat S02:653
jnthn And is it meant to bind or assign? 09:26
Assign I guess...
lizmat "Any container's default may be overridden by the C<is default(VALUE)> trait."
jnthn Is that connected to Nil assignment? 09:27
lizmat "If the container's contents are deleted, the value is notionally set to provided default value; this value may or may not be physically represented in memory, depending on the implemention of the container.
jnthn ugh
Yeah, I keep ignoring implementing that on purpose.
Hoping it changes.
Sometimes this approach works. :)
lizmat it doesn't work for native types
jnthn Right, it can't. :) 09:28
It just means every single variable assignment needs to check this special case...
lizmat well, actually, it is specced to work for native types, as long as the default value can be represented
jnthn I guess it can be a type check failover...
lizmat jnthn: why would that be with every assignment?
I mean, we would need something special for Nil assigment 09:29
jnthn OK, every assignment we can't statically analyze. Which is the common case.
Yes, so you need to check, every assignment, if the thing on the RHS is a Nil.
lizmat ah, yes, but that hasn't got anything to do with "is_default"
jnthn As I said, that could happen because the assignment typecheck fails and then before throwing we say "oh, is it because it's Nil"?
Well, it has 'cus "is default" is where the default value comes from when Nil is assigned... 09:30
lizmat yup, and *then* check for any is default after we determine it was Nil
jnthn Right, it's the Nil check we'd need. But since it can be a type check fallback, it ain't so bad. 09:31
lizmat indeed...
jnthn wakes up a bit more and realizes that isn't the bit of type system cheating that bothers him.
lizmat what is? 09:32
jnthn The thing I absolutely do NOT want to allow is sub foo() returns Int { } to hand back a Failure. If we do that, we're utterly screwed.
lizmat wouldn't that work in a similar way then?
jnthn Well, the only way it can work is if we immediately throw the exception in the failure before it leaks out. 09:33
The problem is 09:34
moritz is for abolishing Failure anyway
jnthn foo(something-that-returns-Int())
moritz is dispatched to the foo(Int) variant, which unboxes
jnthn So, the optimizer sees Int, picks the multi-candidate for foo, says "oh, I can inline it and I can completely skip type checks too"
moritz boom
jnthn Then somebody gets upset because they get the "Cannot unbox Failure as a native int" they deserve.
Returning a Failure is fine...if you don't promise to return an Int. 09:35
masak right.
lizmat I guess the alternative would be to not let the optimizer pick multi-candidate at cimpile time :-(
jnthn Well, if we do that, we may as well forget Perl 6 ever being fast. 09:36
nwc10 jnthn: is there a test yet for foo(something-that-returns-Int()) ?
jnthn nwc10: I'd hope so :)
nwc10 ie, soething that tries to enforce sanity
lizmat will look, otherwise I'll add some
jnthn nwc10: Remember that infix:<+> (as in, addition) is an example :)
nwc10: Since all operators are function dispatches too.
r: sub foo() returns Int { fail 'oops' }; foo() 09:38
camelia rakudo 567941: OUTPUT«oops␤ in method sink at src/gen/CORE.setting:10485␤ in method BUILDALL at src/gen/CORE.setting:820␤ in method bless at src/gen/CORE.setting:761␤ in method new at src/gen/CORE.setting:746␤ in method new at src/gen/CORE.setting:744␤ in sub foo at /tmp/x7fHuBrsb…
jnthn r: sub foo() returns Int { fail 'oops' }; my $x := foo(); say 'ok'; 09:39
camelia rakudo 567941: OUTPUT«oops␤ in method sink at src/gen/CORE.setting:10485␤ in method BUILDALL at src/gen/CORE.setting:820␤ in method bless at src/gen/CORE.setting:761␤ in method new at src/gen/CORE.setting:746␤ in method new at src/gen/CORE.setting:744␤ in sub foo at /tmp/NXxeM295F…
jnthn Note it fails inside of sub foo in this case.
r: sub foo() { fail 'oops' }; my $x := foo(); say 'ok';
camelia rakudo 567941: OUTPUT«ok␤»
jnthn And it's fine with the type constraint gone.
nwc10 OK, specifically, is there a test that the error doesn't happen in the wrong place? 09:41
lizmat closest appropriate place I could find was t/spec/S06-signature/types.t, and it doesn't have any tests like that 09:46
09:46 dayangkun left 09:50 raiph left
lizmat so I'm looking at making my class X::TypeCheck::Assignment resume on assignment with Nil 09:53
so, would making a method "resume" or "resumable" in there do the trick? 09:54
jnthn No
lizmat should I look at something else to do ? :-)
jnthn That exception is thrown somewhere internals-y and ain't gonna be resumable.
But you can still probably fix it 09:55
I think the place to look is inside the container spec for Rakudo scalars
lizmat any particular files ?
jnthn After the type check fails, but before throwing an exception...
src/vm/parrot/guts/container.c or so, and there's a similar container-related .java for JVM too 09:56
masak .oO( "look inside the container spec" sounds like a kind of dumpster diving )
lizmat will see if I can make something of that
09:57 cognominal left, cognominal joined
lizmat so where is ->type_check defined? 10:01
jnthn Somewhere over in the nqp repo, iirc 10:02
Probably in sixmodelobject.[ch]
lizmat ok
jnthn That never throws, it only returns true/false
So it doesn't need changing; the change is to react if it's false.
lizmat ah, so not returning false on Nil as the RHS, is not the way ? 10:03
jnthn No, type_check should never lie. It's the low level thing. 10:04
It's the surrounding code that should cheat.
"Oh, you gave back false? Well, before throwing an exception, let's see if the RHS is Nil..."
lizmat jup
jnthn It's not a general type checking thing, it's a special case in assignment.
lizmat I guess "is default" would need to be known at this level then as well 10:06
so it can change the value to be asisgned
jnthn Yeah
That probably wants to live in container descriptor 10:07
lizmat is feeling completely out of her league now :-)
jnthn src/Perl6/Metamodel/ContainerDescriptor.nqp iirc 10:08
It's not a complicated object :)
lizmat says you :-)
jnthn I suspect the code you're looking at already accesses it, fwiw :)
lizmat trying to wrap my head around it 10:10
jnthn If it helps to know, a Scalar basically has a $!value for the value in the scalar, and a $!descriptor which points to a ContainerDescriptor containing the type, rw-ness, etc. 10:11
So it's really the "static aspects" of a scalar.
lizmat gotcha
10:20 fgomez left
lizmat jnthn: my progress so far: gist.github.com/lizmat/5899824 10:30
lines 41/42 in the gist are the pb for me now
jnthn lizmat: good start 10:31
value = cont->default;
desc->default, no? :)
See types.[ch] for how to cope with Nil
lizmat yup
ok, thanks
jnthn You may have to update container.h also to add ->default.
lizmat ok 10:32
jnthn We rely on P6opaque laying stuff out like a C compiler would. ;)
At least, in the cases when we are.
10:32 lelf``` left
lizmat can I have a struct element with name "default" in C? 10:36
tadzik I don't think so
jnthn No, it's a keyword
lizmat maybe better : the_defauilt ?
the_default ? 10:37
jnthn or that :)
tadzik I think the standard says that underscored things may be reserved in the future
see also: _Bool, or whatsitsname
lizmat I guess then I would have to rename the attribute as well, right ?
jnthn No
Names don't matter at all in C
It's all compiled down to offsets in memory. 10:38
lizmat ok, but it would have to be a PMC *, right ?
like value
jnthn Yes
PMC *the_default;
lizmat :-)
jnthn Note that you'll need to set it to something too :) 10:39
World.pm, see install_lexical_container or so
lizmat cool
jnthn Note that the real "default" handling will need some work. But for now, the Any or whatever can go in there
So my Int $x; ... $x = Nil; sets it to Int at least. 10:40
pmurias jnthn: it's not possible to serialize nqp subs?
jnthn pmurias: Hmm.
pmurias: There are some things that get code objects in NQP and some that don't...
lizmat if nqp::existskey(%cont_info, 'default_value') { # seems some support for default values is there already 10:41
jnthn I forget about how a Sub will be. I guess multi subs must get 'em so there's a place to hang the signature...
lizmat: Yes, that's the Mu/Any distinction.
lizmat: I do sometimes plan ahead a little :)
lizmat: It's probably already computing the correct thing to stick into the $!default you just added. :)
lizmat: At least, in the absence of an "is default" trait. 10:42
lizmat except it's called "default_value" here
jnthn Well, %cont_info is a compiler-internals hash.
It's not related to anything in the outside world.
It currently sets what ->value of the Scalar contains.
Thus the name. 10:43