Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2007-10-16

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:05 theorb joined #perl6
00:14 pugs_svnbot r18435 | avar++ | [kp6-lisp] (kp6-dispatch array interpreter) not (kp6-dispatch
00:14 pugs_svnbot r18435 | avar++ | interpreter array), makes t/kp6/40-hash-keys.t pass
00:14 pugs_svnbot diff: http://dev.pugscode.org/changeset/18435
00:14 lambdabot Title: Changeset 18435 - Pugs - Trac
01:00 melissa joined #perl6
01:01 lyokato joined #perl6
01:04 BinGOs_ joined #perl6
01:06 daxim_ joined #perl6
01:14 pugs_svnbot r18436 | avar++ | Made &&, || and ?? svn st work again after adding an interpreter parameter to kp6-dispatch and dropping kp6-true, also indented some long concated code
01:14 pugs_svnbot diff: http://dev.pugscode.org/changeset/18436
01:14 lambdabot Title: Changeset 18436 - Pugs - Trac
01:18 BinGOs__ joined #perl6
01:23 pugs_svnbot r18437 | avar++ | [kp6-lisp] Make While work again, it was using kp6-true
01:23 pugs_svnbot diff: http://dev.pugscode.org/changeset/18437
01:23 lambdabot Title: Changeset 18437 - Pugs - Trac
01:38 * avar beats the lisp runtime
01:38 avar too much abstraction
01:40 BinGOs joined #perl6
01:52 mfh joined #perl6
01:53 mfh left #perl6
02:01 BinGOs_ joined #perl6
02:03 salzh joined #perl6
02:39 kanru joined #perl6
02:41 REPLeffect_ joined #perl6
02:43 jeffreykegler joined #perl6
02:55 jeffreykegler I'm looking for the BNF for Perl 6 rules.  Parrot has one, but I wonder if Pugs doesn't have a more up to date one
02:55 avar parrot has a BNF for it?
02:56 jeffreykegler Yes, somewhere under the PGE section of their code tree
02:56 amnesiac joined #perl6
02:56 avar pugs doesn't have one
02:58 jeffreykegler The parrot one is http://search.cpan.org/src/PARTICLE/par​rot-0.4.16/compilers/pge/P6Rule.grammar
02:58 lambdabot http://tinyurl.com/2bcvxp
02:59 avar that's not a BNF but the Perl 6 grammar
03:00 avar But the parrot one is probably better than the PCR/kp6 one in pugs
03:00 jeffreykegler Perl 6 grammars and BNF look very much alike
03:01 jeffreykegler ... and not by coincidence
03:21 mncharity jeffreykegler: there is another in...
03:21 jeffreykegler yes?
03:22 mncharity http://svn.openfoundry.org/pug​s/src/perl6/Perl-6.0.0-STD.pm
03:22 jeffreykegler Thanks!!
03:23 jeffreykegler left #perl6
03:24 mncharity np :)
03:24 weinig joined #perl6
03:25 weinig joined #perl6
03:50 justatheory joined #perl6
04:11 nekokak_ joined #perl6
04:55 lyokato joined #perl6
05:09 _go_ joined #perl6
05:11 weinig joined #perl6
05:12 REPLeffect_ joined #perl6
05:20 Ashizawa joined #perl6
05:27 jhorwitz joined #perl6
05:33 jisom joined #perl6
05:43 devogon joined #perl6
06:07 xinming joined #perl6
06:20 bsb joined #perl6
06:30 moritz_ the up-to-date URL is http://svn.pugscode.org/pugs/src/perl6/STD.pm
06:42 BinGOs joined #perl6
07:19 gorax joined #perl6
07:22 iblechbot joined #perl6
07:25 elmex joined #perl6
07:29 elmex joined #perl6
07:47 Aankhen`` joined #perl6
07:49 franck___ joined #perl6
08:18 meppl good morning
08:24 xinming joined #perl6
08:25 gorax joined #perl6
08:27 moritz_ godd morning meppl ;)
08:30 masak joined #perl6
08:38 dduncan left #perl6
09:04 cathya joined #perl6
09:30 IllvilJa joined #perl6
09:31 kst joined #perl6
09:35 pugs_svnbot r18438 | ruoso++ | [yap6] documenting how to call the autotools in INSTALL, as pointed by moritz++
09:35 pugs_svnbot diff: http://dev.pugscode.org/changeset/18438
09:35 lambdabot Title: Changeset 18438 - Pugs - Trac
09:37 moritz_ ruoso: should yap6 compile currently?
09:37 fglock joined #perl6
09:40 moritz_ make[2]: Entering directory `/nocrypt-home/moritz/pugs/v6/yap6/src'
09:40 moritz_ gcc -DHAVE_CONFIG_H -I. -I..    -Wall -g -O2 -MT const.o -MD -MP -MF .deps/const.Tpo -c -o const.o const.c
09:40 moritz_ In file included from const.c:3:
09:40 moritz_ yap6.h:25: error: expected specifier-qualifier-list before 'pthread_rwlock_t'
09:41 IllvilJa joined #perl6
09:42 ruoso moritz_, yep... it should
09:42 ruoso which OS is yours?
09:43 ruoso bette yet, which gcc version is it?
09:44 moritz_ gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
09:44 moritz_ which answers the OS question as well ;)
09:44 IllvilJa joined #perl6
09:46 IllvilJa joined #perl6
09:46 ruoso hmm
09:46 ruoso I'm using gcc 4.2
09:46 ruoso Debian too
09:46 ruoso maybe it's some syntax that is not supported by gcc 4.1
09:47 ruoso hmm...
09:48 ruoso moritz_, I'll try to get some help in ##c
09:52 lichtkind joined #perl6
09:52 ruoso moritz_, It looks like the symbol pthread_rwlock_t is not defined in pthread.h in your libc verson
09:53 ruoso could you grep for it in /usr/include/*.h?
09:53 Aankhen`` avar: I've decided to take a break from programming.
09:53 Aankhen`` (For as long as my willpower lasts. :-P)
09:54 ruoso moritz_, I've just commited a new version with another include, could you please try it
09:54 ruoso ?
09:54 pugs_svnbot r18439 | ruoso++ | [yap6] adding the include wich defines pthread_rwlock_t
09:54 pugs_svnbot diff: http://dev.pugscode.org/changeset/18439
09:54 lambdabot Title: Changeset 18439 - Pugs - Trac
09:54 moritz_ ruoso: it occurs in pthread.h, but not as a definition
09:55 ruoso moritz_, hmm... I just found out
09:55 ruoso I *must* include types.h
09:55 ruoso for it to work...
09:55 moritz_ do I need to regen configure before compiling?
09:55 ruoso moritz_, I've commited again
09:55 pugs_svnbot r18440 | ruoso++ | [yap6] using the correct header
09:55 pugs_svnbot diff: http://dev.pugscode.org/changeset/18440
09:55 lambdabot Title: Changeset 18440 - Pugs - Trac
09:55 ruoso no...
09:56 moritz_ good
09:56 ruoso simple make test should do it
09:57 moritz_ make clean; make; gives the same error
09:57 moritz_ r18440
09:58 ruoso hmhmhm...
09:58 moritz_ #if defined __USE_POSIX199506 || defined __USE_UNIX98
09:58 moritz_ # include <bits/pthreadtypes.h>
09:58 moritz_ #endif
09:58 moritz_ from sys/types.h
09:58 moritz_ do you define either of them?
09:58 ruoso nope...
09:58 ruoso brb &
10:02 moritz_ ruoso: I have a (non-production) server with etch where I can reproduce the problem... would you like a shell account there?
10:20 gorax joined #perl6
10:21 ruoso http://lists.debian.org/debia​n-user/2002/09/msg02931.html
10:21 lambdabot Title: Re: Woody: pthread_rwlock_t error
10:21 ruoso moritz_, seems related to that
10:23 pugs_svnbot r18441 | ruoso++ | [yap6] added -D_GNU_SOURCE as pthread_rwlock_t seems to be gnu libc related
10:23 pugs_svnbot diff: http://dev.pugscode.org/changeset/18441
10:23 lambdabot Title: Changeset 18441 - Pugs - Trac
10:23 ruoso moritz_, could you try this last version/
10:23 moritz_ ruoso: yes, trying...
10:24 moritz_ ruoso: now it compiles, thanks
10:25 ruoso :)
10:25 ruoso moritz_, thanks for the report :)
10:25 moritz_ and "All tests successful."
10:25 ruoso :)
10:25 ruoso fglock, could you test the last version in OSX?
10:25 ruoso make -f Makefile.cvs; ./configure; make test
10:25 fglock ruoso: testing
10:27 fglock "All tests successful"
10:27 ruoso :)
10:27 moritz_ GNU's c libs are a bit weird sometimes ;)
10:28 fglock but "warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type"
10:28 Aankhen`` It's C. :-)
10:28 ruoso fglock, yep... I saw that, and I still don't get it...
10:30 ruoso fglock, hmmm... i got it...
10:30 ruoso the thread function callback must return void*, not void... :)
10:31 moritz_ bah, just one char difference ;)
10:31 ruoso heh
10:32 pugs_svnbot r18442 | ruoso++ | [yap6] thread callback must return void*, not void
10:32 pugs_svnbot diff: http://dev.pugscode.org/changeset/18442
10:32 lambdabot Title: Changeset 18442 - Pugs - Trac
11:45 rindolf joined #perl6
11:49 f0rth joined #perl6
11:56 elmex joined #perl6
12:08 avar Aankhen``: my $sub = { say 5 + 5 };
12:08 avar I can then do:
12:08 avar (let ((code (kp6-cell-value (lookup-lexical-variable/c (kp6-generate-variable "$" "sub"))) ))
12:08 avar (apply (kp6-value code) |Main| (list)))
12:08 avar to have .() kinda work
12:08 avar which means I need to poke Code.lisp
12:15 thepler joined #perl6
12:24 cmarcelo joined #perl6
12:39 funktio joined #perl6
12:42 Caelum joined #perl6
13:04 gorax joined #perl6
13:11 fglock joined #perl6
13:37 rindolf joined #perl6
14:25 vbattsAtWork joined #perl6
14:45 pugs_svnbot r18443 | ruoso++ | [yap6] List destruction, List_ProxyScalar destruction, consts destruction, no leaks at the moment.
14:45 pugs_svnbot diff: http://dev.pugscode.org/changeset/18443
14:45 lambdabot Title: Changeset 18443 - Pugs - Trac
14:45 Jedai joined #perl6
14:46 drrho joined #perl6
14:48 kcwu joined #perl6
14:51 ruoso fglock, lists already destroy themselves... :) garbage collection is working ;)
14:51 ruoso if you compile enabling the -DYAP6_MEM_TRACE in Makefile.am you'll see all the process
14:53 fglock :)
14:53 ruoso make -f Makefile.cvs; CFLAGS='-DYAP6_MEM_TRACE' ./configure; make check; ./src/04_list.t
14:53 fglock still reading about stm ...
15:10 TJCRI joined #perl6
15:21 drrho left #perl6
15:22 ruoso considering the expression $A < $B... if $A is a String and $B is an integer... is the comparision goin to be made in string or int context?
15:22 moritz_ ruoso: < is num context
15:22 ruoso I would presume the left-hand operand ($A) would have precedence and stringify $B
15:22 ruoso ahmm
15:22 ruoso duhh
15:22 moritz_ le is string
15:22 ruoso of course
15:22 ruoso heh
15:22 * ruoso already with some C damage
15:24 avar $A.Int < $B.Int
15:26 * ruoso definitively already with C damage
15:26 ruoso :)
15:34 vbattsAtWork joined #perl6
15:36 funktio does anyone else think that it would be nice if $foo.chars returned an array in list context?
15:37 funktio then my @a = $foo.chars; would give a more intuitive result
15:39 avar $foo.split('')
15:41 avar .#chars and .chars ?:)
15:51 REPLeffect_ joined #perl6
16:02 PerlJam funktio: isn't it specced to do so?
16:02 funktio PerlJam: I don't know, actually
16:05 moritz_ PerlJam: $str.chars returns the number of chars in $str
16:06 PerlJam moritz_: even in an array context?
16:07 TimToady yes, even in list context
16:08 ruoso now that I fixed my brain damage... which are the native types that everything must be able to cast into? String, Int and Bool?
16:08 [particle] Num
16:08 ruoso yep yep... not Int, but Num...
16:09 amnesiac joined #perl6
16:09 ruoso any other?
16:09 TimToady It is not required that a Num cast be possible, I think
16:10 ruoso but string is?
16:10 Psyche^ joined #perl6
16:11 chris2 joined #perl6
16:11 TimToady It's good if an accidentally printed thing gives some indication of what it is
16:11 TimToady it's not required to give a complete value
16:12 ruoso sure...
16:12 TimToady see p5's CODE(0xdeadbeef) for instance
16:12 ruoso it's just a coercion
16:13 TimToady given interesting values of undef, I think the default Num coercion should probably be to one of those
16:13 TimToady fail "I don't know how to convert { self.WHAT } to Num" or some such
16:13 ruoso but...
16:14 ruoso that means $a < $b will fail if that thing isn't numifiable
16:14 wolverian at compile time hopefully
16:14 ruoso I like p5 concept that if it can't numify, then it's a zero
16:15 ruoso wolverian, we can't count on that...
16:15 PerlJam ruoso: good thing p6 does that too  :)
16:15 ruoso not for writing a runtime...
16:15 TimToady maybe there are interesting values of undef that just warn on usage
16:15 ruoso but the problem is that
16:16 ruoso $a < $b *will use* the value
16:16 ruoso so the warning *if* is pointless
16:16 wolverian ruoso, yeah. anyway, while str->num coercion is good, a failure in the coercion being silently ignored is something I've never used in perl 5, I think.
16:16 ruoso undef -> num is quite used
16:17 TimToady it's something you want to give some knob to turn to adjust it
16:17 TimToady certainly with hyperops we're not going to want to be exception happy
16:17 ruoso perl -we 'my $a; $a++;'
16:18 ruoso would that give a warning in P6?
16:18 TimToady no
16:18 TimToady but uninitialized is a different kind of undef in p6
16:19 TimToady doesn't mean that something went wrong, only that something has not yet gone right
16:19 TimToady all the "class" names are more in that category, so we call them protoobjects
16:19 wolverian ruoso, well I assume undef could numify to zero..
16:19 [particle] in perl 6, postfix:-- is magical too, right?
16:19 wolverian that's different from "a" numifying to zero, I think
16:19 TimToady supposed to be magical, yes
16:19 [particle] so, my $a; $a-- produces...?
16:20 TimToady error, probably.
16:20 [particle] okay.
16:20 TimToady there's no guarantee that -- is symmetric with ++
16:20 [particle] great. that's just what i was hoping for.
16:20 ruoso I don't get it... why wouldn't it be -1
16:20 ruoso ?
16:21 TimToady it could do that too
16:21 TimToady but I think the spec currently says error
16:22 ruoso that would certainly surprise me
16:22 TimToady errors are supposed to do that
16:22 ruoso heh
16:22 ruoso but... why?
16:23 ruoso why would it give an error?
16:23 TimToady you bend it and it snapped
16:23 justatheory joined #perl6
16:23 TimToady *bent
16:24 ruoso why wouldn't it numify the unintialized-undef and subtract 1?
16:24 perlmonkey2 joined #perl6
16:24 ruoso like p5 does
16:24 [particle] who's to say it's not Inf?
16:25 TimToady would depend on how fatal you're running, but default is to throw an exception on use of a Failure
16:25 TimToady you can be either more or less fatal than that
16:26 ruoso [particle], I know it's arbitrary... but it have been arbitrarly defined in p5 already...
16:26 TimToady for a spacecraft you might set everything to completely failsoft
16:26 wolverian I'm not convinced :)
16:26 ruoso me neighter...
16:27 weinig joined #perl6
16:27 ruoso I could agree that if you try to do my $a = some_sub_that_failed(); $a--; # it might give an error
16:27 xinming_ joined #perl6
16:27 ruoso it even should
16:27 PerlJam ruoso, wolverian: how about this:  because perl 6 is *different*   ;-)
16:28 ruoso heh
16:28 wolverian I meant I'm not convinced about the spacecraft :)
16:28 wolverian I can imagine failsoft would lead to eventual corruption of the state of the whole system
16:29 TimToady well, sure, even the softest pillow may have a hard floor under it
16:29 TimToady keep going down you eventually hit something solid
16:30 amnesiac uhm... pillow...
16:30 TimToady but we still give people options on how thick the pillow is
16:30 PerlJam I'd rather not hit something solid in a spacecraft, but rather gently land upon it.
16:30 wolverian and I appreciate it a lot, and think it's an interesting problem
16:30 [particle] you can't fool me. it's pillows all the way down!
16:30 moritz_ that's why you want to be on the outside of the spacecraft - the next hardest pillow is literally miles away ;)
16:31 wolverian I hope someone is logging search.cpan searches, because I just tried to find "charlie and the chocolate factory"
16:31 wolverian fingers--
16:32 szbalint hehe
16:32 moritz_ and did you find a suitable module?
16:32 TimToady and what happens after you do that 11 times?
16:32 szbalint it might get cached
16:32 szbalint :)
16:32 wolverian moritz_, no :(
16:32 TimToady I want the world, I want the whole world, I want it *now*!!!
16:33 szbalint hm, cache miss
16:33 szbalint :]
16:35 ruoso but getting back... Bool coerce is mandatory?
16:35 TimToady yes
16:35 Tene perhaps search results would be an interesting way to see what people are looking for but aren't finding.
16:35 ruoso at least my $a; if ($a) doesn't give an error ;)
16:35 TimToady even values of undef have a Bool coercion :)
16:36 [particle] my $a; $a-- if $a :)
16:36 TimToady .oO(bunch of scab pickers...)
16:37 moritz_ kp6: my $a; if $a { say "yes"; }
16:37 exp_evalbot r18443: OUTPUT[False␤]
16:37 weinig_ joined #perl6
16:38 TimToady kp6: my $a; list do { if $a { say "yes"; } }
16:38 exp_evalbot r18443: OUTPUT[DISPATCH: calling APPLY KindaPerl6::Runtime::Perl5::Dispat​chSugar::Dispatch=HASH(0x85c8b44) on invalid object:$VAR1 = {};␤␤ at compiled/perl5/lib/KindaPerl6/Runtime/Perl5/MOP.pm line 33␤   main::DISPATCH('undef', 'APPLY',
16:38 exp_evalbot ..'KindaPerl6::Runtime::Perl5::Disp​atchSugar::Dispatch=HASH(0x85...') called at - line 20␤]
16:38 [particle] *cough*
16:39 TimToady kp6: my $a; say (if $a { "yes"; } )
16:39 exp_evalbot r18443: OUTPUT[0␤]
16:40 TimToady kp6: say (if '' { "yes"; } )
16:40 exp_evalbot r18443: OUTPUT[0␤]
16:40 TimToady that should not be outputting a 0
16:40 ruoso that's probably a p5 value leaking...
16:40 TimToady in a list context the false if should return ()
16:41 ruoso ah
16:41 ruoso that
16:41 moritz_ TimToady: if the expression doesn't produce an output, it is re-run with ((...).perl).say around it
16:41 ruoso kp6 doesn't implement context yet
16:41 TimToady so you can use it to make list comprehensions
16:41 ruoso that's something I'm trying to do in yap6
16:42 TimToady okay, so it's printing the return value of the say, I guess
16:42 moritz_ TimToady: presumably, yes
16:42 ruoso nope... the return of the if
16:42 TimToady kp6: say ''
16:42 ruoso which is hmm
16:42 exp_evalbot r18443: OUTPUT[␤]
16:42 ruoso kp6: if (0) { }
16:42 TimToady hmm
16:42 exp_evalbot r18443: OUTPUT[False␤]
16:42 ruoso kp6: if ('') { }
16:42 exp_evalbot r18443: OUTPUT[False␤]
16:42 ruoso hm?
16:42 moritz_ I should patch exp_evalbot not to print OUTPUT if it isn't output...
16:42 ruoso kp6: (if ('') { })
16:42 exp_evalbot r18443: OUTPUT[False␤]
16:43 ruoso kp6: say (if ('') { })
16:43 exp_evalbot r18443: OUTPUT[0␤]
16:43 ruoso hmm
16:43 ruoso yep...
16:43 ruoso it's the return of say
16:43 ruoso but it's the evalbot, not the say itself
16:43 [particle] kp6: say
16:43 exp_evalbot r18443: OUTPUT[␤]
16:43 ruoso hmm
16:43 [particle] kp6: say False
16:43 exp_evalbot r18443: OUTPUT[0␤]
16:43 wolverian kp6: say False
16:43 exp_evalbot r18443: OUTPUT[0␤]
16:43 ruoso hah
16:43 wolverian [particle], damn you.
16:44 Tene kp6: False
16:44 exp_evalbot r18443: OUTPUT[False␤]
16:44 avar kp6: '' && "t" || "nil"
16:44 exp_evalbot r18443: OUTPUT[False␤]
16:44 avar kp6: say '' && "t" || "nil"
16:44 exp_evalbot r18443: OUTPUT[0␤]
16:44 ruoso avar, precedences are not right also...
16:44 avar kp6: say '' ?? "t" !! "nil"
16:44 exp_evalbot r18443: OUTPUT[nil␤]
16:44 ruoso or they are...
16:44 * ruoso confused now
16:45 ruoso yep... precedence is not right...
16:46 ruoso kp6: say ('' && 't' || 'nil')
16:46 exp_evalbot r18443: OUTPUT[0␤]
16:46 ruoso kp6: say (('' && 't') || 'nil')
16:46 exp_evalbot r18443: OUTPUT[nil␤]
16:47 TimToady moritz_> ruoso: < is num context
16:48 TimToady that's an oversimplification
16:48 moritz_ TimToady: then enlighten me ;)
16:48 TimToady it just dispatches to infix:<< < >>
16:48 TimToady and there is an exact match with (Num, Num)
16:49 TimToady otherwise (Any,Any) coerces
16:49 TimToady but any user defined operator can slip in between
16:49 BinGOs_ joined #perl6
16:49 TimToady and, although it is encouraged that it support "num" semantics, it's not required
16:49 ruoso so, $a < $b is not necessarly $a.num < $b.num
16:50 moritz_ TimToady: so what does the (Any, Any) multi do?
16:50 ruoso $a.lt($b)
16:50 ruoso ?
16:50 TimToady $a.Num < $b.Num, presumably
16:50 ruoso and fails if it doesn't support numification?
16:51 TimToady by default, yes, I expect
16:51 wolverian hum. I thought the dispatcher coerces.
16:51 ruoso fails here is a "die"?
16:51 ruoso a warn?
16:52 TimToady dispatcher never coerces
16:52 moritz_ I'd guess "fail"
16:52 ruoso if a warn, what is the result?
16:52 * ruoso trying to translate p5 context
16:52 TimToady if .Num returns a Failure, then you could define variants for (Failure, Num) etc
16:52 ruoso so (Failure,Failure) is false?
16:53 TimToady Failure < Failure is not defined currently, afaik
16:53 moritz_ multi dispatching operators... nice idea, really ;)
16:53 [particle] NaN
16:53 ruoso moritz_, tell that to the runtime
16:54 BinGOs_ joined #perl6
16:54 TimToady yes, a good argument could be made for returning NaN by default instead of Failure
16:55 ruoso NaN makes more sense... yes...
16:55 ruoso this would make everything numifiable
16:55 moritz_ ruoso: the compiler should do as much time inference at compile time as possible, and do the multi dispatch at compile time if possible as well
16:55 TimToady or some Failure variant that keeps all the juicy "where did things go wrong" details but otherwise behaves as NaN if coerced from Num to num
16:55 ruoso moritz_, which won't happen most of the time...
16:55 moritz_ ruoso: so that pure numerica comparisons will be cheap
16:56 [particle] NaN does Failure? vice versa?
16:56 ruoso something is Failure does NaN
16:56 moritz_ ruoso: you can view it as yet another challenage ;)
16:56 [particle] ruoso++
16:56 ruoso moritz_, it's just a matter that, for the common case (like, getting the element of a AoH) doesn't allows any compile-time inference...
16:57 ruoso the problem is that NaN is an instance of Num
16:57 ruoso not a Role
16:57 TimToady individual values are just considered maximally constrained subtypes, if it helps
16:58 ruoso hmnm..
16:58 ruoso so $a does 5 makes sense?
16:58 fglock is Failure but NaN   ?
16:58 moritz_ ruoso: unless you have an explicit type declaration for that AoH
16:58 TimToady True and False are both values and subtypes of Bool
16:59 ruoso moritz_, sure... I'm just saying that we can't count on that...
16:59 TimToady subtypes can function as "Just" types
16:59 [particle] Brilliant but True
16:59 TimToady normal types are "Maybe" types in p6
17:00 * ruoso can't actually visualize the instance composition in that case...
17:01 ruoso what would the Failure but NaN object look like? how would it be built?
17:02 TimToady a "but" doesn't have to do a composition if the mixed in interface is constant.
17:03 TimToady all that is required is that .Num return NaN when called on that object
17:04 Southen_ joined #perl6
17:04 barney joined #perl6
17:04 ruoso but how does it know which methods to mix?
17:04 TimToady NaN knows it's a value of Num, just as True knows it's a Bool
17:04 ruoso I mean... Num have other methods...
17:05 blindfish joined #perl6
17:07 TimToady well, you end up with a type something like Num.assuming(NaN:) so the generic instantiation can presumably optimize away any other possible values if it wants to get fancy
17:08 avar anyone know of a simple (numeric?) algorithmic problem I could try in kp6? I want to benchmark the mp6 and lisp backends
17:08 * ruoso can't think how to transport that to yap6
17:08 avar http://sial.org/pbot/28062 # this ends in deep recursion
17:08 lambdabot Title: Paste #28062 from Someone at 208.78.101.240
17:08 fglock ruoso: this can be implemented at the kp6 level
17:09 ruoso fglock, kinda...
17:09 moritz_ avar: what about iterative sqrt() computation?
17:09 ruoso because the data in the low level
17:09 ruoso needs to support this kind of context
17:09 avar moritz_: I'd have to implement sqrt() but sure, got code?:)
17:09 [particle] fibonacci?
17:09 moritz_ avar: wait a second...
17:09 avar [particle]: see my paste
17:10 ruoso if a value is a subtype... my $a isa Foo but $b is valid, right?
17:11 ruoso and $b can be anything, right?
17:12 ruoso how $a is composed?
17:12 pasteling "moritz_" at 89.13.152.193 pasted "iterative sqrt calculation in full p6" (13 lines, 184B) at http://sial.org/pbot/28063
17:12 moritz_ avar: that's in full perl6, but it should be trivial to port to  kp6
17:14 moritz_ actually I could do something like this to implement sqrt() in pure perl
17:17 avar uh, pre and post?
17:17 moritz_ avar: you can omit that
17:18 Aankhen`` Contracts?
17:18 moritz_ avar: it's just an example I used for a tutorial
17:18 pasteling "ruoso" at 82.154.252.25 pasted "Trying to understand how the object is composed..." (18 lines, 229B) at http://sial.org/pbot/28064
17:18 moritz_ avar: yes
17:18 Aankhen`` Assertions, I guess.
17:18 ruoso TimToady, could you take a look at the paste above?
17:18 moritz_ Aankhen``: if you do "design by contract" than an assertion is a "contract" ;)
17:19 Aankhen`` Yeah, but I figure DBC is simply fancy nomenclature specialized for OOP. ;-)
17:19 moritz_ Aankhen``: indeed ;)
17:19 moritz_ Aankhen``: but it's cool that assertions are inherited
17:20 Aankhen`` Def.
17:22 moritz_ I learned Eiffel a couple of year ago, and it's quite a cool language
17:22 moritz_ but the syntax suffers from bad huffmann coding
17:23 wolverian it felt completely overengineered for me
17:23 wolverian but that is possibly because of the syntax
17:23 TimToady ruoso: mixins clobber methodnames in superclasses, so .name would refer to Dog after the "but"
17:23 moritz_ wolverian: the librarires are bit overengineered, yes ;)
17:23 TimToady and you don't get an error on conflicts with mixins, which is why compile-time composition is preferred
17:23 moritz_ wolverian: but for bigger projects it's certainly a nice language
17:25 ruoso so, the but is kinda the same of does
17:25 TimToady does is really just but= I suspect
17:25 ruoso ah... ok...
17:26 avar pugs: 1e-8
17:26 exp_evalbot OUTPUT[1/100000000␤]
17:27 avar does p6 have lossless fraction calculations?
17:27 moritz_ avar: yes
17:27 TimToady though but may also enforce some value semantics where the objects might prefer not to be values
17:27 moritz_ avar: wait, pugs does
17:27 avar yay, more common lisp features:)
17:27 moritz_ avar: p6 not, I think
17:28 ruoso TimToady, for example?
17:28 avar moritz_: urgh, that would be lame:)
17:28 ruoso and wait... what kind of object is not a value?
17:28 avar Junction?
17:29 moritz_ avar: I think nobody will stop you from implementing it, as long as you still provide native floating points
17:29 fglock ruoso: containers
17:30 ruoso a container itself is a value that has another value
17:30 TimToady different responses to <=> and cmp
17:32 avar syntax error at position 211, line 14 column 49:
17:32 avar while (abs ($w * $w - $x) > $one_e_minus_8) {
17:32 avar ^ HERE
17:33 ruoso so... <=> sees if the value can Num, if not, tries to see if it's a junction?
17:33 TimToady avar: division of integers is allowed to keep result as Rat, see S03:673
17:34 ruoso and a Junction can't numify
17:34 ruoso except it you do a but
17:34 Psyche^ joined #perl6
17:34 ruoso is it right?
17:34 avar TimToady: not division of Rat?
17:34 avar CL-USER> (+ 5/9 3/4)
17:34 avar 47/36
17:34 * ruoso kinda-confused
17:35 avar pugs: 5/9 + 3/4
17:35 exp_evalbot OUTPUT[47/36␤]
17:35 TimToady ruoso> so... <=> sees if the value can Num...
17:35 TimToady no, that's inside out
17:35 apple-gunkies joined #perl6
17:35 TimToady the dispatcher pays attention to Num vs Junction.  the individual operators don't care
17:35 ruoso the object's dispatcher?
17:36 TimToady and only infix:<< <=> >>(Any,Any) coerces to Num
17:36 ruoso or the operator dispatcher?
17:36 TimToady MMD does not belong to any one class
17:37 ruoso but the implementation must be somewhere :)
17:37 pugs_svnbot r18444 | fglock++ | [kp6] added 'but' to grammar
17:37 pugs_svnbot diff: http://dev.pugscode.org/changeset/18444
17:37 lambdabot Title: Changeset 18444 - Pugs - Trac
17:37 ruoso I mean... it's in the <=> implementation
17:37 avar I thought the operatiors did $arg.Int or something
17:37 TimToady what is this "the" you keep mentioning?
17:37 avar that's how MOP works in kp6, you need something you request it
17:38 TimToady there can be many implementations of <=>
17:38 ruoso TimToady, by "the" I mean "the set formed by the MMD options"
17:38 avar oh you mean based on multis?
17:38 avar nevermind
17:38 avar http://dept-info.labri.fr/~strandh/features.text
17:39 TimToady multiple dispatch is actually more fundamental to P6 than single dispatch
17:39 TimToady single dispatch can be viewed as a degenerate case
17:39 avar fglock: is the reason you wrote your own object system instead of piggy-backing on the p5 one that you can't really create classes at runtime?
17:39 ruoso avar, the p5 classes can't implement all the context of p6
17:40 avar which part?
17:40 * ruoso still have to find out how to bootstrap the introspection in yap6
17:40 fglock avar: several reasons, except for performance
17:40 avar fglock: can you elaborate? some of them might apply to clos
17:41 ruoso lexical classes
17:41 ruoso mmd
17:41 ruoso composition
17:42 fglock avar: I think the p6 object system mostly map to CLOS
17:42 Aankhen`` …delegation?
17:42 TimToady fglock: but not multiple dispatch
17:43 Aankhen`` …parallel dispatch?
17:43 Aankhen`` …submethods?
17:43 avar fglock: and do you know why http://sial.org/pbot/28065 fails to compile?
17:43 lambdabot Title: Paste #28065 from Someone at 208.78.101.240
17:43 ruoso is comparing 'HOW' an possible way of seeing if two objects are of the same type?
17:43 Aankhen`` …customized constructors?
17:43 Aankhen`` ruoso: Doesn't HOW return the metaclass?
17:43 TimToady ruoso: no, that only tells you if they have the same metaobject instance
17:43 moritz_ ruoso: why not .WHAT?
17:44 Aankhen`` avar: Last line of &abs, perhaps.
17:44 ruoso Could anyone give me a hint on how to do that in yap6?
17:44 Aankhen`` Might need more parentheses.
17:44 * moritz_ is just spilling bullshit tonight and should shut up
17:44 ruoso I need to bootstrap the introspection
17:44 Aankhen`` ($num < 0) ?? -($num) !! $num; # try that
17:45 avar no it's:
17:45 avar syntax error at position 212, line 14 column 48:
17:45 avar while (abs($w * $w - $x) > $one_e_minus_8) {
17:45 avar ^ HERE
17:45 ruoso http://svn.pugscode.org/pugs/v6/yap6/src/yap6.h
17:45 TimToady bbl &
17:45 ruoso that's the data structure I'm working on
17:45 Aankhen`` The error messages in KP6 are… a tad misleading at times.
17:45 Aankhen`` But if that is indeed the point, try throwing some parentheses into the &abs call.
17:46 Aankhen`` abs(($w * $w) - $x) > $one_e_minus_8)
17:47 avar nah, stiff fails
17:47 avar while ((abs(($w * $w) - $x) > $one_e_minus_8)) {
17:47 avar $w = 0.5 * ($w + $val / $w );
17:47 avar };
17:47 avar *still
17:49 Aankhen`` Add more parentheses in the $w = ... line?
17:49 moritz_ is abs() implemented?
17:51 moritz_ kp6: sub abs($a){ $a < 0 ?? (-1)*$a !! $a }; say(abs(3))
17:51 exp_evalbot r18444: OUTPUT[error in Block at compiled/perl5/lib/KindaPerl6/Grammar/Sub.pm line 362, <> line 1.␤Bareword found where operator expected at - line 2, near "* Syntax Error"␤     (Missing operator before Error?)␤syntax error at - line 2, near "* Syntax Error in "␤Illegal declaration of subroutine
17:51 exp_evalbot ..main:: at - line 2.␤]
17:51 moritz_ kp6: sub my_abs($a){ $a < 0 ?? (-1)*$a !! $a }; say(my_abs(3))
17:51 exp_evalbot r18444: OUTPUT[error in Block at compiled/perl5/lib/KindaPerl6/Grammar/Sub.pm line 362, <> line 1.␤Bareword found where operator expected at - line 2, near "* Syntax Error"␤     (Missing operator before Error?)␤syntax error at - line 2, near "* Syntax Error in "␤Illegal declaration of subroutine
17:51 exp_evalbot ..main:: at - line 2.␤]
17:56 pugs_svnbot r18445 | fglock++ | [kp6-perl] 'but' implementation; needs more work
17:56 pugs_svnbot diff: http://dev.pugscode.org/changeset/18445
17:57 lambdabot Title: Changeset 18445 - Pugs - Trac
17:57 fglock kp6:  my $a = 1 but "x"; say $a
17:57 exp_evalbot r18445: OUTPUT[x␤]
17:59 moritz_ kp6: my $a = undef but 3; say $a;
17:59 exp_evalbot r18445: OUTPUT[Undef␤]
18:00 moritz_ kp6: my $a = undef but 'a'; say $a;
18:00 exp_evalbot r18445: OUTPUT[Undef␤]
18:01 avar my $a = "cat" but "fine too"; say $a
18:01 avar kp6: my $a = "cat" but "fine too"; say $a
18:01 exp_evalbot r18445: OUTPUT[fine toofine too]
18:01 barney joined #perl6
18:03 penk joined #perl6
18:04 fglock that's the "needs more work" part
18:05 moritz_ so how is decided which part to use for coercion?
18:05 Notrix joined #perl6
18:06 vel joined #perl6
18:06 moritz_ if I have a '$foo but $bar', is the check if $bar has a .Str method, and if not $foo.Str is called?
18:06 avar moritz_: http://dev.pugscode.org/changeset/18445
18:07 lambdabot Title: Changeset 18445 - Pugs - Trac
18:07 fglock it calls .Str on $bar, if $bar is Str
18:07 fglock i think
18:07 avar .str if $bar is Str
18:08 fglock avar: i think .str is now .Str
18:08 avar yeah, but your but code does .dstr
18:08 avar *.str
18:09 moritz_ well, .$type should be called if you want to coerce to $type
18:10 moritz_ see r14464 of the synopsis
18:11 moritz_ roughly S13:143
18:13 jhorwitz joined #perl6
18:13 fglock yes, but this is better be fixed in all code at once
18:13 moritz_ right
18:15 moritz_ rgrep '\bstr\b' src/|wc -l
18:15 moritz_ 480
18:15 moritz_ of course there are many false positives
18:19 mncharity joined #perl6
18:23 ruoso (Failure but NaN) isa Num?
18:30 Torment joined #perl6
18:31 fglock it's still Failure
18:31 fglock hmm - maybe
18:31 TJCRI joined #perl6
18:34 vel_ joined #perl6
18:40 jisom joined #perl6
18:51 Limbic_Region joined #perl6
19:00 chris2 joined #perl6
19:18 weinig joined #perl6
19:28 vbattsAtWork joined #perl6
19:28 PerlJam Is it just me or does *adding* something to *not* capture seem weird?
19:29 moritz_ PerlJam: that's what p5 uses as well... ( captures and (?: doesn't
19:29 moritz_ PerlJam: so <. as opposed to < is an improvement ;)
19:30 PerlJam If you say so.
19:30 moritz_ I do ;)
19:31 PerlJam I'm not entirely sure, but I think I'd be happier if the default were to not capture and then <.foo> would capture
19:31 PerlJam and $/.foo might do something useful too
19:31 moritz_ PerlJam: actually it depends on what you want to make the default - I see no gain in intuitiveness one way or another
19:32 PerlJam I'm prematurely optimizing perhaps, but making capturing the default seems like it'll put the RE engine through lots more work in the general case
19:32 _REPLeffect joined #perl6
19:33 PerlJam (I think most people will care to use grammars for their readability, but not care to capture so much)
19:33 miyagawa joined #perl6
19:33 fglock &
19:34 moritz_ PerlJam: well, that's a good point (but not if your primary concern is to write parsers)
19:42 moritz_ @karma moritz_
19:42 lambdabot You have a karma of 10
19:42 moritz_ @karma moritz
19:42 lambdabot moritz has a karma of 114
20:15 lambdabot joined #perl6
20:17 vel joined #perl6
20:21 weinig_ joined #perl6
20:50 miyagawa left #perl6
20:52 devogon joined #perl6
21:03 drupek12 joined #perl6
21:11 meppl good night
21:18 moritz_ good night meppl ;
21:20 BinGOs joined #perl6
21:26 PerlJam moritz_: interesting question on perlmonks
21:34 meppl ;)
21:56 thoughtpolice joined #perl6
22:04 Notrix joined #perl6
22:08 renormalist joined #perl6
22:14 rlb3_work joined #perl6
22:18 Lunchy joined #perl6
22:20 beppu joined #perl6
22:22 weinig joined #perl6
22:29 penk joined #perl6
22:37 weinig_ joined #perl6
22:45 Psyche^ joined #perl6
22:55 weinig joined #perl6
23:11 weinig joined #perl6
23:13 REPLeffect_ joined #perl6
23:16 BinGOs_ joined #perl6
23:23 lambdabot joined #perl6

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

Perl 6 | Reference Documentation | Rakudo