»ö« 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.
[Coke] . o O (Colorado) 03:14
James-YeJ3TE48lO utf8 ทำงานดีไหมครับ 03:52
moritz p6: say 'ทำงานดีไหมครับ'.chars 04:48
camelia rakudo-{parrot,jvm,moar} 77024f, niecza v24-109-g48a8de3: OUTPUT«14␤» 04:48
lizmat finally made it to Brussels 06:16
lizmat .tell vendethiel-- please look at blog.timbunce.org/2010/07/16/java2p...d-whereto/ 06:35
yoleaux lizmat: I'll pass your message to vendethiel--.
FROGGS o/ 07:06
tadzik o/ 07:07
FROGGS reads blog.timbunce.org/2010/07/16/java2p...d-whereto/ 07:08
sergot morning o/ 07:14
masak a morn', a morn'! \o/ 07:36
<James-YeJ3TE48lO> utf8 ทำงานดีไหมครับ
why yes, James, it does.
it's our friend :) 07:37
James-YeJ3TE48lO Hehe, thanks. Do you read Thai?
FROGGS sort of... .chars is still wrong :o)
masak James-YeJ3TE48lO: Google Translate is also my friend ;) 07:50
James-YeJ3TE48lO Haha, thought as much. :) 07:50
masak "[...] we should note that the proverb about not putting all your eggs in one basket is *not* necessarily a sound engineering principle. The right answer depends on the margin of error and on the per-basket failure rate. It also greatly depends on the chance of correlated, uncorrelated, and anti-correlated basket failures. Sometimes the best way to get your eggs from point A to point B is to put them all in one basket and take really good care of that basket." 07:51
^ a really nice quote I just found at www.av8n.com/computer/htm/secure-random.htm
James-YeJ3TE48lO Yes, it's certainly true of security and crypto primitives. 07:51
masak James-YeJ3TE48lO: so you're calling in from .th? 08:01
James-YeJ3TE48lO Yes ใช่ครับ 08:04
masak :) 08:10
FROGGS jnthn: say we have a C struct that has a void * in it which will be represented as an OpaquePointer - how can we unpack that pointer later using a class? 08:27
FROGGS it seems we'd need parts of nqp::nativecall($!rettype, self, nqp::getattr(nqp::decont($args), Capture, '$!list')) 08:29
so this could become its own op: result = MVM_nativecall_make_cstruct(tc, res_type, dcCallPointer(vm, body->entry_point)); 08:31
jnthn FROGGS: I think it'll need some kind of nqp::nativecast or so 08:32
FROGGS (or the entirem switch statement, including int/Int/wahtever) 08:33
yes
sergot jnthn: what should we do if we have an function inside the struct?
FROGGS .oO( cry? )
sergot :)
jnthn sergot: Not immediately sure how we express that.
FROGGS jnthn: also, I'd like to see that OpaquePointer gistifies to: OpaquePointer<24982734>, so you see its mem address for debugging 08:34
FROGGS okay, who wants to implement nqp::nativecast(OpaquePointer, <Type>) ? :o) 08:35
arnsholt FROGGS: I don't really have the time to implement that ATM, but it should be pretty straightforward I think 08:44
Mostly a matter of hooking already existing functionality into a new op
FROGGS arnsholt: pssst, I wanna trick sergot in doing it :P 08:46
or I do it, should be a fairly small amount of work for one who has already implemented ops 08:47
arnsholt sergot: If your struct contains a function pointer, you'll have to implement support for function pointers first =) 08:49
FROGGS perhaps something can be stolen from how callbacks work? 08:50
sergot hmmm, I can try :)
arnsholt The existing callback stuff should have a fair amount of what's needed, yeah
But storable function pointers are a bit fiddly, 'cause it's not obvious (to me anyways) what kind of type they should have 08:51
sergot challenge accepted ;))
arnsholt The pointer type fiddling should be pretty straightforward though 08:52
(That's zavolaj #13, BTW =)
teodozjan hi, I would like to ask whether I'm the only person who has error while trying to compile parrot backend :) 09:00
xiaomiao teodozjan: I have encountered an error too 09:01
teodozjan: tried with 6.2-6.5 parrot, they all don't want to cooperate
teodozjan i've bisected it but i'm not sure it is real cause github.com/rakudo/rakudo/commit/f1...nt-6843467 09:03
jnthn That would be a very strange patch to casue such a failure, given it's mostly just adding an extra condition on whether to apply an optimization (and means we apply it *less*) 09:06
teodozjan maybe it triggered something faulty 09:09
masak ++sergot # function pointers 09:13
masak a function pointer has type Func[Param1, Param2, RetVal], no? 09:13
at least conceptually.
the same should hold for C. 09:14
smls "<FROGGS> sort of... .chars is still wrong :o)" -- I don't think it is 09:16
ดี and รั are two alphabet characters each: the bottom ones consonants, the top ones the vowels following them. 09:17
(If I remember correctly)
They just happen to be written on top of each other... :) 09:18
ทำ is different: The bottom left part is the consonant, and the right+top parts together are the vowel character. 09:20
FROGGS smls: I just selected the text using firefox, and it looked like as if there where two codepoint pairs that were combined
I counted 12 grapheme clusters by selecting the text
smls Well I don't know how Unicode defined chars, but that's how the Thai alphabet (as taught in Thai kindergarten) separates them 09:21
FROGGS and .chars should tell you the amount of grapheme clusters, which should be identical to the *visible* characters
vendethiel-- thanks lizmat 09:40
yoleaux 06:35Z <lizmat> vendethiel--: please look at blog.timbunce.org/2010/07/16/java2p...d-whereto/
vendethiel-- not related though :( 09:55
masak likes that today's topic seems to involve the Thai alphabet 10:18
masak a good friend of mine turns 32 today. 10:29
I went to Wikipedia and discovered that 32 is a happy number.
naturally, I had to implement a way to show this in Perl 6Ö
naturally, I had to implement a way to show this in Perl 6:
m: sub happy($n is copy) { $n = [+] $n.comb X** 2 until $n == 1 || (my %){$n}++; $n == 1 }; say happy 32
camelia rakudo-moar 77024f: OUTPUT«True␤»
masak it was easier than I thought.
jnthn eww, look at that state :D 10:30
masak note especially that it is *not in a .map* :P 10:31
jnthn :P
masak yes, that's just a matter of taste. 10:32
psch hi #perl6 o/ 10:45
vendethiel: did you see day 03 from the 2013 advent calender? it has an example for calling java.util.zip.CRC32 10:48
vendethiel psch: yeah, I saw it 10:49
colomon m: gist.github.com/colomon/fea0ec14fbf3ad02c5ed 10:50
camelia rakudo-moar 77024f: OUTPUT«gist not found»
psch vendethiel: but it didn't help? FWIW, the example doesn't even actually work for me.
vendethiel well, I don't even know how to link a jar for example 10:51
colomon masak: gist.github.com/colomon/fea0ec14fbf3ad02c5ed 10:52
vendethiel psch: also, I'm on p62014.03-parrot, sooo... :) 10:54
masak colomon: nice. 10:55
colomon: would 'is cached' work as well, instead of %memory ?
colomon masak: no, because of the %memory{$n} = False line
masak just saw that one.
well, it *feels* like an eminently memoizable problem, except for the fact that it sometimes loops infinitely. 10:56
colomon desperately wanted to make it is cached, mind you.
psch vendethiel: clog says you asked about "jvm libs from perl6-jvm" yesterday, that's what I was refering to... :) 10:57
vendethiel I mean, I can't test
colomon masak: gist.github.com/colomon/adf4d949d1835730ba65 11:03
masak: solutions keep getting longer and slower. time to stop and make breakfast
psch vendethiel: gist.github.com/peschwa/0158083bc4e5613a6390 # as an example; as it says, it doesn't quite work as-is 11:08
so it's probably not something that should be showed around
I don't understand the jvm compilation process (in general and for rakudo) enough to say why it's not enough to add the correct CLASSPATH 11:09
vendethiel m: say 'FOO1;2;3' ~~ / :r ^ 'FOO' $<id>=(\d) ** 3 % ';' $ / 11:18
camelia rakudo-moar 77024f: OUTPUT«「FOO1;2;3」␤ id => 「1」␤ id => 「2」␤ id => 「3」␤␤»
vendethiel m: 'FOO1;2;3' ~~ / :r ^ 'FOO' $<id>=(\d) ** 3 % ';' $ /; say $/<id>.list>>.ast; 11:19
camelia rakudo-moar 77024f: OUTPUT«(Any) (Any) (Any)␤»
vendethiel >>.Num it is then. 11:23
FROGGS right, there is nothing in the .ast (called .made now), as long as you don't 'make' anything
vendethiel m: my ($a, $b, *) = 1..*; say $a 11:38
camelia rakudo-moar 77024f: OUTPUT«===SORRY!=== Error while compiling /tmp/bUXHGDClqu␤Malformed parameter␤at /tmp/bUXHGDClqu:1␤------> my ($a, $b, ⏏*) = 1..*; say $a␤ expecting any of:␤ scoped declarator␤ formal parameter…»
vendethiel m: for ({a => 1}, {a => 50}, {a => 60}) -> $a { say $a } 11:40
camelia rakudo-moar 77024f: OUTPUT«{"a" => 1}␤{"a" => 50}␤{"a" => 60}␤»
vendethiel m: for ({a => 1}, {a => 50}, {a => 60}) -> $a { say $a<a> }
camelia rakudo-moar 77024f: OUTPUT«1␤50␤60␤»
ChoHag Does calling callsame twice do Bad Things? 11:40
moritz I sure hope not 11:43
ChoHag Just checking. 11:44
jnthn really can't remember how stateful iterating the candidate list is...
moritz m: class A { method x() { 42 } }; class B is A { method x() { say callsame; say callsame; } }; B.new.x 11:54
camelia rakudo-moar 77024f: OUTPUT«42␤Nil␤»
moritz bug (IMHO)
jnthn Not sure. 11:55
Can we change that without breaking lastcall?
moritz I have no idea
jnthn Hm, perhaps can 11:57
It'll involve more copying stuff, I guess...
ChoHag If I wanted to create a magic Int, how would I do it? Class MagicInt is Int { ... }? Then how can I create a MagicInt attribute which coerces an Int to a MagicInt? 12:00
masak submits rakudobug 12:02
awwaiid How does one choose between "my $x = {a => 1}" and "my %x = {a => 1}" ? 12:04
awwaiid and is that decision any different for a &x vs $x for storing a lambda? 12:04
moritz awwaiid: there are two answers (for the % case)
the first is that % does a type check, so if you want type checks, go with %
the second is that % flattens, and $ doesn't 12:05
awwaiid right, type check is a clear answer
ok, flatten, right
moritz the type check applies also to & variables (which don't flatten) 12:05
awwaiid what is a simple example of that type check happening? 12:06
moritz m: my %h := 42;
camelia rakudo-moar 77024f: OUTPUT«Type check failed in binding; expected 'Associative' but got 'Int'␤ in any bind_error at src/vm/moar/Perl6/Ops.nqp:217␤ in block at /tmp/XKGM0otdkw:1␤␤»
moritz oh, third point
moritz assignment to % variables is coercing 12:07
awwaiid oh yes, I always forget about :=
moritz m: my %h = a => 1, b => 2; say %h.perl; # the RHS is a Parcel, the LHS an array
camelia rakudo-moar 77024f: OUTPUT«("a" => 1, "b" => 2).hash␤»
moritz s/array/hash/
awwaiid ok, that helps. I'm giving my talk on Rakudo tonight, and during prep keep imagining some of these sorts of questions :) 12:08
masak awwaiid++ 12:31
vendethiel is trying to help his friend play w/ Java interop 13:19
It Works (TM) (but it's a bit ugly :P)
FROGGS vendethiel: coat it with sugar 13:39
vendethiel well, that's not easy
ChoHag Sugar makes you fat. 13:41
FROGGS ChoHag: there is nothing wrong with being fat 13:44
ChoHag Apart from heart disease.
And never stairs.
s/never//
ChoHag And summer insulation. 13:45
I tried being fat. Not doing that again. 13:46
FROGGS :o) 13:48
brrt wonders, and has decided not too, discuss the evidence on sugar-making-you-fat 14:12
FROGGS *g*
No! it is not the sugar that is making you fat! You eating it makes you fat! 14:13
:P
tadzik well, the law of energy conservation surely has something to do with getting fat 14:15
masak tadzik: and then there's that group that say "you can't apply *physics* to a biological organism like that!" 14:16
tadzik :) 14:17
masak tadzik: as if physics somehow ceased to apply inside bodies.
tadzik don't forget, there's the spiritual part that science can't explain 14:19
www.youtube.com/watch?v=HhGuXCuDb1U explained here
zengargoyle biology is on a sliding scale. if it were physics E=mc^2 and 1g of food would sustain many lifetimes. :P 14:33
moritz as long as you don't want to build muscles with that energy alone :-) 14:34
then you'd be limited to 1g of new body tissue :-)
zengargoyle if it were calories in vs out it would be easy. but it's also non-energy processes like all that non-calorie water you drink.
so like 1g of calorie food + 1kg of non-calorie water = ~.5kg fat 14:35
*bogus numbers*
brrt tadzik - and i'm with those people 14:39
Ulti plus plenty of stuff is energy dense but humans can't process it, plant fibre we burn it for fuel to heat a home but it does nothing going through you
ChoHag Are return signature types implemented? 14:39
moritz m: sub f(--> Int) { "str" }; f() 14:40
camelia rakudo-moar 77024f: OUTPUT«Type check failed for return value; expected 'Int' but got 'Str'␤ in any return_error at src/vm/moar/Perl6/Ops.nqp:598␤ in block at /tmp/HFhuHAVYBJ:1␤␤»
zengargoyle yeah, think it might be along the lines of we can only get energy from low total energy processes
moritz and that's good for us
zengargoyle otherwise we'd be prone to accidental explosion or something. :)
moritz aye
brrt zengargoyle - don't forget that drinking water at 15deg celsius needs to be 'heated' to 37 degrees celsius and thus actually costs energy 14:41
moritz thinks of a rod of burning Magnesia
zengargoyle maybe that's how vampires work. 14:41
ChoHag Where does the --> go wrt the rest of the signature?
moritz ChoHag: after them
ChoHag No comma?
moritz m: sub f(Int --> Int) { "str" }; f(52)
camelia rakudo-moar 77024f: OUTPUT«Type check failed for return value; expected 'Int' but got 'Str'␤ in any return_error at src/vm/moar/Perl6/Ops.nqp:598␤ in block at /tmp/NSk9TrUs8z:1␤␤»
moritz m: sub f(Int $x --> Int) { say $x; "str" }; f(52) 14:42
camelia rakudo-moar 77024f: OUTPUT«52␤Type check failed for return value; expected 'Int' but got 'Str'␤ in any return_error at src/vm/moar/Perl6/Ops.nqp:598␤ in sub f at /tmp/TqsVTPPQHY:1␤ in block at /tmp/TqsVTPPQHY:1␤␤»
mr-foobar hey all, want to try perl6 on the jvm on mac. any star release for it ? 14:45
moritz not yet 14:46
well, the last one contains the code for the JVM, but some of the modules don't work
mr-foobar anything I can do to test ? 14:47
i am interested in calling java from pl6 14:48
moritz I have no idea; I hope somebody else ( FROGGS? [Coke]? ) knows the current state and where to start 14:50
FROGGS there are issues as seen in the daily star build/test reports 14:51
mr-foobar oh, how about moarvm ?
star release ?
FROGGS moarvm is clean and can be released easily
mr-foobar one liner installers ftw ! 14:52
ChoHag How do I set up a coercion from one type to another? So that my Foo $bar = Baz.new can be made to work? 15:16
jnthn ChoHag: The Foo is a type *constraint*. The thing you assign has to match. It's not a coercion request. my Foo() $bar = ...; is the proposed syntax for a type that coerces to Foo. 15:26
sjn reminds that YAPC::EU talk submission deadline is July 1st (today) 15:31
jnthn :) 15:32
jnthn submat two talks :)
Only once in the last 9 YAPC::EUs did all my submissions get rejected, so I'm fairly hopeful one will make the cut. :) 15:34
masak submat one, ponders whether to do a second 15:36
colomon what will you guys' talks be on? (assuming you are allowed to make them) 15:37
ChoHag So if Baz is an existing class, can I create a role Foo which is automatically mixed into any Baz put into $bar? 15:39
Or do I just have to wait for my Foo() $bar to work? 15:40
psch m: class Baz { method baz { "baz" } }; my $bar = Baz.new does role { method foo { "foo" } }; $bar.foo.say # not quite the same 15:42
camelia rakudo-moar 77024f: OUTPUT«foo␤»
psch i don't think you can stick the (in this case anon) role onto the container itself 15:43
mr-foobar "legal issues as per freenode" 15:44
sjn colomon: mine is called "Creative Perlmongership" :) 15:46
colomon sjn++
sjn wonders if he should rather call it "Baeudacious Perlmongitude" or something like that 15:47
masak colomon: mine is called "GOTO considered awesome", and is about more or less insane applications of userland CPS transforms. 16:10
jnthn ChoHag: Have to wait, I suspect...though I'd also consider whether there's not a more elegant approach to whatever you're trying to achieve... 16:15
ChoHag Well in the immediate case I'm just trying to find new ways of breaking perl so that I can examine the pieces.
colomon masak++ # awesome 16:18
colomon remembers the bad old days of programming with goto….
jnthn oh, and talks... I submitted one about the performance work in Rakudo and MoarVM (including spesh), and another about the primitives Perl 6 provides for asynchronous programming. 16:19
colomon jnthn++ 16:20
colomon imagines the "jnthn surprise" for performance work could be disturbingly awesome... 16:21
carlin m: use MONKEY_TYPING; augment class Rat { method cieling { die "'i' before 'e' except after 'c', except where the sound is 'ee' and except where it's just plain weird" } }; say 4.2.cieling; 16:24
camelia rakudo-moar 77024f: OUTPUT«'i' before 'e' except after 'c', except where the sound is 'ee' and except where it's just plain weird␤ in method cieling at /tmp/NZpTbe6xYT:1␤ in block at /tmp/NZpTbe6xYT:1␤␤» 16:24
carlin that should be in core
or maybe I should remember how to spell ceiling
flussence m: say cieling 4.2 16:25
camelia rakudo-moar 77024f: OUTPUT«===SORRY!=== Error while compiling /tmp/AX0X_fzxRf␤Undeclared routine:␤ cieling used at line 1. Did you mean 'ceiling'?␤␤»
flussence it should probably do that for methods...
jnthn m: say 4.2.cieling
camelia rakudo-moar 77024f: OUTPUT«No such method 'cieling' for invocant of type 'Rat'␤ in block at /tmp/FBQC56Hl21:1␤␤»
jnthn Yeah, should be possible
ren1us out of pure curiosity, is there a particularly reason why lists don't seem to support deleting an element other than at the ends? 16:46
masak ren1us: .splice 16:47
ren1us I'll go back to my cave of being an idiot. Thank you. 16:48
carlin an idiot is someone who doesn't know something you learned yesterday :) 16:50
jnthn carlin: Do you know what I learned yesterday? 16:52
jnthn
.oO( darn, didn't fall for it :) )
16:55
carlin jnthn: I'll bite, what did you learn yesterday? 16:55
jnthn See, you don't know. :P 16:56
moritz => idiot :-)
jnthn :D
carlin heh
jnthn Sorry, was too good to resist. :)
carlin :) 16:57
carlin my point was ren1us++ now knows about .splice and is therefore no longer an idiot 16:59
see also: xkcd 1053 17:00
masak it's the people who never ask probing questions and never get interesting answers we should feel sorry for ;) 17:55
FROGGS jnthn: there? 18:00
FROGGS jnthn: the nativecast thingy works for some things now and I wonder... should that be available as a method on OpaquePointer? 18:02
like .cast-to(MyClass) ?
masak m: sub happy($n is copy) { $n = [+] $n.comb X** 2 until $n == 1 || (my %){$n}++; $n == 1 }; say happy 32 18:11
camelia rakudo-moar 77024f: OUTPUT«True␤»
masak m: say (sort gather for 2..8 -> $x { for $x..8 -> $y { take $x ** $y + $y ** $x } })[^10] 18:12
camelia rakudo-moar 77024f: OUTPUT«8 17 32 54 57 100 145 177 320 368␤»
masak ...I'm a little bothered by the two 8s in that code.
they're the lowest constant I can put there to get the right first 10 terms, but I found that through trial and error.
maybe someone can think of some code that doesn't involve them? :) 18:13
jnthn
.oO( 2..^9 )
18:14
masak actually, this reminds me of strangelyconsistent.org/blog/t2-sums-of-cubes
also, this could probably find quite an elegant (if longer) solution using Supplies. 18:15
dalek kudo/nom: e371c34 | (Elizabeth Mattijsen)++ | src/core/Method.pm:
Implement "is cached" on methods properly
18:42
lizmat is sorta back, but at the NLPM meeting
masak lizmat++ # 'is cached' on methods 18:44
colomon I dunno if I agree that's a proper fix or not. 18:45
was there more discussion on it on IRC after the initial disucssion yesterday? 18:46
masak oh, I didn't check the patch. 18:47
masak does so
using $self.WHICH is what I'd do, too.
so +1 on that.
the question I *didn't* ask yesterday -- but do now -- is: why are we not using .WHICH for all the parameters? 18:48
colomon If I understand it correctly, now it caches on WHICH instead of the value of the attributes of self
masak we should be using .WHICH for all kinds of hashing, right? and caching does hashing.
I don't think .gist is up to the task in general.
colomon masak: it seems to me (re self) there are two cases: 18:51
1) The object is immutable. In this case using .WHICH means we don't get possible caching when two different objects of the type have the same attribute values. 18:52
2) The object is mutable. In this case, using only .WHICH means we don't even notice when the values of the attributres have changed. 18:53
…. errrr .... 18:55
but wait, immutable objects with the same attributes are supposed to have the same WHICH, aren't they?
colomon So my objection #1 goes away 18:56
lizmat I was actually thinking about .WHICH as well, but that would have meant a recursive .WHICH implementation 18:57
lizmat is not completely clear yet: sleep depravation does that to you 19:01
lizmat also wonders whether she missed TimToady's ruling on the behaviour of: 19:03
my %hash = { a => 1 };
being the same as:
my %hash = ( a => 1 );
lizmat (which I think is wrong) 19:03
masak colomon: IMO, people shouldn't do 'is cached' on functions which take mutable arguments. 19:06
colomon masak: including classes which are mutable?
masak well, 'self' may be the exception here. haven't thought about it. 19:08
colomon self is what I'm talking about.
masak but I really don't think so.
if 'self' is an object which mutates, then we're in the same kind of trouble as if other params mutate.
lizmat ah, that would be the reason I used .gist :-) 19:09
masak IMO it's a case of "things *may* come out right, but really all bets are off if you have mutability"
lizmat supposedly, the .gist should reflect any changes to self
colomon right, if you don't care about mutable things, then .gist is maybe better than .WHiCH
masak so I vote for using .WHICH throughout and then conditioning users to dislike combining 'is cached' (or really any kind of hashing) with mutability. 19:10
colomon er,, or am I thinking about that backwards
masak that's really the only long-term sane option.
using .gist is going down the wrong road, trying to compensate for insanity which can't really be compensated for.
lizmat S06:2121: A given C<Capture> would always calculate the same return value. That is, there is no state hidden within the dynamic scope of the call. 19:12
synopsebot Link: perlcabal.org/syn/S06.html#line_2121
rurban src/gen/p-CORE.setting.pir:147823 fails with parrot (handler.'handle_types'(.CONTROL_LOOP_LAST) since some time. 19:13
rurban looks like the .CONTROL_LOOP_LAST nqp-p constants are gone on 19:14
lizmat actually, the spec indicates that we don't need special handling for "is cached" for methods 19:14
anyway, that's how I read it 19:15
FROGGS rurban: the constants were removed?
rurban I see them in nqp, but rakudo doesn't see them. 19:15
nqp/install/bin/parrot -o CORE.setting.pbc src/gen/p-CORE.setting.pir 19:16
error:imcc:syntax error, unexpected DOT, expecting '(' ('.')
in file 'src/gen/p-CORE.setting.pir' line 147823
FROGGS that sounds more like there is something bogus before that line
rurban It worked a week before YAPC
colomon masak: I think the biggest problem I'm having with your logic is I see .WHICH as a way of tracking mutable objects, whereas here you want to switch to using it while culturally banning using it in this context with mutable objects. 19:18
lizmat well, maybe we need a clearer spec, then :-) 19:20
colomon lizmat: I'd argue the specs there say we *have* to pay attention to mutable state.
or maybe not. 19:21
clearer spec++
lizmat is too tired to think straight about this right now
m: class A { has $.foo }; A.new(:foo<bar>).gist.say # makes me think a separate "is cached" for methods is wrong 19:28
camelia rakudo-moar 77024f: OUTPUT«A.new(foo => "bar")␤»
lizmat is going to revert 19:29
dalek kudo/nom: 71eab81 | (Elizabeth Mattijsen)++ | src/core/Method.pm:
Only implement things when sufficiently awake

This reverts commit e371c34206800c777fb7e06e11427acbd492a0f5.
19:30
colomon is not sure he understands lizmat++'s reasoning there
lizmat masak used the example with class A {} and two A.new's
TimToady .WHICH should never change on a mutable container, because it's container identity, not contents 19:31
lizmat if there are no attributes, the class A is in fact value based, as you the two objects have identical behaviour
rurban FROGGS: It's a problem in your 196b4ff55e "implement labeled loops and throwing of labels as payload"
lizmat TimToady: agree 19:32
colomon it seems to me that "is cached" should indeed be for logically non-mutable things. but … it's not clear me that set of things is the same as the set of things with stable WHICH 19:33
TimToady possibly 'is cached' should decontainerize, then it can base itself off of value identities 19:33
FROGGS rurban: ohh... but that was applied way earlier... 19:34
FROGGS looks
TimToady much like we can test a value for boolean without losing the object: if $x -> $obj { ... }
lizmat TimToady: do you mean on methods? or on subs? or both? 19:35
TimToady on any parameter that gets a mutable container rather than an imutable object
that is, 'is cached' should perhaps try for 'eqv' semantics, snapshotting the current value of containers 19:36
FROGGS rurban: is that a problem? handler.'handle_types'(.CONTROL_LOOP_LAST, .CONTROL_LOOP_NEXT, .CONTROL_LOOP_REDO, 512, 513, 514)
TimToady to put it another way, 'is cached' should probably pretend everything is passed by value rather than by reference
lizmat which is in a way what .gist in practice usually does ? 19:37
TimToady .gist should be considered completely unreliable for identity
"gist" means a summary
FROGGS but in a way .gist is also more about values 19:38
TimToady gist is designed to allow information loss, unlike .Str
lizmat so, more like .perl then :-)
assuming .perl can roundtrip with EVAL
TimToady well, currently .perl loses a heck of a lot of info as well 19:39
lizmat which breaks the roundtripping
but if roundtripping would work, would .perl be a good candidate for the cache key ?
rurban FROGGS: Yes. the problem is the seperation of Q:PIRT blocks for !$labels in MapIter.pm 19:40
I moved the handler to the local block, and now it works
moritz still thinks that .WHICH would make the best cache key
TimToady lizmat: it wouldn't be bad, though I tend to think of eqv semantics as dealing in serializations of a more dense nature
lizmat then perhaps the serialization of the structure should be the key ? 19:41
TimToady I believe I said something to that effect when it was first being worked on...but maybe I'm confabulating... 19:42
lizmat will need serialization before long for CURL::Installation anyway...
TimToady there is the possibility that someone would want to cache based on container identity rather than contents, but it feels like a marginal use case to me
FROGGS rurban: still weird that it breaks now 19:43
TimToady except for 'self', it should generally be clear from the parameter declaration whether reference or value semantics are intended 19:44
rurban FROGGS: Well, it has to bind the used .local pmc handler from the previous block for no good reason 19:45
TimToady so 'is cached' on a method would need either to declare the invocant explicitly as non-mutable, or we just force deep value semantics all the time, and let the people who want object identity write their own caches
FROGGS rurban: I'll rework that code then 19:46
rurban: thanks for hunting it down
lizmat tries to grok TimToady's words
TimToady or, another idea, 'is cached' keeps a separate cache in each object...
trouble is that self is naturally mutable 19:47
we assume it's declared 'is rw' basically
lizmat which is basically forcing self.WHICH, which I just removed :-)
TimToady so either we snapshot the object for eqv semantics (could be very expensive), or we assume they want shallow identity semantics, and each object basically keeps its own cache without considering its own attribute values 19:48
or we just say 'is cached' only makes sense on functions, not methods 19:49
lizmat unless the class has its own .WHICH (like Bag/Set/Mix)
that depends on the values of the attributes
TimToady yes, those are value types, not object types
(the immutable ones) 19:50
rurban FROGGS: gist.github.com/rurban/b64f609fdd3c78aeb79c
FROGGS: But it's still not working 19:51
TimToady lizmat: I'd be inclined to agree with you on my %hash = { a => 1 }; except that it's obviously an odd number of values, so it should either dwim or carp. 19:52
lizmat what would be DWIM? 19:53
flatten ?
TimToady assuming |
if you really want to put a hash in a hash, you can always say key => { a => 1 } explicitly 19:54
lizmat my %h{Any} = ( $%a, $%b ) # would that flatten ?
TimToady well, a list assigment will erase parens, so it's just like = $%a, $%b
but why would you write that if you meant: = $%a => $%b 19:55
lizmat m: my %a = a=>1; my %b = b=>2; my %h = ($%a, $%b); say %h.perl # so this is wrong?
camelia rakudo-moar 77024f: OUTPUT«("a" => 1, "b" => 2).hash␤»
FROGGS seems correct 19:56
TimToady looks correct by the dwim interpretation
m: my %a = a=>1; my %b = b=>2; my %h{Any} = %a => %b; say %h.perl 19:57
camelia rakudo-moar 77024f: OUTPUT«Hash[Any,Any].new({"a" => 1} => {"b" => 2})␤»
lizmat fwiw, that has always been a WAT to me
TimToady that looks correct too
and what you'd write if you really mean to map one hash to another 19:58
lizmat there is no ambiguity there because of the Pair
FROGGS is that Any,Any for k and v?
lizmat v is by default Any
TimToady indeed, so why would anyone write $ ever?
unless they were hoping a , would turn into a => magically? 19:59
lizmat m: my %h = <a 1 b 2>; say %h.perl # magic =>
camelia rakudo-moar 77024f: OUTPUT«("b" => "2", "a" => "1").hash␤»
lizmat so, yes, :-) 20:00
TimToady I don't think requiring => in the case of %h{Any} is terrible. 20:01
lizmat well, it feels like too much DWIM to me, and a big WAT 20:02
but if that's the way we're going to do this, then I can undo / change a bunch of tests that are waiting on a decision on this
TimToady m: my $a = set <a b>; my $b = set <c d>; my %h{Any} = $a, $b; say %h.perl 20:03
camelia rakudo-moar 77024f: OUTPUT«Hash[Any,Any].new(set("a","b") => set("c","d"))␤»
TimToady okay, sets behave like items, and don't autoflatted, which I think is good
lizmat m: my $a = bag <a b b>; my $b = bag <c d d>; my %h{Any} = $a, $b; say %h.perl 20:04
camelia rakudo-moar 77024f: OUTPUT«Hash[Any,Any].new(("a"=>1,"b"=>2).Bag => ("c"=>1,"d"=>2).Bag)␤»
lizmat and for Bags?
TimToady that also looks correct
lizmat so why would that not work for hashes like that ?
m: my $a = { a => 1 }; my $b = { b => 2 }; my %h{Any} = $a, $b; say %h.perl 20:05
camelia rakudo-moar 77024f: OUTPUT«Hash[Any,Any].new("a" => 1, "b" => 2)␤»
TimToady because people want to say my %a = %b; and have it work
lizmat but that would work...
because %b would flatten 20:06
jnthn Wow...lot of backlog... 20:06
TimToady well, as I said, we could also warn them on odd number of elements
lizmat my %a = $b;
it does, actually failes
*fails
m: my %h = 1 20:07
camelia rakudo-moar 77024f: OUTPUT«Odd number of elements found where hash expected␤ in method STORE at src/gen/m-CORE.setting:9423␤ in block at /tmp/VpApgRDoWF:1␤␤»
TimToady hmm, is a hash really expected there?
seems LTA
s/hash/hash initializer/ 20:08
jnthn Taht'd be better 20:08
dalek kudo/nom: 5613bea | (Elizabeth Mattijsen)++ | src/core/Exception.pm:
s/hash/hash initializer/
20:09
lizmat done
lizmat I think the current %c = $%a, $%b is inconsistent with: 20:18
m: my @a = <a b c>; my @b = <d e f>; my @c = $@a, $@b; say @c.perl
camelia rakudo-moar 77024f: OUTPUT«Array.new(["a", "b", "c"], ["d", "e", "f"])␤»
lizmat feels to me $%a, $%b is going to be a WAT that is going to be hard to explain to Perl6 newbies 20:19
like changing sigils
in p5
FROGGS so you say a $%a should not "flatten" into a pair? 20:25
lizmat indeed... $ itemizes
like with arrays 20:26
also visually:
m: my $a = { a => 1 }; my $b = { b => 2 }; my %h{Any} = $a, $b; say %h.perl
camelia rakudo-moar 77024f: OUTPUT«Hash[Any,Any].new("b" => 2, "a" => 1)␤»
lizmat seeing 2 scalars would lead you to expect automatic pairing
just because they happen to contain hashes, they flatten 20:27
lizmat m: my $a = [<a b>]; my $b = [<b c>]; my @a = $a, $b; say @a.perl 20:27
camelia rakudo-moar 77024f: OUTPUT«Array.new(["a", "b"], ["b", "c"])␤»
lizmat it does not flatten in this case
m: my $a = [<a 1 b>]; my $b = [<2>]; my %a = $a, $b; say %a.perl 20:28
camelia rakudo-moar 77024f: OUTPUT«("a 1 b" => ["2"]).hash␤»
lizmat I would argue that itemized hashes shouldn't flatten, just like itemized arrays don't 20:30
jnthn Yes, I'm surprised to see a { ... } or a $a flatten there too 20:32
I'd lean towards the my %h = { a => 1 }; whining 20:33
lizmat in case this wasn't clear, my stance is +1 20:34
jnthn Yes, I noticed we seem to be agreeing :)
lizmat decommute from NLPM meeting&
flussence m: sub infix:<÷>(\a, \b where * != 0) is pure { a / b }; say "whoops"; say 5 ÷ 0; # Is there any way to make things like this explode at compile time? 20:35
camelia rakudo-moar 77024f: OUTPUT«whoops␤Constraint type check failed for parameter 'b'␤ in sub infix:<÷> at /tmp/gM2I3dmYQz:1␤ in block at /tmp/gM2I3dmYQz:1␤␤»
FROGGS m: multi infix:<÷>(\a, \b) is pure { a / b }; multi infix:<÷>(\a, 0) is pure { die "ohh my gosh! }; say "whoops"; say 5 ÷ 0; 20:37
camelia rakudo-moar 77024f: OUTPUT«===SORRY!=== Error while compiling /tmp/czsTxVTth7␤Two terms in a row␤at /tmp/czsTxVTth7:1␤------> 0) is pure { die "ohh my gosh! }; say "⏏whoops"; say 5 ÷ 0;␤ expecting any of:␤ postfix␤ …»
FROGGS m: multi infix:<÷>(\a, \b) is pure { a / b }; multi infix:<÷>(\a, 0) is pure { die "ohh my gosh!" }; say "whoops"; say 5 ÷ 0; 20:37
camelia rakudo-moar 77024f: OUTPUT«whoops␤ohh my gosh!␤ in sub infix:<÷> at /tmp/CtyEGCJPw0:1␤ in sub infix:<÷> at /tmp/CtyEGCJPw0:1␤ in block at /tmp/CtyEGCJPw0:1␤␤»
FROGGS hmmm, no, that won't work as of now 20:38
I guess we will know that there is no candidate in near future 20:39
flussence (I'm not crazy for thinking it would work though, right?)
FROGGS maybe that just falls out of more inlining work?
jnthn cdn.memegenerator.net/instances/500...979488.jpg # lizmat++ :) 20:41
flussence: We don't attmept "where" constraints during compile-time type checking 20:42
They might do...well...anything
flussence ahh, ok
I had this vague idea of wanting code to fail early before any unwanted side effects, never thought about the possibility of that *causing* them... 20:43
vendethiel jnthn: they might, but you might know they won't :-) 20:44
that's probably something left for another tool, though
jnthn vendethiel: Yeah, if we can know they won't... :) 20:46
vendethiel jnthn: well, maybe with said is pure :)
FROGGS jnthn: github.com/jnthn/zavolaj/pull/44 20:51
jnthn FROGGS: Does this only work on Moar so far? 20:54
FROGGS uhh, yes, I forgot
there are others? *cough*
jnthn Well, my worry is "will it break the NativeCall build on others"... 20:55
Looking at the patch, I don't think it will
FROGGS maybe... I'll implement it for the others this night
dalek p/typevaropt: 78f5a7b | jnthn++ | src/vm/moar/QAST/QASTCompilerMAST.nqp:
Add typevar scope handling for MoarVM.

Uses op that indicates that the value is invariant with regards to the invocant type.
20:58
p/typevaropt: 39f25d9 | jnthn++ | src/vm/ (2 files):
On Parrot and JVM, for now typevar means lexical.
p/typevaropt: b4b2d6b | jnthn++ | src/NQP/Actions.nqp:
Start marking $?CLASS lookup with typevar scope.
p/typevaropt: 04bbf8c | jnthn++ | src/NQP/Actions.nqp:
One more place we can use typevar, not lexical.

This benefits !cursor_start, meaning that all the attribute accesses in it are now lowered to pointer operations. Le JIT will like this - once it can handle other things inside !cursor_start, anyway.
lichtkind jnthn: looks like START phaser doesnt work 21:19
masak lichtkind: extraordinary claims require extraordinary evidence. how do you know the START phaser doesn't work? :) 21:20
are you observing a failing test, for example?
FROGGS m: for ^5 { .say; START { say "WAT" } }
camelia rakudo-moar 77024f: OUTPUT«===SORRY!=== Error while compiling /tmp/Cms7syirsR␤Undeclared name:␤ START used at line 1␤␤»
lichtkind masak because i tested it
jnthn Isn't that spelt "once" these days?
FROGGS m: for ^5 { .say; once { say "WAT" } }
camelia rakudo-moar 77024f: OUTPUT«0␤WAT␤1␤2␤3␤4␤»
masak 'git grep START' on the spec turns up nothing. 21:20
lichtkind oh so its removed 21:21
masak ah, because fca7f5a90384693468e8df4698fedb5e5995c78e renamed it to 'once'.
lichtkind not ONCE ?
masak lichtkind: renamed, and made into a statement prefix.
no, 'once'.
because it's not a phaser, for some reason.
jnthn It's not really a phaser like the others
masak I think I see why.
jnthn Because it executes in the normal flow of control
masak it's not about moving the execution in time.
right.
makes sense.
and "START" for that was a really bad name, in retrospect :) 21:22
lichtkind allright so i have to update tablets
masak lichtkind: sorry to inconvenience your tables :P 21:27
tablets*
lichtkind: if you're interested in running updates to Perl 6 features, they can be found here: github.com/perl6/specs/commits/master 21:28
lichtkind i know just was away a bit 21:35
dalek blets: 95f94bc | (Herbert Breunung)++ | docs/appendix- (3 files):
phaser START gone and addedspurt to highlights
21:39
jnthn spurting is a highlight? :) 21:40
lichtkind jnthn: yes ther is a section of this 2 way io, there was prompt and slurp now added spurt 21:40
sound gay i know
jnthn: are modules now running on jvm port? 21:41
FROGGS lichtkind: many of them yes, but there are a few that do not and that are deps for others, so jvm-star is not there yet 21:45
lichtkind FROGGS: and not in july either? 21:52
FROGGS lichtkind: I can't tell because I don't know how hard these problems are
these might be just a bit too hard for me
psch FROGGS: is there a list somewhere? 21:53
(not that i think that FROGGS++ not being smart enough gives me high chances... :) 21:54
FROGGS psch: github.com/coke/rakudo-star-daily/...odules.log 21:55
psch: you have to keep in mind that I'm not even a good dev :o)
I just spend a lot of time here
masak 'night, #perl6 22:22
FROGGS night masak 22:23
zengargoyle is there a way to call whatever would have happened if you didn't have a BUILD submethod from within a BUILD submethod? 22:27
FROGGS zengargoyle: callsame?
zengargoyle if i read things right, bless only assigns new arguments to their public accessors if there is no BUILD 22:28
if you provide a BUILD, it reads like you have to handle *all* of your intitializaion 22:29
FROGGS correct 22:30
or you do your extra stutt and then call callsame, or was it nextsame?
zengargoyle i though callsame/nextsame looked for a method of the same name... 22:31
FROGGS well, yes
there is a method BUILD in Mu
zengargoyle Mu BUILD would already have been called.
BUILDALL goes from Mu down to your class. 22:32
FROGGS not if you provide your own BUILD method
err yes
well, no, what I said
zengargoyle BUILDALL walks all subclasses in reverse method resolution order (i.e. from Mu to most derived classes)
it seems bless() does like: if BUILD call BUILD else do magic auto assignment stuff 22:33
jnthn Well, it's BUILDALL that executes those things, not bless 22:34
zengargoyle it's bless that calls BUILDALL
oh, maybe not. maybe it's Mu.new that does bless then BUILDALL 22:35
Mu.new calls method bless on its invocant, passing along all the named arguments. bless creates the new object, and then calls method BUILDALL on it. BUILDALL walks all subclasses in reverse method resolution order (i.e. from Mu to most derived classes), and in each class checks for existence of a method named BUILD. If it exists, it is called, again passing all named arguments from method new to it. If not, the public attrib 22:36
zengargoyle i wish i could just fiddle with one or two arguments in a BUILD and let something else handle the rest that i don'n need to fiddle with. 22:37
if i have a BUILD, i have to change it if i add another attribute
lichtkind thanks FROGGS and all here 22:39
good night
FROGGS gnight lichtkind 22:40
lichtkind :)
psch m: class A { has $.foo; has $.bar; submethod BUILD(:$!foo, :$bar is copy) { $!bar = $bar + 2; } }; my A $a .= new(:foo(1), :bar(2)); $a.foo.say; $a.bar.say 22:44
camelia rakudo-moar 77024f: OUTPUT«1␤4␤»
psch zengargoyle: maybe i misunderstood what you want to do, but that seems to do it? i.e. bar can be changed in BUILD, foo doesn't have to
of course you have to update the signature; maybe that's what you meant 22:45
zengargoyle yes, you have to update in two places. :) 22:47
FROGGS rurban: I have a patch that builds: gist.github.com/FROGGS/7cf3c95f8c566a6aa545 22:49
rurban: I'll need for spectests though to be sure, so I'll probably apply right after $sleep 22:50
wow, a lot of fails already /o\ 22:51
FROGGS I'll bisect this tomorrow... that makes no sense this way 22:54