Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2008-02-15

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:08 justatheory joined #perl6
00:19 Auzon joined #perl6
00:31 r0bby joined #perl6
00:36 bsb joined #perl6
00:37 lmg joined #perl6
00:38 lmg hello perls
00:38 * lmg bows gracefully
00:38 Auzon Hi.
00:39 lmg hi Auzon
00:39 lmg sup?
00:39 Auzon Not much. Just getting caught up with life :)
00:39 lmg heh. daytime at yours?
00:40 mncharity joined #perl6
00:40 * lmg <- GMT+1
00:40 Auzon GMT-6 here.
00:40 * lmg nods
00:40 lmg still some hours then for you
00:40 Auzon I had a rather busy week, and another one to come. This is one of my few days that I have somewhat free
00:40 Auzon Yes, true.
00:41 lmg was looking for help in #perl, but the folks are busy flaming.
00:41 eternaleye_ joined #perl6
00:41 Auzon Interesting, but ultimately not too useful :)
00:41 lmg pardon me. come again
00:42 * lmg is not a native english speaker
00:42 lmg oh, the flames you mean?
00:42 Auzon Yes
00:42 lmg well yeah. if I was bored, it would be a nice read
00:43 Auzon They are interesting. But it won't help you.
00:43 lmg not too helpfull tho if one's looking for hellp
00:43 lmg s/hell/hel
00:43 Auzon Yep
00:43 * lmg agrees with Auzon
00:44 lmg my problem is of noob type _and_ has nothing todo with perl6   a t  a l l
00:44 * lmg blushes
00:44 Auzon it's OK, we were all new once. I still am new compared to many others here :)
00:44 lmg I'd ask scott, but he's not on the mud.
00:45 lmg oh man, tell me.
00:45 lmg I write 10 lines with indenting and all... just works..
00:45 lmg perlmonks do -e
00:52 alester joined #perl6
01:12 rindolf joined #perl6
01:13 Zygo joined #perl6
01:14 Zygo joined #perl6
01:44 meppl good night
01:44 lmg you guys have karma here?
01:44 meppl say good night to me!
01:44 lmg Auzon++
01:44 lmg good night, sir.
01:44 meppl ;)
01:45 lmg quit finally so I can say mean things behind your back...
01:46 meppl haha
01:46 lmg ;) nighty night meppl
01:46 meppl ;)
02:04 mncharity TimToady: in STD.pm, does regex_quantifier need to be declared a token category?
02:04 mncharity (err, that was intended more as an fyi)
02:07 zakame joined #perl6
02:25 diakopter joined #perl6
02:26 TimToady joined #perl6
02:28 justatheory joined #perl6
02:32 diakopter (just in case the floods of 2007 recur)
02:34 Lorn__ joined #perl6
02:41 lmg left #perl6
02:41 zakame_ joined #perl6
03:05 alester joined #perl6
03:09 zakame__ joined #perl6
03:23 mncharity svn: PROPFIND of '/pugs/misc/red_STD': could not connect to server (http://svn.pugscode.org)
03:23 mncharity feather ill?
03:26 TimToady looks like
03:29 mncharity Juerd: fyi, ^^
03:32 mncharity slog, slog.  this is one looong grammar.  I'm about half way through first pass.  I didn't fully appreciate the impressive amount of work that has gone into STD.pm.  sigh.
03:34 mncharity anyone should feel free to contribute. :)   It's all in the same order as STD.  I'd much rather check and fix mistakes then code from scratch.  More collaborative and social that way. :)  so if anyone is bored...
03:35 wknight8111 i'm bored. what do you need?
03:35 lambdabot wknight8111: You have 1 new message. '/msg lambdabot @messages' to read it.
03:35 zakame joined #perl6
03:35 mncharity perhaps I should slap an ast and backend onto it, to make it more interesting, and provide more nitches for folks to contribute.
03:35 mncharity wknight8111: let's see...
03:36 wknight8111 why do i feel like this is going to be a huge list?
03:36 mncharity (I was just checking to see if svn was back:)  not :/
03:37 mncharity which kind of puts a crimp in it, at least short/instant term
03:38 mncharity my current exercise is going through src/perl6/STD.pm, which is the closest thing we have to an official grammar to perl6, and hand translating it into  misc/red_STD/std.rb, which is
03:38 wknight8111 oh, is svn down? I just started an update
03:39 wknight8111 red_STD, isn't that a ruby thing?
03:39 mncharity a runnable ruby version of STD.  current task is slogging through all of the STD, generating rough ruby (generally not worrying about generating Match()s).
03:39 wknight8111 (i'm not in on all the lingo)
03:39 wknight8111 ok
03:40 wknight8111 where are those two files? I don't seem to have a src/perl6/STD.pm
03:40 wknight8111 i don't appear to have that folder at all, unless I'm looking in the wrong place
03:41 wknight8111 is this still in the parrot svn at languages/perl6?
03:41 mncharity vision is to slog out the rest of STD into ruby, then step back and clean up the infrastructure a bit, do some spot checking that the right things are happening, and then do a second pass adding Match() generation.  At that point... (re, oh
03:41 mncharity not parrot.  all pugs.
03:42 wknight8111 oh, okay. that's why I don't have it here
03:42 mncharity http://svn.pugscode.org except... not at the moment.
03:43 wknight8111 well, then I'm SOL
03:44 wknight8111 the whole pugscode.org website appears to be down
03:44 mncharity At that point would have a real p6 parser.  A first most-real fast one, for some values of first and most real, depending on how far/fast TimToady's p5 version gets.
03:45 mncharity I'll be tempted to start slapping on an ast and backend (derived from kp6 and redsix) at some point, just because I don't know any way to really shake down the grammar without running it against pugs t/ .
03:46 mncharity *any other way
03:47 mncharity ah well, no hurry.  any future contributions most welcome.
03:48 mncharity wknight8111: thanks for the interest! :)
03:48 wknight8111 no problem, more where that came from
03:50 lambdabot joined #perl6
04:11 jjore joined #perl6
04:16 mncharity end of day.  g'night all &
04:20 RayMagini joined #perl6
04:44 Auzon joined #perl6
05:06 quaternary joined #perl6
05:09 quaternary joined #perl6
05:34 zakame_ joined #perl6
05:35 monomorph joined #perl6
05:42 zakame_ joined #perl6
05:50 stevan__ joined #perl6
06:38 zakame__ joined #perl6
06:54 reZo joined #perl6
07:33 zakame_ joined #perl6
07:38 penk joined #perl6
07:44 IllvilJa joined #perl6
07:53 iblechbot joined #perl6
07:56 qmole joined #perl6
07:57 zakame_ joined #perl6
08:03 moritz_ good morning
08:25 zakame__ joined #perl6
08:29 zakame joined #perl6
08:31 meppl joined #perl6
08:50 penk joined #perl6
08:52 baest joined #perl6
08:52 rakudo_svn r25728 | jonathan++ | [rakudo] Fix parsing of undef and make undef.WHAT return Failure. Bug report thanks to congnominal++.
08:55 dduncan joined #perl6
08:56 damianc joined #perl6
09:06 zakame joined #perl6
09:16 araujo joined #perl6
09:18 moritz_ Juerd: I restarted apache2, now the svn problems seems to be gone ;-)
09:34 drbean joined #perl6
09:39 rakudo_svn r25731 | jonathan++ | [rakudo] Make it so that if you say if $foo ~~ /pattern/ { ... }, then $/ is available inside the block.
09:40 zakame joined #perl6
09:46 dduncan left #perl6
09:48 rindolf joined #perl6
09:59 d4l3k_ joined #perl6
10:00 shachaf_ joined #perl6
10:01 shlomif joined #perl6
10:01 Lunchy joined #perl6
10:02 kolibrie joined #perl6
10:05 yahooooo joined #perl6
10:07 r0bby joined #perl6
10:07 Patterner joined #perl6
10:07 GeJ joined #perl6
10:07 pmichaud joined #perl6
10:07 peepsalot joined #perl6
10:07 nnunley joined #perl6
10:07 shachaf joined #perl6
10:08 peepsalot joined #perl6
10:09 zakame_ joined #perl6
10:19 pugs_svnbot r19916 | moritz++ | [STD] more perlhints
10:19 pugs_svnbot diff: http://dev.pugscode.org/changeset/19916
10:22 rakudo_svn r25732 | jonathan++ | [rakudo] Implement $0, $1 etc match variables.
10:24 moritz_ STD.pm allows 'given' <EXPR> <PBLOCK>'
10:24 moritz_ but what's the semantics of given $expression -> $foo { ... } ?
10:24 moritz_ is that like a lambda?
10:34 Lorn__ joined #perl6
10:40 ofer joined #perl6
10:49 cognominal_ what is $¢ ? I can't find it in the synopses
10:49 moritz_ I think it stands for "context"
10:49 moritz_ is there no documentation in STD.pm for it?
10:50 cognominal_ I have not yet searched STD.pm
10:50 cognominal_ it seems related to whitespace
10:51 cognominal_ ##  <?{ $¢ == $!ws_to != $!ws_from }>  in grammar.pg
10:51 cognominal_ so it must be true when we are after whitespace
10:56 riffraff joined #perl6
11:16 ruoso does the name of a private storage contains the sigil?
11:17 ruoso pugs: class A { has $!a; has @!a; method a($b) { $!a = $b }; method b {push @!a: $!a } method c { say $!a; say @!a;}; my $a = A.new(); $a.a(); $a.b(); $a.c;
11:17 exp_evalbot OUTPUT[*** ␤    Unexpected end of input␤    expecting ";" or "}"␤    at /tmp/zg1rHS5xJt line 2, column 1␤]
11:17 ruoso pugs: class A { has $!a; has @!a; method a($b) { $!a = $b }; method b {push @!a: $!a } method c { say $!a; say @!a;}}; my $a = A.new(); $a.a(); $a.b(); $a.c;
11:17 exp_evalbot OUTPUT[*** No such method in class A: "&a"␤    at /tmp/MZJW0NWpNg line 1, column 131-137␤]
11:18 ruoso pugs: class A { has $!a; has @!a; method a($b) { $!a = $b }; method b {push @!a: $!a } method c { say $!a; say @!a;}}; my $a = A.new(); $a.a(1); $a.b(); $a.c;
11:18 exp_evalbot OUTPUT[*** Can't modify constant item: VUndef␤    at /tmp/3yVoGlOID1 line 1, column 66-80␤]
11:18 ruoso pugs: class A { has $!a; has @!a; method a($b) { $!a = $b }; method b { @!a.push($!a) } method c { say $!a; say @!a;}}; my $a = A.new(); $a.a(1); $a.b(); $a.c;
11:18 exp_evalbot OUTPUT[*** Can't modify constant item: VUndef␤    at /tmp/vDQ6YFJ8uj line 1, column 67-81␤]
11:19 ruoso pugs: class A { has $!a; has @!a; method a($b) { $!a = $b }; method b { @!a.push($!a) } method c { say $!a; say @!a;}}; my $a = A.new(); $a.a(1); $a.c;
11:19 exp_evalbot OUTPUT[1␤1␤]
11:19 ruoso hmmm
11:19 smtms joined #perl6
11:20 ruoso pugs: class A { has $!a; has @!a; method a($b) { self!a = $b }; method b { @!a.push($!a) } method c { say $!a; say @!a;}}; my $a = A.new(); $a.a(1); $a.c;
11:20 exp_evalbot OUTPUT[1␤1␤]
11:20 ruoso considering self!a is a valid way of accessing a private attribute
11:20 ruoso I can only assume the sigil is not part of the attribute name
11:21 ruoso pugs: class A { has $!a; has @!a; method a($b) { self!a = $b }; method b { @!a.push($!a) } method c { say $!a; say @!a;}}; my $a = A.new(); $a.b(); $a.c;
11:21 exp_evalbot OUTPUT[␤␤]
11:22 ruoso that makes everything much easier..
11:23 ruoso TimToady, could you please just confirm me if the private attribute name contains or not the sigil?
11:25 ruoso and the twigil, for that matter...
11:35 blindfish joined #perl6
11:36 pbuetow joined #perl6
11:55 rindolf joined #perl6
12:28 monomorph joined #perl6
12:29 chris2 joined #perl6
12:55 rakudo_svn r25735 | jonathan++ | [rakudo] First cut at < > postcircumfix, so now you can write %foo<bar>.
13:01 sri_work joined #perl6
13:05 macae joined #perl6
13:05 cmarcelo joined #perl6
13:05 rakudo_svn r25737 | jonathan++ | [rakudo] Implement $<foo> syntax for getting at named captures.
13:12 ebassi joined #perl6
13:25 rhr_ dev.pugscode.org is down
13:29 Juerd Then fix it
13:29 Juerd :)
13:30 Juerd Oh, wait... That's my job
13:30 zakame joined #perl6
13:35 pugs_svnbot r19917 | ruoso++ | [smop/src-s1p/Object.pm] BUILDALL code also initializes the instance storage slots for every attribute.
13:35 pugs_svnbot diff: http://dev.pugscode.org/changeset/19917
13:36 ruoso and now Attribute have a "create_container" method that returns a proper container to be in the new slot
13:42 fridim_ joined #perl6
14:10 alester joined #perl6
14:35 zakame_ joined #perl6
14:36 rindolf joined #perl6
14:42 BinGOs joined #perl6
14:46 wknight8111 joined #perl6
14:53 ruoso @tell nothingmuch After our conversation, I realised it makes sense to have the HOW slot defined explicitly in p6opaque, so you can implement different MRO's and other meta-caracteristics...
14:53 lambdabot Consider it noted.
15:03 ruoso which would be the name for the default Perl 6 MetaClass?
15:06 TimToady the true name of a private storage location is $!x
15:07 TimToady if you say "has $x" it's like "our $x", it makes $x an alias to the true location
15:07 TimToady and then you can refer to it as either $x or $!x
15:07 TimToady but if you declare "has $!x" or "has $.x" you can only refer to it as $!x
15:08 ruoso ok...
15:08 TimToady because you haven't created an alias
15:08 ruoso but
15:08 ruoso what about $!a and @!a
15:08 ruoso is it allowed?
15:08 ruoso I mean... is the sigil part of the name?
15:08 ruoso or the name is a
15:08 TimToady yes
15:09 TimToady you can get collisions on the associated method name, but that's your fault. :)
15:09 ruoso hmmm
15:09 ruoso that makes things more complicated
15:09 TimToady same with $.x and @.x
15:09 ruoso because it will require the runtime to make a string replace in the attribute name when it's a public one
15:09 [particle1 my method x {};
15:09 [particle1 can be called as $!x(), so it might collide, right?
15:10 TimToady presumably.
15:10 [particle] can method x be called as $x() ?
15:11 TimToady no
15:11 [particle] ok.
15:11 ruoso nor can "has $!x" be called $x
15:11 [particle] ruoso: correct.
15:11 TimToady basically, you can be precise if you like, but method calls let you drop the sigil where it's unambiguous
15:12 [particle] so, can we say that my method x stashes the method in a private attribute?
15:12 ruoso I was counting on that (private class attribute)
15:12 ruoso but...
15:13 ruoso class A { has $!a; has @!a; my method a() {...} }.... what does self!a points to?
15:13 TimToady the method, since you overrode any autogen
15:13 ruoso but self!a wouldn't access a method
15:13 ruoso would access the attribute slot
15:13 TimToady and with the ambiguity it will probably refuse to autogen an accessor anyway
15:13 ruoso private access is non-virtual
15:14 ruoso there's no accessor... they're all private
15:14 TimToady I was using "accessor" loosely
15:14 [particle] just don't use "glob"
15:14 TimToady it's more like a sub call than a method call
15:15 TimToady except you still pass the invocant
15:15 ruoso what makes it more complicated is the fact that, as "has $.a" declares "$!a", I'll need to do a string replace during object initialization
15:16 ruoso unless I make this conversion at compile time
15:16 ruoso and turn "has $.a" into "has $!a; method a {...}"
15:16 [particle] has $.a allows you to call $!a, $.a, and $a. correct?
15:16 [particle] oops
15:16 [particle] "has $a"
15:16 TimToady not hte last
15:16 TimToady yes
15:16 [particle] ok. great.
15:17 ruoso can I consider it to be expanded at compile time?
15:17 [particle] also allows self!a and self.a
15:17 TimToady as long as you give error messages the user expects, and not your rewrite :)
15:18 ruoso "has $a" would be expanded to "has $!a; my $a ::= $!a; method a {...}"
15:18 ruoso and this way the attribute name would always be the private one
15:19 ruoso maybe I would need a "real name" and a "name" to keep track of things
15:19 TimToady well, you can't really do ::= on a has that doesn't exist yet...
15:19 TimToady it's an alias to the slot
15:19 TimToady not to a real variable
15:19 ruoso that was what I meant actually
15:19 TimToady just trying to be precise when I'm not trying to be loose :)
15:20 ruoso so, if ::= can't be used, what could be?
15:21 TimToady $a is just a macro that means $!a inside an instance
15:21 ruoso ah.. .ok
15:22 ruoso so it can all be done at compile time
15:22 TimToady probably
15:22 ruoso that solves me the string replace problem during runtime
15:23 ruoso I will expect all attributes to have a "private name"
15:23 TimToady moritz_, cognominal_: $¢ is the current immutable match state; $/ is a mutable user-visible match state copied out of $¢ whenever user code is run
15:24 TimToady gotta run; eye doc appointment...
15:24 TimToady bbl &
15:24 [particle] aye, doc
15:31 turrepurre joined #perl6
15:33 pugs_svnbot r19918 | ruoso++ | [smop/src-s1p/Object.pm] Attribute now have a "private_name" method.
15:33 pugs_svnbot diff: http://dev.pugscode.org/changeset/19918
15:52 * ruoso just realises that p6opaque will require 11 different lowlevel responder interfaces
15:57 ruoso plus the MetaClass responder interface
15:58 alester joined #perl6
16:06 justatheory joined #perl6
16:12 pugs_svnbot r19919 | ruoso++ | [smop] include/smop_oo.h contain the reference to the p6opaque RI and the Default MetaClass implementation
16:12 pugs_svnbot diff: http://dev.pugscode.org/changeset/19919
16:15 meppl joined #perl6
16:18 pugs_svnbot r19920 | ruoso++ | [smop] removing the Undef type definition.
16:18 pugs_svnbot diff: http://dev.pugscode.org/changeset/19920
16:27 rindolf joined #perl6
16:32 * ruoso had just rewrote the next major milestone in the ROADMAP. Now it's completely centered in having Object completely functional, take a look at http://www.perlfoundation.org/perl6/index.cgi?smop
16:32 lambdabot Title: SMOP / Perl 6
16:32 manfred joined #perl6
16:33 drbean joined #perl6
16:42 peeps[work] joined #perl6
16:43 tuxdna joined #perl6
16:43 tuxdna hi
16:45 tuxdna I have a query regarding parrot's src/oo.c:Parrot_remove_parent() interface
16:45 tuxdna does anyone has any idea of what it should do?
16:45 pugs_svnbot r19921 | ruoso++ | [smop] starting to implement p6opaque.
16:45 pugs_svnbot diff: http://dev.pugscode.org/changeset/19921
17:01 pugs_svnbot r19922 | ruoso++ | [smop] adding the constant identifiers for the HOW and REPR API
17:01 pugs_svnbot diff: http://dev.pugscode.org/changeset/19922
17:07 pugs_svnbot r19923 | ruoso++ | [smop] adding the constant identifiers for the methods and submethods in Object
17:07 pugs_svnbot diff: http://dev.pugscode.org/changeset/19923
17:15 [particle] tuxdna: hop over to irc.perl.org#parrot and repost
17:25 stevan_ joined #perl6
17:33 pmurias joined #perl6
17:34 pmurias ruoso: will the metadata part be shared between objects?
17:36 njbartlett joined #perl6
17:37 rindolf joined #perl6
17:39 zamolxes joined #perl6
17:39 Psyche^ joined #perl6
17:40 ruoso pmurias, the metadata will belong to the prototype
17:40 ruoso and therefore, will be shared among instances
17:42 pmurias nice
17:42 pmurias you should have the void* data pointer in SMOP__Object__BASE
17:42 pmurias * shouldn't
17:43 ruoso pmurias, that's a macro
17:44 ruoso it's defined in smop_base.h
17:44 ruoso oh.. wait...
17:45 ruoso what do you mean
17:45 ruoso ?
17:46 pmurias so of your object are SMOP_Object sized
17:46 pmurias others are bigger
17:46 ruoso I'm not sure I'm following
17:47 pmurias ruoso: it's hard to explain ;)
17:47 ruoso heh
17:48 ruoso ok... let's start from the beggining...
17:48 ruoso you're looking at the SMOP__Object definition
17:48 pmurias ruoso: sometimes you are passing a pointer to a bigger struct as a pointer to SMOP_Object right?
17:48 ruoso yes
17:48 ruoso most of the time, actually
17:49 pmurias and the data field exists to make all object two bytes each
17:49 pmurias ?
17:50 ruoso nope... it's there to make sure SMOP__ResponderInterface and SMOP__Object share a minimal structure
17:51 pmurias ruoso: i don't get it
17:51 ruoso but this actually may not be really necessary now...
17:51 ruoso the initial idea was that you could have objects that were subject to GC being RI at the same time
17:52 ruoso which means that the data the GC uses should be declared in both types
17:52 ruoso because for the GC, they're all SMOP__Object's
17:52 pmurias so what does the data pointer actually store?
17:52 ruoso depends on the responder interfaces
17:52 ruoso for instance...
17:53 ruoso every responder interface that uses the smop_lowlevel implementation
17:53 ruoso (which is the default GC)
17:53 ruoso keeps the refcount and rwlock in that field
17:54 ruoso in theory you can have a responder interface that is subject to garbage collection... having the data field there allows that...
17:54 ruoso the "constant identifier" on the other hand
17:54 ruoso stores the string in that field
17:55 pmurias ruoso: so data is the field for responder interfaces to keep their special stuff for each object they govern?
17:55 ruoso is *one* field to do that...
17:56 ruoso but not the only one...
17:56 ruoso it's the only one that is there for every object
17:56 ruoso which means that you don't need to define a custom type if that field is enough...
17:56 ruoso or in the smop_lowlevel case
17:57 ruoso it's the thing that all objects, independent of type, share
17:57 ruoso and where smop_lowlevel can implement the GC
17:58 ruoso I agree that there might be no need for it to be in SMOP__Object__BASE, it's probably worth trying to move it to SMOP__Object definition and see what happens
17:58 ruoso because at this moment all responder interfaces are not subject to GC
17:59 ruoso (geez... that was a weird english construct...) ATM no responder interfaces are subjcet to GC (looks better)
17:59 ruoso but I don't know if that possibility is something we should remove...
18:02 pmurias ruoso: it can always be removed later on
18:02 ruoso yeah... true...
18:11 [particle1 joined #perl6
18:17 meppel-san joined #perl6
18:18 turrepurre joined #perl6
18:30 pmichaud TimToady++   # saner handling of named unary and 0-ary subs
18:30 pugs_svnbot r19924 | ruoso++ | [smop] First sketch on the p6opaque C struct
18:30 pugs_svnbot diff: http://dev.pugscode.org/changeset/19924
18:32 pugs_svnbot r19925 | ruoso++ | [smop] First sketch on the p6opaque C struct -- small fix
18:32 pugs_svnbot diff: http://dev.pugscode.org/changeset/19925
18:35 [particle] joined #perl6
18:38 tuxdna joined #perl6
18:38 pugs_svnbot r19926 | ruoso++ | [smop] First sketch on the p6opaque C struct -- small fix
18:38 pugs_svnbot diff: http://dev.pugscode.org/changeset/19926
18:44 pugs_svnbot r19927 | ruoso++ | [smop] defining the struct for the lowlevel implementations of Array, Scalar, Array and List for each p6opaque member -- when you call $foo.^!can("bla"), it will return a lazy object that will iterate through all the methods that match.
18:44 pugs_svnbot diff: http://dev.pugscode.org/changeset/19927
18:47 ruoso now there's a serious amount of code to be written in p6opaque.c....
18:48 ruoso but at least it seems that there's no much to be defined, just code to be written
18:48 [particle] so now it's truly smop
18:48 ruoso heh
18:54 spinclad joined #perl6
18:59 ruoso TimToady, I was thinking about stack optimization and about optimizing a "return $a.b()" into a tail-call... The problem with that is that caller will refer to a different frame, and therefore, most of the time, the optimization cannot be done... It would be nice if there was a trait to be added to a routine, so the optimizer can know that this routine can be target to this optimization...
18:59 ruoso the user would know that this routine would be 'transparent' in the stack introspection...
19:01 ruoso but thinking better, if the user add the trait, he could do the tail call himself..
19:02 TimToady I'd say assume tail-call, but pessimize if you see caller()
19:02 ruoso the problem is that if I assume tail-call it will be too late when I see caller
19:02 ruoso or else there's no point in the optimization
19:02 TimToady huh?  you're the runtime.  you run after the compiler...
19:03 TimToady and the compiler sees "caller"
19:03 ruoso but the compiler can't know for sure
19:03 ruoso can it?
19:03 TimToady assume tail-call
19:03 TimToady caller is exceptional, and should not impair performance
19:04 ruoso so you could say that "caller must be called explicitly, or the stack is subject to optimization and the result may be unexpected"
19:04 ruoso is it?
19:05 TimToady we'll assume tailcall is okay in the absence of any evidence to the contrary, which might be explicit caller, or a trait that suppresses tail call
19:06 ruoso Ok... I'd suggest that to be extensively noted in the spec...
19:06 pmichaud let me try rephrasing
19:06 pmichaud when the compiler sees   $a.b()  , it can't really tell if b() uses caller or not
19:07 ruoso because b() might not even be there yet
19:07 TimToady yeah, I guess...
19:08 TimToady sorry, a bit distracted cooking...
19:08 pmichaud so it would normally pessimize to not use the tailcall.  either that or the compiler needs code at runtime to query b() and see if it's possible to use the optimized tailcall
19:09 TimToady seems like such a trait could hang off a proto
19:11 ruoso OTOH, one could think that tail-call is assumed, and that the current routine should mark itself as "stackfull" if it want to avoid being optimized out
19:11 ruoso I mean... it wouldn't depend on the call, but on where I am
19:11 ruoso and I could say... this routine is important in terms of stack, and should not be optimized
19:12 ruoso where all others would be subject to optimization
19:12 TimToady maybe one could store a tail-recursion bit somewhere that would at least give a warning: "caller bypassing optimized-out frame" only in English
19:12 PerlJam or you could just redefine caller() such that it might not return the call frame that you expect it to even if you're using caller(0)
19:13 PerlJam (IIRC, caller makes no guarantees beyond caller(0) anywya)
19:13 TimToady LEAVE blocks and such could also disable it
19:13 pmichaud I suspect it's generally possible to avoid a tail call altogether by not using an invocation as the argument to a return
19:13 TimToady but if fail would just end up propaging outward anyway, it's probably okay
19:14 pmichaud i.e., instead of   return $a.b()   write   FOO = $a.b();  return FOO    # for some appropriate FOO
19:14 pmichaud that avoids the tailcall without needing a special trait or pragma
19:14 ruoso pmichaud, I was thinking on a trait to that
19:14 ruoso sub foo is stackfull
19:15 PerlJam pmichaud: but that puts the burden of surprise on the programmer and he may not know enough to do that.
19:15 pmichaud well, "is stackfull" doesn't mean much to me
19:15 pmichaud i.e., looking at it I can't really tell what is intended
19:15 pmichaud PerlJam: correct, but it's approximately the same amount of surprise as a trait, I think
19:16 [particle] sub foo dont tailcall {}
19:16 ruoso hmm
19:16 ruoso sure... traits can have other verb
19:16 PerlJam pmichaud: true.  But it's eaisier to find info on a trait than some special arrangement of code that doesn't really have a name.
19:16 pmichaud pj: good point
19:17 ruoso but in fact... the only point of surprise would be on caller()... so if we have it documented, there's no surprise
19:17 TimToady the point is, if it doesn't matter, it doesn't matter.  if there's anything in the code that requires the pad to stick around, we keep it around
19:17 TimToady but the *possibility* of someone calling caller doesn't count for that
19:17 ruoso althought a "temp $var" does
19:18 TimToady that's one of the things that would disable it
19:18 TimToady because you have to do "leave" processing out of the ordinary
19:18 PerlJam TimToady: so, if static analysis of the code doesn't tell us whether caller is called or not, we assume not and optimize?
19:18 TimToady I think assume not
19:19 ruoso PerlJam, I would argue that caller would count on having previous things optimized, and the user must only be notified about it
19:19 TimToady most everything else, like context vars, gives some indication that a sub might want to fiddle with it
19:19 pmichaud I think I'd prefer not even to consider static analysis of the code in the caller case
19:19 ruoso me too
19:19 TimToady as I say, caller can at least know whether something was optimized out with a single bit somewhere
19:20 pmichaud i.e., we optimize to a tailcall, and toss a warning if a called sub uses caller in a place where it might not be appropriate
19:20 ruoso sounds fine to me
19:20 ruoso as long as this is extensively documented
19:20 TimToady if we document something extensively, they won't read it.  :/
19:20 pmichaud I agree
19:21 pmichaud it just needs to be documented and specced :-)
19:21 ruoso ok... the warning would include "see perldoc tailcall"
19:21 PerlJam ruoso: the warning should also spit out the contents of tailcall  piped through an appropriate pager  :-)
19:22 PerlJam with flashing READ ME lights all aroudn
19:22 ruoso heh
19:22 * ruoso wonders about the impact of that optimization in terms of performance...
19:22 pmichaud and it would also be nice if the warning could go back in time and undo the effects of the tailcall optimization, so that it acts as if it never happened.  And it should deposit something in my bank account.
19:22 TimToady that and $5 will get you a hamburger
19:23 pmichaud mmm lunch
19:23 pmichaud ruoso: which optimization -- the tail call or the checking on CALLER?
19:23 ruoso tail call
19:24 pmichaud in Parrot, at least, tail call optimization can be pretty impressive
19:24 ruoso In frameworks like Catalyst you see possible optimizations for that in almost all the code...
19:24 pmichaud in early versions of PGE on Parrot Leo was arguing to use tailcalls instead of branches and giving examples of the performance speedups
19:25 pmichaud (I pointed out the branches were still more efficient)
19:25 pmichaud but he did demonstrate some impressive speedups in tailcall vs. non-tailcall performance
19:26 awwaiid joined #perl6
19:26 ruoso and not to count on memory usage
19:26 ruoso that can be drastically removed in complex frameworks, like catalyst..
19:26 pmichaud right, for recursive tailcalls there's a big win in terms of memory usage as well
19:29 pmichaud afk, lunch
19:29 * ruoso home &
19:36 IllvilJa joined #perl6
19:44 rdice joined #perl6
19:49 buubot joined #perl6
20:03 rindolf joined #perl6
20:23 tuxdna left #perl6
20:32 [particle] pugs: my %a = (1,2); say pairs %a
20:32 exp_evalbot OUTPUT[1 2␤]
20:34 cognominal_ ok
20:34 cognominal_ pugs my @a = 1, 2; say @a
20:35 cognominal_ pugs:  my @a = 1, 2; say @a
20:35 exp_evalbot OUTPUT[12␤]
20:50 TJCRI joined #perl6
20:59 wolverian wow, someone has added facts about the ampersand's use in perl 6 to wikipedia's Ampersand page :)
21:15 feb left #perl6
21:37 Caelum joined #perl6
21:38 smtms joined #perl6
21:56 rdice joined #perl6
22:11 [particle] joined #perl6
23:16 Limbic_Region joined #perl6
23:24 meppl joined #perl6
23:24 Zygo joined #perl6
23:33 Helios joined #perl6
23:48 jferrero joined #perl6
23:53 meppl good night
23:58 Auzon joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo