Camelia, the Perl 6 bug

IRC log for #perl6, 2010-11-07

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs

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

All times shown according to UTC.

Time Nick Message
00:01 dalek 6model: de688fe | jnthn++ | dotnet/compiler/PAST2DNSTCompiler.pm:
00:01 dalek 6model: [dotnet] Fix code-gen bug that caused problems with && and || and probably other things that cared about what a failed if/unless evaluated to.
00:01 dalek 6model: review: https://github.com/jnthn/6model/commit/d​e688fe67b3670909aa357e5b7e47afd85e66f88
00:01 dalek 6model: f7efbd5 | jnthn++ | t/nqp/25-class.t:
00:01 dalek 6model: [t] We now pass 25-class.t.
00:01 dalek 6model: review: https://github.com/jnthn/6model/commit/f​7efbd5351ccff2c75958a04004d4efecb7b0413
00:01 dalek left #perl6
00:03 dalek joined #perl6
00:08 patspam left #perl6
00:09 xinming joined #perl6
00:09 dalek 6model: ea111e5 | jnthn++ | common/NQP/NQPSetting.pm:
00:09 dalek 6model: [common] Implement .isa in NQPClassHOW.
00:09 dalek 6model: review: https://github.com/jnthn/6model/commit/e​a111e5f3bad3a65fd8a540dece6e261d5ab0a7d
00:09 dalek 6model: 8471528 | jnthn++ | t/nqp/28-subclass.t:
00:09 dalek 6model: [t] We now pass 28-subclass.t.
00:09 dalek 6model: review: https://github.com/jnthn/6model/commit/8​4715288e108694168b536e268d399f1d97b71eb
00:12 tadzik ## Czechy :D
00:14 jnthn .oO( If you put enough puns in the code, people will review it for you. )
00:15 tadzik how far in the nqp-rx testsuite are you, jnthn?
00:15 jnthn tadzik: In the non-regex bits, fairly far.
00:16 jnthn tadzik: Significant missing things include for loops and exception handling.
00:16 sorear jnthn: Have you noticed dalek is back?
00:16 jnthn sorear: Yes. :-)
00:16 jnthn sorear: It feels normal here again. :-)
00:16 jnthn sorear: Thanks for sorting it out.
00:16 jnthn sorear: It missed some of my commits earlier.
00:17 jnthn sorear: And then dupe-reported some others.
00:17 jnthn Hopefully that was a mid-fix glitch though.
00:17 Raynes left #perl6
00:18 jnthn sorear: What broke, ooc?
00:19 tadzik jnthn: will you be writing your own regex engine, or using the existing one?
00:19 Guest57296 joined #perl6
00:20 jnthn tadzik: The aim is to implement a PAST::Regex compiler and then bootstrap NQP's Regex grammar and actions on top of .Net.
00:20 dalek 6model: 0f23784 | jnthn++ | dotnet/compiler/ROADMAP.txt:
00:20 dalek 6model: [dotnet] ROADMAP updates.
00:20 dalek 6model: review: https://github.com/jnthn/6model/commit/0​f2378458695709c737a4ccc43f1bfe76464d38e
00:20 jnthn tadzik: The overall goal being a self-hosting NQP.
00:20 jnthn Well, the overall goal being Rakudo running there, but... :-)
00:21 sorear jnthn: it was a combination of github switching to SSL and diakopter's VPS not having SSL libs
00:21 jnthn sorear: Ah, that'd do it. :)
00:26 patspam joined #perl6
00:27 Guest57296 is now known as Raynes
00:27 Raynes left #perl6
00:27 Raynes joined #perl6
00:28 sorear jnthn: that last dup was me testing a new version of the aggregator
00:29 sorear I just split dalek into two programe
00:29 sorear git://github.com/sorear/dalek-poller.git handles all the getting of data and writes a queue file
00:29 sorear dalek is now a tail -f bot
00:29 sorear nothing more
00:30 mjk joined #perl6
00:32 xabbu42 joined #perl6
00:33 masonkramer I'd like to overload prefix:<+> for a class, without touching + for other operand types.
00:33 tadzik g'night
00:33 masonkramer S13 leads me to believe that multi sub prefix:<+> (Bag $bag) is export { $bag.elems }
00:33 masonkramer ought to work
00:34 mjk left #perl6
00:34 masonkramer but other types are not falling back to the builtin prefix:<+>, or anyway something is going awry.  After that line, something like +8 doesn't work anymore
00:35 masonkramer rakudo: say +8, class Bag { ... }; multi sub prefix:<+> (Bag $bag) is export { $bag.elems }; say +8;
00:35 p6eval rakudo 142d22: OUTPUT«error:imcc:syntax error, unexpected ')' (')')␤    in file 'EVAL_10' line 67808177␤===SORRY!===␤syntax error ... somewhere␤»
00:36 masonkramer say +8; class Bag { ... }; multi sub prefix:<+> (Bag $bag) is export { $bag.elems }; say +8;
00:36 masonkramer rakudo: say +8; class Bag { ... }; multi sub prefix:<+> (Bag $bag) is export { $bag.elems }; say +8;
00:36 p6eval rakudo 142d22: OUTPUT«1␤1␤»
00:36 masonkramer that's interesting
00:37 masonkramer on rakudo* interpreter, before the multi sub declaration, +8 is 8
00:37 masonkramer *on mine
00:37 sorear masonkramer: you need to use our multi sub (rakudo bug)
00:38 sorear however, the standard prefix:<+> just delegates the the Numeric method
00:38 jnthn Aye, that's probably it.
00:38 sorear so define that
00:38 jnthn That also. :)
00:39 jnthn sleep &
00:39 masonkramer Sorry, I have to define another multi sub prefix:<+>?
00:40 sorear No
00:40 sorear Just define method Numeric() { YOUR CODE HERE }
00:40 sorear In the class
00:41 masonkramer that's easy for prefix:<+>
00:41 masonkramer but I also need to export multi sub infix<=> (Hash, Bag)
00:41 masonkramer so this problem doesn't go away
00:42 sorear no
00:43 sorear = isn't a multi sub
00:43 sorear you can't add candidates
00:43 masonkramer ahh
00:43 masonkramer that's why it's not in the docs for overloading
00:44 sorear in Rakudo, = delegates to the !STORE method on the left hand object
00:46 masonkramer Alright, so if I want to implement that part of Bag, I'll have to work on Hash.!STORE
00:54 masonkramer Hmm, nope, looks like I just have to declare Bag is EnumMap, neato
01:05 kjeldahl left #perl6
01:06 Chillance left #perl6
01:08 masonkramer is there an easy way to make a Hash read only?
01:16 cotto left #perl6
01:17 cotto joined #perl6
01:24 dnl- joined #perl6
01:28 c1sung_ joined #perl6
01:28 dnl left #perl6
01:28 snarkyboojum_ joined #perl6
01:29 sorear_ joined #perl6
01:29 ashleyde1 joined #perl6
01:29 tadzik1 joined #perl6
01:29 snarkyboojum left #perl6
01:29 tadzik left #perl6
01:29 boggytwo left #perl6
01:29 c1sung left #perl6
01:29 sorear left #perl6
01:29 jasonmay left #perl6
01:29 f00li5h left #perl6
01:29 ashleydev left #perl6
01:29 jhuni left #perl6
01:29 jasonmay_ joined #perl6
01:30 f00li5h joined #perl6
01:30 boggytwo joined #perl6
01:30 jhuni joined #perl6
01:36 masonkramer mostly working Bag https://github.com/masonk/rakudo/commit/​6f47adbb5e9656091b96758c78df7bc76e7de1d0
01:49 dalek ecosystem: 04aca36 | Util++ | projects.list:
01:49 dalek ecosystem: Add Perl6-Math-Quaternion
01:49 dalek ecosystem: review: https://github.com/perl6/ecosystem/commit​/04aca369b2f856549dd84354721cd2a62b0cee1d
01:55 xabbu42 left #perl6
01:59 jferrero left #perl6
02:04 jasonmay_ is now known as jasonmay
02:07 patspam left #perl6
02:13 whiteknight joined #perl6
02:13 Axius left #perl6
02:20 jhuni left #perl6
02:20 [Sec] left #perl6
02:23 masonkramer pir is a lot like perl...
02:25 patspam joined #perl6
02:30 Plastic_Chicken joined #perl6
02:38 ggoebel left #perl6
02:39 jhuni joined #perl6
02:42 jhuni left #perl6
02:57 risou joined #perl6
03:10 sorear_ is now known as sorear
03:17 whiteknight left #perl6
03:22 dalek niecza: 8f40628 | sorear++ | / (3 files):
03:22 dalek niecza: Add testsuite for C# JSON
03:22 dalek niecza: review: https://github.com/sorear/niecza/commit/​8f40628fca26697300c69c4f823a488148004c66
03:28 lidden left #perl6
03:40 chitragupt joined #perl6
04:13 am0c joined #perl6
04:29 patspam left #perl6
04:48 masonkramer can I mutate a class at runtime?
04:48 masonkramer sorry, let me rephrase that
04:49 sorear yes
04:49 masonkramer I have a Hash, %h.  I want %h to become a subclass that I define after I've done some stuff with %h
04:49 masonkramer basically, I'm trying to freeze %h so that assignments to its elements dies
04:50 masonkramer something like %h is Hash but { at_key { die } }
04:51 sorear well, at_key is also used for reading elements
04:51 sorear so that's a leetle tricky
04:52 masonkramer alright
04:53 masonkramer Guess I need to go learn PIR enough to understand what at_key is doing
04:54 masonkramer that's the final thing to implement on Bag
04:55 sorear rakudo: my %h = :a(1), :b(2); role ReadOnlyHash { method at_key($k) { my $r ::= callsame; $r } }; %h does ReadOnlyHash; say %h<a>; %h<a>++;
04:56 p6eval rakudo 142d22: OUTPUT«1␤Cannot modify readonly value␤  in '&infix:<=>' at line 1␤  in main program body at line 7294:CORE.setting␤»
04:56 sorear \o/
04:58 masonkramer heh
04:58 masonkramer cool, but now I've got some different questions
04:58 masonkramer what the heck is ::= ?
05:00 skangas left #perl6
05:01 TimToady bind and make readonly
05:03 masonkramer Ahh, well, that's concise
05:08 masonkramer This Bag passes all the tests, plus a few more that I wrote for it
05:08 masonkramer https://github.com/masonk/rakudo/commit/​2668178c6ba90863538ea74cfdd287684a20c520
05:12 masonkramer Though I'm not sure about any&all&none
05:13 masonkramer they probably should've been delegated to keys, not counts
05:20 TimToady one has to look at the count, of course
05:20 TimToady one() that is
05:24 nymacro joined #perl6
05:47 JackyJ joined #perl6
06:06 REPLeffect left #perl6
06:06 REPLeffect joined #perl6
06:11 justatheory left #perl6
06:13 risou_ joined #perl6
06:15 risou left #perl6
06:21 topeak joined #perl6
06:33 am0c left #perl6
06:51 justatheory joined #perl6
06:51 justatheory left #perl6
06:53 quietfanatic left #perl6
07:16 _twitch joined #perl6
07:21 satyavvd joined #perl6
07:26 Guest22875 left #perl6
07:38 topeak left #perl6
07:44 meppl joined #perl6
07:48 satyavvd left #perl6
07:51 REPLeffect left #perl6
07:52 REPLeffect joined #perl6
08:09 mberends left #perl6
08:11 tri joined #perl6
08:20 _kaare joined #perl6
08:29 nymacro left #perl6
08:35 REPLeffect left #perl6
08:36 REPLeffect joined #perl6
08:47 ingy sorear++ # JSYNC::XS
08:50 tri left #perl6
09:01 sorear ingy: What should I call a combined effort to support JSON, JSYNC, and (eventually) YAML?
09:03 ingy sorear: Acmeist ;)
09:03 ingy sorear: in what sense?
09:04 sorear One library, one event stream, three presentation layers
09:04 sorear lib/$foo/YamlReader.cs
09:06 ingy DataGraph
09:06 ingy ?
09:07 cxreg WhateverConfig
09:08 ingy Cereal
09:10 cxreg DataBran
09:11 ingy MultiFibreDataBranCerealizer
09:12 sorear Cereal?
09:13 * sorear is looking for something shortish and implying I/O in some way... DataGraph fails on both
09:13 mberends joined #perl6
09:13 sorear WhateverConfig fails on the first only
09:13 sorear I don't folow the Bran reference
09:13 sorear ehllo mberends
09:13 _sri AnyData
09:16 risou_ left #perl6
09:17 _sri Omnivore
09:27 risou joined #perl6
09:34 mavrc joined #perl6
09:36 orafu left #perl6
09:41 mberends ehlo sorear ;)
09:43 JackyJ left #perl6
09:49 mberends left #perl6
09:56 xabbu42 joined #perl6
09:57 tadzik1 is now known as tadzik
10:05 mberends joined #perl6
10:10 kjeldahl joined #perl6
10:11 mberends left #perl6
10:11 mberends joined #perl6
10:13 nymacro joined #perl6
10:16 FlamingRed joined #perl6
10:27 whiteknight joined #perl6
10:28 masonkramer left #perl6
10:28 masonkramer joined #perl6
10:33 mberends left #perl6
10:33 mberends joined #perl6
10:37 moritz_ oh hai
10:45 rgrau` joined #perl6
10:47 REPLeffect left #perl6
10:48 REPLeffect joined #perl6
10:50 tadzik oh hai
10:51 mberends left #perl6
10:53 moritz_ tadzik: yes, I meant "important"
11:01 nymacro left #perl6
11:02 cognominal left #perl6
11:03 cognominal joined #perl6
11:06 moritz_ (backlogging) re page hits for advent posts: these numbers are severly skewed by the slashdotting, which linked to two posts directly
11:06 moritz_ or three
11:21 dual left #perl6
11:21 arthur-_ joined #perl6
11:23 arthur-_ perl6: use MongoDB;
11:23 p6eval pugs: OUTPUT«pugs: *** Unsafe function 'use' called under safe mode␤    at /tmp/JTeh2M5oWo line 1, column 1␤»
11:23 p6eval ..rakudo 142d22: OUTPUT«===SORRY!===␤Unable to find module 'MongoDB' in the @*INC directories.␤(@*INC contains:␤  lib␤  /home/p6eval/.perl6/lib␤  /home/p6eval//p1/lib/parrot/2.​9.1-devel/languages/perl6/lib␤  .)␤»
11:23 arthur-_ :(
11:26 dual joined #perl6
11:26 moritz_ arthur-_: even if it existed, it wouldn't be installed on the server that p6eval uses
11:27 arthur-_ oh ok
11:27 arthur-_ perl6: use MongoDB:from<perl5>;
11:27 p6eval pugs: OUTPUT«pugs: *** No such subroutine: "&require_MongoDB"␤    at /tmp/KnA9EiglmE line 1, column 1␤»
11:27 p6eval ..rakudo 142d22: OUTPUT«===SORRY!===␤"load_language" couldn't find a compiler module for the language 'perl5'␤»
11:27 arthur-_ so not that either
11:28 moritz_ there's no reason the perl5 module should be installed on the server either
11:28 arthur-_ any doc somewhere on how to write something like that ( a module for a C lib )
11:29 moritz_ arthur-_: https://github.com/jnthn/zavolaj is a module you can use to wrap C libs
11:29 moritz_ it comes with a README and some examples
11:29 arthur-_ moritz_: thanks
11:30 moritz_ arthur-_: and http://ttjjss.wordpress.com/2010/08/09​/so-you-want-to-write-a-perl-6-module/ about writing Perl 6 modules in general
11:30 tadzik arthur-_: well volunteered! :)
11:32 dual_ joined #perl6
11:34 dual left #perl6
11:42 MayDaniel joined #perl6
11:45 wamba joined #perl6
11:46 wamba left #perl6
11:46 wamba joined #perl6
11:48 x3nU joined #perl6
11:48 spinclad left #perl6
11:52 arthur-_ tadzik: make on zavolaj fails, I can't go further, so that's not a very usefull volunteering :)
11:53 tadzik arthur-_: care to provide more details?
11:54 arthur-_ tadzik: http://pastebin.com/wp5k6Um3
11:54 tadzik arthur-_: compiles fine for me (installed via neutro)
11:54 tadzik arthur-_: what rakudo version are you using?
11:55 arthur-_ tadzik: lastest ubuntu's
11:55 arthur-_ -v gives only This is Rakudo Perl 6.
11:55 tadzik oh, ubuntu ships Rakudo?
11:56 arthur-_ tadzik: or I compiled it and don't remember it ^^
11:56 tadzik arthur-_: the last rakudo that printed only 'This is Rakudo Perl 6.' is, as far as I remember, _quite_ old
11:56 tadzik hmm, how to check
11:56 arthur-_ ok, so I update it
11:56 tadzik that'd be good
11:57 tadzik iirc one of my fellow Mongers has some PPA with Rakudo
11:58 tadzik there's 2010.09 in his repo
11:59 arthur-_ installing from git, I'll see if it works better
11:59 tadzik zavolaj works flawlessly on my gitrakudo
12:02 tadzik https://gist.github.com/666090 -- anyone to apply?
12:04 jlaire left #perl6
12:04 jlaire joined #perl6
12:09 moritz_ tadzik: Applying: Simplified Range.pick a bit
12:09 moritz_ error: patch failed: src/core/Range.pm:75
12:09 moritz_ error: src/core/Range.pm: patch does not apply
12:09 moritz_ tadzik: is that against latest origin/master ?
12:11 jnthn o/
12:11 tadzik :F
12:11 tadzik moritz_: yeah, it was format-patch master. Lemee check
12:12 tadzik jnthn: o.
12:14 moritz_ tadzik: even the system patch(1) utility doesn't apply it (and it's usually more tolerant than git's)
12:14 tadzik moritz_: applies flawlessly here http://wklej.org/id/414259/ (I think)
12:16 moritz_ oh, copy&paste killed some whitespace it seems :(
12:16 tadzik ah, probably
12:17 moritz_ ("smart" software)--
12:18 arthur-_ sudo make install installs it to the /tmp/ im in ... :(
12:18 arthur-_ option ?
12:18 tadzik did you pass any --prefix to Configure.pl?
12:18 tadzik or just maintain it in your ~
12:19 arthur-_ perl Configure.pl --gen-parrot
12:19 arthur-_ no --prefix
12:19 tadzik yeah, then it defaults to the current dir
12:19 arthur-_ how do I install it to the whole system ?
12:19 arthur-_ --prefix=/ ?
12:19 tadzik probably, yes
12:19 tadzik or --prefix=/usr?
12:20 rvrgs joined #perl6
12:20 tadzik dunno, when I use git I install it in my /home, when I manage it for CRUX I use Parrot and Rakudo separately
12:20 arthur-_ trying /usr
12:22 rvrgs left #perl6
12:29 arthur-_ did not work :(
12:29 arthur-_ anyone knows how to install rakudo to / ?
12:36 simon__ joined #perl6
12:37 simon__ left #perl6
12:38 M_o_C joined #perl6
12:40 satyavvd joined #perl6
12:43 arthur-_ --prefix=/ did not work again
12:47 arthur-_ ok so sudo cp perl6 /usr/bin/perl6, we'll see if that works ...
12:47 arthur-_ make works now !
12:48 moritz_ arthur-_: for a proper installation /usr/ you need to configure parrot with the /usr prefix
12:48 moritz_ to do that, you can run rakudo's Configure.pl with --gen-parrot --gen-parrot-prefix=/usr
12:49 arthur-_ doing that now, thanks
12:51 tadzik moritz_: ming applying the patch? :)
12:54 arthur-_ tadzik: mysql-client example working !
12:54 arthur-_ tadzik: thanks !
12:57 orafu joined #perl6
12:59 tadzik arthur-_: you're welcome :)
12:59 tadzik arthur-_: hacking on something?
13:04 arthur-_ tadzik: well I'd like to make a mongodb driver for perl6, and then an ORM from that, but the first part I'm pretty sure is way too hard for me
13:04 arthur-_ looking into it anyway
13:06 bobkare left #perl6
13:09 orafu left #perl6
13:09 orafu joined #perl6
13:10 arthur-_ arthur@aquarelle /t/zavolaj> perl6 examples/mongodb.p6
13:10 arthur-_ ===SORRY!===
13:10 arthur-_ The native library 'libmongo' required for 'mongo_connect' could not be located
13:13 PerlJam left #perl6
13:14 masak joined #perl6
13:14 masak hello, #perl6.
13:15 jnthn o/ masak
13:15 jnthn arthur-_: Do you actually have a libmongo in your path?
13:16 masak jnthn: I just realized that the kind of sleep-hour dislocation I have currently is perfect for a visit at your place. so I don't have much of a reason to fix it in the upcoming week. :)
13:16 masak arthur-_! \o/
13:16 arthur-_ jnthn: I don't even know how to know that ...
13:16 jnthn masak: lol :)
13:16 arthur-_ I'm not even sure it's named that way
13:17 arthur-_ all I have is that : http://www.mongodb.org/display/DOCS/C+Tutorial
13:17 jnthn arthur-_: Well, if you don't know what it's called, Zavolaj sure don't. :)
13:17 arthur-_ and mongodb-dev installed
13:17 arthur-_ masak: !!
13:18 jnthn oh ouch
13:18 masak arthur-_: long time no see!
13:18 jnthn The build line on that page is...not encouraging.
13:18 arthur-_ masak: yep, no time for perl6 lately
13:19 arthur-_ any work done on web.pm since then ?
13:19 masak arthur-_: stuck at week 19 :/
13:19 masak arthur-_: but I plan to, sometime this month.
13:22 kjeldahl_ joined #perl6
13:23 Patterner left #perl6
13:25 PerlJam joined #perl6
13:25 masak looking at Instant in src/core/Temporal.pm yesterday, I realized that at some point, someone will release a module that auto-declares all the operators for some user-defined type that does Real.
13:27 masak wow, masonkramer++ wrote a Bag!
13:28 dju left #perl6
13:28 tadzik what's a Bag?
13:29 masak it's like a Set, but allows multiple copies of elements.
13:29 masak or you could think of it as an unordered Array.
13:29 tadzik mhm
13:29 masak or a Hash that maps stuff to Int :)
13:30 masak general question: how to I map/grep on only the values of a hash? that is, I want to keep the keys of the hash intact, but transform or filter its values.
13:32 tadzik %hash.values.grep()?
13:32 colomon are you suggesting you might want to transform (say)  "blue" => 42 to just "blue"?
13:33 colomon (otherwise I don't understand what filtering values but leaving keys intact means)
13:33 masak ok, I'll give you a concrete example.
13:34 Psyche^ joined #perl6
13:34 Psyche^ is now known as Patterner
13:34 masonkramer oh, masak, I know what you're talking about
13:34 masak I want to go from { Jan => 0, Feb => 1, Mar => 2 } to { Jan => 1, Feb => 2, Mar => 3 }. here, the transformation is (* + 1)
13:34 masonkramer I want to do this a lot in perl5
13:35 moritz_ %months.values>>++ # maybe?
13:35 colomon at least in theory moritz_'s suggestion should work, I think.
13:36 jnthn %months>>++ # doesn't hypers operate ove the values by default in a hash?
13:36 moritz_ jnthn: they probably do
13:36 masak I don't want to do it in-place.
13:36 colomon jnthn++
13:37 moritz_ rakudo: my %month = (Jan => 0, Feb => 1); %month>>++; say %month.perl
13:37 p6eval rakudo 142d22: OUTPUT«{"Jan" => 1, "Feb" => 2}␤»
13:37 jnthn masak: oh
13:37 moritz_ masak: then copy first :-)
13:37 masak also, I chose a simple transformation, but I might want to do something more complicated.
13:37 jnthn Then why not %h.pairs.map({ .key => .value + 1 }).hash or so?
13:37 colomon %months.kv.map({.key => .value + 1}).hash
13:37 colomon damnit, jnthn just slightly faster than me.
13:38 masak I believe .pairs is reduntant there.
13:38 moritz_ rakudo: our postfix:<inc>($x) { $x.succ }; say ({Jan => 1, Feb => 2}>>inc).perl
13:38 p6eval rakudo 142d22: OUTPUT«===SORRY!===␤Malformed our at line 22, near "postfix:<i"␤»
13:38 moritz_ rakudo: our sub postfix:<inc>($x) { $x.succ }; say ({Jan => 1, Feb => 2}>>inc).perl
13:38 p6eval rakudo 142d22: OUTPUT«{"Jan" => 2, "Feb" => 3}␤»
13:38 moritz_ \o/
13:38 masak moritz_++
13:39 moritz_ rakudo: say { a => 0, b => 1}>>.succ.perl
13:39 p6eval rakudo 142d22: OUTPUT«Method 'succ' not found for invocant of class 'Pair'␤  in main program body at line 22:/tmp/IUhYo8b9MK␤»
13:39 moritz_ EDIFFERENTMAGIC
13:39 dalek rakudo: 690e370 | tadzik++ | src/core/Range.pm:
13:39 dalek rakudo: Simplified Range.pick a bit
13:39 dalek rakudo:
13:39 dalek rakudo: Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
13:39 dalek rakudo: review: https://github.com/rakudo/rakudo/commit/​690e3708e7ecd088e7b9ce66a71dc6547b500df8
13:41 colomon rakudo: say { a => 0, b => 1}.hash>>.succ.perl
13:41 p6eval rakudo 142d22: OUTPUT«Method 'hash' not found for invocant of class ''␤  in main program body at line 22:/tmp/bm_0BvSLf8␤»
13:41 colomon rakudo: my %a =  a => 0, b => 1; say %a>>.succ.perl
13:42 p6eval rakudo 142d22: OUTPUT«Method 'succ' not found for invocant of class 'Pair'␤  in main program body at line 22:/tmp/lmtwd3Lw0Y␤»
13:42 moritz_ there's a certain asymmetry
13:42 moritz_ %has>>op is the same as %hash.value>>op
13:42 colomon rakudo: my %a =  a => 0, b => 1; say (%a >>+>> 1).perl
13:42 p6eval rakudo 142d22: OUTPUT«{"a" => 1, "b" => 2}␤»
13:42 moritz_ but %hash>>.method is the saem as %hash.pairs>>.method
13:42 tadzik moritz_++
13:43 colomon I think that's a bug.
13:43 colomon tadzik++
13:43 moritz_ hm
13:43 moritz_ I kinda think it's current spec
13:43 masak me too.
13:43 masak but I agree that it's somewhat skewed.
13:43 masak doesn't really fit together.
13:43 moritz_ becuase >>.method is really not a hyper operator, but a method call with some hyper-y semantics
13:43 moritz_ which defaults to .list on its invocant
13:43 colomon are you sure that's spec?
13:44 tadzik I should get a civilized gravatar
13:44 colomon If I'd been able to figure it out, I'd have changed >>.method to match >>op
13:45 colomon (of course, it's possible I was wrong to think that should be done!)
13:45 moritz_ let's see what TimToady has to say
13:45 moritz_ a certain symmetry wouldn't be bad
13:47 colomon I'm not seeing anything obvious to me in the hyperop specs that separate out >>.method as behaving differently from >>op
13:48 masonkramer philosophical question about pull requests - what level of polish are you considering for rakudo right now?
13:48 masonkramer E.G., I have a Bag that passes the tests, but it does not have the .WHICH property of immutable objects such that $x.WHICH eqv $y.WHICH when all keys and counts are identical
13:48 vdrab left #perl6
13:49 colomon sounds like a good start to check in to me.
13:50 masak rakudo: my %h = Jan => 0, Feb => 1, Mar => 2; sub vmap(&c, %h) { hash(%h.keys Z=> map { .&c }, %h.values) }; say (vmap { $_ + 1 }, %h).perl
13:50 p6eval rakudo 142d22: OUTPUT«{"Jan" => 1, "Feb" => 2, "Mar" => 3}␤»
13:50 masak this is what I wanted.
13:51 moritz_ masonkramer: are bags supposed to be value types?
13:51 masak I was wondering if that was built in. seems not.
13:51 masak moritz_: they're listed under "Immutable types" in S02.
13:52 colomon rakudo: my %a =  a => 0, b => 1; say (%a >>+>> 1).perl; say %a.perl
13:52 p6eval rakudo 142d22: OUTPUT«{"a" => 1, "b" => 2}␤{"a" => 0, "b" => 1}␤»
13:52 masonkramer moritz_: what masak said, "Objects with these types behave like values, i.e. $x === $y is true if and only if their types and contents are identical (that is, if $x.WHICH eqv $y.WHICH)."
13:52 masonkramer I'm going to solve this *particular* problem before I issue a pull request, because I know about it, and how to fix it
13:53 masonkramer however, as a philosophical point, when is it good enough?
13:53 masonkramer when it has no known bugs?
13:54 colomon masonkramer: by that standard probably 50% of the commits in Rakudo wouldn't be made
13:54 moritz_ masonkramer: "no known bugs" is not a requirement
13:54 colomon if you're implementing new functionality and it mostly works, that's great.
13:54 colomon if you're worried about known bugs, make sure tests for them are in the spectest
13:55 moritz_ masonkramer: it shouldn't have bugs that you expect to be heavily relied on, thus misleading the user
13:57 wamba left #perl6
13:57 wamba joined #perl6
13:57 satyavvd left #perl6
13:58 moritz_ masonkramer: most features first get implemented in a buggy, incomplete way. Then masak++ files ten bug reports about it, and it gradually improves :-)
13:58 masak word.
13:59 masak masonkramer: release early, release often.
13:59 masak masonkramer: if it's not in Rakudo, I can't bash at it.
14:00 masonkramer ok, sounds great
14:00 masonkramer I'm on board with that plan
14:02 icwiener joined #perl6
14:05 arthur-_ tadzik: too complicated for me, I give up
14:05 tadzik arthur-_: what's up?
14:06 arthur-_ tadzik: too difficult, I can't even get it to load the library
14:06 tadzik arthur-_: show some code with errors
14:06 jnthn arthur-_: Are you sure thre even *is* a library?
14:06 arthur-_ no, that's why it is that difficult
14:06 jnthn arthur-_: The page you linked to showed a C example where they compiled the entire set of C source files for the binding into the example executable.
14:06 jnthn Zavolaj can't help you if there's no library to load.
14:07 jnthn Then
14:07 jnthn I'm not sure what can... :)
14:07 M_o_C left #perl6
14:07 jnthn Short of re-implementing the binding from the ground up, or working out how to make a shared library.
14:07 jnthn Latter should be possible.
14:08 jnthn I'm just surprised they didn't already provide one. :S
14:08 arthur-_ again, too complicated for me
14:08 arthur-_ I was ready to try if it did not involve any C-stuff
14:08 jnthn I'm afraid it's probably going to if there's no library handy already. :(
14:09 arthur-_ ok
14:09 * tadzik awaits the new NCI branch so he could (maybe) get Loudmouth working
14:09 jnthn GET WHAT WORKING?
14:09 arthur-_ it says "library" on the c++ page : http://www.mongodb.org/pages/​viewpage.action?pageId=133415
14:09 tadzik :)
14:10 tadzik then I could rewrite my xmpp client in Perl 6, which would be insanely awesome
14:10 tadzik (and insanely slow)
14:14 arthur-_ jnthn: " You can also specify --sharedclient to build a shared library instead of a statically linked library. " ... do I want this ?
14:14 jnthn arthur-_: That sounds the right kind of thing yes
14:15 arthur-_ ok, trying
14:16 risou left #perl6
14:19 risou joined #perl6
14:24 masonkramer What method does for use on an object to obtain the iterator?
14:25 jnthn for is actually just map
14:26 masak I just got "Can't exponentiate a Duration" in real-world code. could someone explain to me why we have Durations?
14:26 masonkramer jnthn: in that case, what method does map use?
14:28 masonkramer masak: time notation is hard and incredibly common.  I think the success and ubiquity of the DateTime project in perl5 proves that there should be one comprehensive, standard way of notating time
14:28 masak I mean, what would we lose from getting rid of the Duration type, and just dealing with Num seconds?
14:29 masak I must confess that's what I thought I had until I got the error message.
14:29 masak and if I do .x, that's what I'll have.
14:29 masak my point is, I'd prefer not to have to do .x
14:30 masak when I look in src/core/Duration.pm, all I see is a lot of delegation methods, and some methods saying what you can't do.
14:30 masak that doesn't benefit me as a user in *any* way.
14:31 masak (as far as I can see)
14:31 bonelifer joined #perl6
14:31 nymacro joined #perl6
14:33 patspam joined #perl6
14:35 masonkramer If it's anything, it's that it usually doesn't make sense to do most numeric operations on two Durations.  E.G., from a physical point of view, 5 seconds * 5 seconds usually doesn't make sense
14:36 masak I don't care. when I did it, it made perfect sense. no offense, but what you just said is so short-sighted it sounds like it came from a Python person.
14:36 masak I was calculating the standard deviation of a bunch of Durations. that calculation contains an exponantiation.
14:36 masak I know what I'm doing. Rakudo thought it knew better, it didn't.
14:37 * masak throws the tantrum a bit more
14:38 masonkramer I'm not actually advocating Durations, mind you, I'm just reading the spec and trying to give it a fair shake
14:38 masak *nod*
14:38 masak I just hate when things that could be simple are complicated, and obstruct a simple solution.
14:38 masak I don't currently see what Duration buys us.
14:40 masonkramer It makes the program more self-documenting, for one thing.  Having a Duration object gives me more info about that object that an equivalent Rat.
14:41 masonkramer *than an
14:41 masak that is true.
14:41 masak I wasn't declaring Duration objects in my code, though. I was just implicitly (and unwittingly) using one.
14:42 spinclad joined #perl6
14:43 masonkramer The way you fmt a Duration might be different from the way you fmt a Rat?
14:44 masak not that I'm aware.
14:44 masonkramer But it *could* be
14:44 masonkramer And/or you can conceive of another pretty printer for Durations
14:45 masonkramer something configurable
14:45 masonkramer something _localizable_
14:46 masak meh.
14:46 masak all this abstraction, and we don't even know exactly what we want it for. colour me unconvinced.
14:47 masonkramer I'm not even sure that your failure was to spec
14:47 masak I'm pretty sure it isn't.
14:47 masonkramer "Durations allow additive operations with other durations, _and allow any numeric operation with a number as the other argument_"
14:48 * masak submits rakudobug
14:48 masonkramer So it wouldn't have been an issue for you if it had been to spec
14:48 masak masonkramer: thank you.
14:49 masonkramer welcome!
14:49 masonkramer and I'm definitely going to monkey patch Duration.Stringy one day
14:50 satyavvd joined #perl6
14:50 dual_ left #perl6
14:52 masak I did 10 Str.trans calls on a 5k piece of text.
14:52 masak here are the times it took, in seconds: 17.83 18.25 17.64 18.09 18.16 19.69 18.83 21.02 20.10 24.01
14:53 masak notice anything odd?
14:53 masak oh, and avg time 19.36, stddev 3.88
14:53 moritz_ it gets worse over time
14:53 masak bingo.
14:53 moritz_ memory leak?
14:53 moritz_ which puts additional strain on the GC
14:54 masak aye.
14:54 masak jnthn: hurry up with that .Net thing, will you? :/
14:55 jnthn masak: Well, you can have it faster if I totally drop Rakudo-on-Parrot. :/
14:55 arthur-_ it works !!!!!!
14:55 arthur-_ trying to get a mongodb database connection now
14:56 jnthn arthur-_++! \o/
14:56 masak arthur-_++
14:56 arthur-_ something like Data::Dumper in perl6 ?
14:56 jnthn .perl method :)
14:56 arthur-_ Method 'perl' not found for invocant of class 'UnManagedStruct'
14:56 jnthn Oh
14:56 jnthn er, you're not going to be able to dump that :)
14:57 arthur-_ oh ok
14:57 jnthn It's just a thingummy holding a pointer to a chunk of memory.
14:57 jnthn Which it knows nothing about really.
14:57 arthur-_ I guess that's my client object
14:58 jnthn *nod*
14:58 jnthn You can I guess treat it as just opauqe.
14:58 jnthn You can with the mysql one anyways.
15:07 masonkramer how does .map iterate through an object?
15:11 bonelifer moritz_, quick /msg about ilbot?
15:13 nymacro left #perl6
15:17 jnthn masonkramer: See List.pm's map method, but it calls an .iterator() method on the iteratee.
15:17 risou left #perl6
15:17 jnthn masonkramer: Generally you can implement such a meethod using gather/take. I think that's how Hash does it.
15:18 jnthn *method
15:18 jnthn tssk...this connection is so laggy today :|
15:19 risou joined #perl6
15:19 Chillance joined #perl6
15:20 masonkramer thanks jnthn!
15:20 * jnthn takes a walk, bbl
15:24 _twitch left #perl6
15:25 moritz_ bonelifer: sure
15:28 arthur-_ is there a tool to find all of a shared c++ library's functions ?
15:28 arthur-_ documentation in mongodb is not for humans
15:30 tadzik you could examine the .h file
15:32 nexusone joined #perl6
15:38 bonelifer left #perl6
15:43 masak I made a modification to .trans
15:43 masak here are the new runtimes:  2.26  2.15  2.82  3.12  2.88  3.21  3.30  2.44  2.03  2.76
15:43 masak avg: 2.70
15:43 masak stddev: 0.45
15:43 masak all the old spectests pass.
15:44 moritz_ \o/
15:44 masonkramer masak++
15:45 masak preparing patch.
15:47 masak I wonder how many other src/core methods could benefit from this kind of scrutiny.
15:47 moritz_ most.
15:47 masak the algorithm that .trans employed was really embarassingly slow. the one I substituted was the first I thought of.
15:48 arthur-_ http://pastebin.com/wia2uYWU : connect always returns -1
15:48 arthur-_ I don't get how I'm supposed to use the functions in the .h files
15:48 arthur-_ there are several connect()
15:49 colomon left #perl6
15:50 arthur-_ dbclient.h has 4 connect() functions :(
15:51 arthur-_ http://api.mongodb.org/cplusplus/1​.7.0-pre-/dbclient_8h-source.html
15:51 mavrc left #perl6
15:52 * arthur-_ needs to learn more c++
15:53 masonkramer rakudo: say <a b c>.flat.WHAT; say <a b c>.flat.iterator.WHAT;
15:53 p6eval rakudo 690e37: OUTPUT«List()␤»
15:53 mavrc joined #perl6
15:54 mavrc left #perl6
15:54 masonkramer rakudo: say List.new(<a b c>).iterator.WHAT
15:54 p6eval rakudo 690e37:  ( no output )
15:55 masonkramer that's interesting.  On my r*, the third statement prints ListIter()
15:55 moritz_ which R*?
15:55 masonkramer so does the second, actually
15:55 mavrc joined #perl6
15:56 masonkramer 09
15:56 moritz_ star: say List.new(<a b c>).iterator.WHAT
15:56 p6eval star 2010.09:  ( no output )
15:56 masonkramer I swear it does
15:57 masonkramer Oh.
15:57 masonkramer No, it doesn't.  It null PMC's.  Without the say, the return value is a ListIter.  With say, null PMC
16:00 masonkramer star: my $s = <a b c>.flat.iterator.WHAT; say $s; say $s.WHAT
16:00 p6eval star 2010.09:  ( no output )
16:03 mberends joined #perl6
16:04 masak mberends! \o/
16:05 timbunce joined #perl6
16:06 masak timbunce! \o/
16:06 xinming left #perl6
16:07 lidden joined #perl6
16:07 jnthn masak: yay for the speedup :)
16:07 mberends left #perl6
16:08 mberends joined #perl6
16:08 arnsholt arthur-_: You need to find a reference to the C bindings for MongoDB (there should be some)
16:09 arnsholt The reason is that C++ function names are mangled, because function names need to be unique in the library (see http://en.wikipedia.org/wiki/Na​me_mangling#Name_mangling_in_C.2B.2B for more)
16:09 arthur-_ arnsholt: so I need to work with C function names, not C++ ?
16:10 arthur-_ the only library I could find that compiles as a shared library is the C++ one
16:10 masonkramer I see .Stringy in S13, but nothing has it defined - http://perlcabal.org/syn/S13.html#Fallbacks
16:10 arthur-_ you say I need a C library that compiles as a shared library arnsholt ?
16:10 arthur-_ they don't seem to have that
16:11 arthur-_ just .h files you are supposed to use in your C code, I think
16:11 * arthur-_ understands less that 20% of what he says
16:11 arnsholt Well, if there are C header files, there should be a C library somewhere as well
16:11 masonkramer arthur-_: I sympathize
16:12 masonkramer rakudo: say (List.new(<a>).iterator.WHAT~"");
16:12 p6eval rakudo 690e37: OUTPUT«ListIter()␤»
16:12 masonkramer rakudo: say (List.new(<a>).iterator.WHAT);
16:12 p6eval rakudo 690e37:  ( no output )
16:13 arthur-_ arnsholt: the C++ library is : /usr/local/lib64/libmongoclient.so , does that give you any clue what the C library is ?
16:13 arnsholt Maybe. I'm digging around a bit in the docs
16:13 arthur-_ thanks a lot
16:13 mberends left #perl6
16:14 masonkramer type objects can't stringify? is that right?
16:14 moritz_ rakudo: class A { }; say A
16:14 p6eval rakudo 690e37: OUTPUT«A()␤»
16:14 masonkramer well, is what I just posted correct?
16:14 moritz_ masonkramer: there's a known bug that in some situations they can't stringify
16:15 satyavvd left #perl6
16:15 arthur-_ arnsholt: the doc I have on C is : http://www.mongodb.org/disp​lay/DOCS/C+Language+Center
16:15 arnsholt Yeah, I just found that
16:15 arthur-_ arnsholt: "$ scons # this will produce libbson.a and libmongoc.a"  , this is what I need no ?
16:16 cls_bsd left #perl6
16:16 moritz_ looks like a static lib to me
16:16 arthur-_ oh
16:16 arnsholt Yeah
16:16 moritz_ .a is static, .so dynamic
16:16 arthur-_ ok
16:17 masonkramer moritz_: thanks, I was going a bit crazy there.  I'm still not sure which bugs are BCAK and which aren't
16:17 arnsholt There's a recent commit message that mentions support for shared libs, but I don't know how well it would work
16:17 arnsholt They say it's alpha, so it might be a bit fiddly
16:18 arthur-_ arnsholt: they say how to make the .so file ?
16:18 arnsholt But if you got that built and installed as a shared lib, it whould be pretty straightforward
16:18 arnsholt See https://github.com/mongodb/mongo-c-driver
16:18 arnsholt The commit messages on .gitignore and SConstruct say that the changes were for adding support for shared lib, but that's all I know
16:18 arthur-_ gcc -o libmongoc.so -shared src/md5.os src/mongo.os src/bson.os src/numbers.os -L/opt/local/lib
16:19 arnsholt Not that simple, AFAIK
16:20 arthur-_ ok I have a libmongoc.so , let's try it
16:21 arthur-_ that is cool, I understand C way better
16:21 arnsholt C is a lot easier to understand =)
16:25 masonkramer Why does C<for> call .pairs on an object?  Shouldn't it be .iterator?
16:25 arthur-_ arthur@aquarelle /t/zavolaj> perl6 examples/mongodb.p6
16:25 arthur-_ 3
16:25 arthur-_ fish: Tâche 1, 'perl6 examples/mongodb.p6 ' terminée par le signal SIGSEGV (Erreur de frontière d'adresse)
16:25 masonkramer oh, I see
16:25 arthur-_ never been so happy to see SIGSEGV : something is happening !
16:26 masonkramer It's EnumMap calling .pairs.iterator
16:28 kanishka joined #perl6
16:30 molaf joined #perl6
16:32 masak oh. a real run of the spectests reveals that I mucked up the longest-token property. I think I can fix that easily.
16:35 xinming joined #perl6
16:35 arthur-_ wooo ! 17:34:36 connection accepted from 127.0.0.1:51556 #3
16:35 arthur-_ connection !
16:38 fhelmberger joined #perl6
16:39 kanishka left #perl6
16:41 arthur-_ jnthn, arnsholt, tadzik , know how I make and pass a struct-thing to a function defined with NativeCall ?
16:42 arthur-_ if I pass an empty object it does not connect, If I pass a pir::null__P(), it connects ( woot ! ) but then fails with a Null PMC access in isa_pmc() error
16:43 arthur-_ function I'm trying to interface : https://github.com/mongodb/mongo-​c-driver/blob/master/src/mongo.c line 140
16:43 kanishka joined #perl6
16:49 arthur-_ said otherwise : I need to convert this C : mongo_connection_options opts[1];   into a Perl6+NativeCall
16:49 arthur-_ then feed it to mongo_connect
16:50 kanishka left #perl6
16:50 arthur-_ but all NativeCall code I can find only passes to functions OpaquePointers returned by function calls, or simple things like strings
16:51 moritz_ you'll need OpaquePointers for that too
16:52 REPLeffect left #perl6
16:52 REPLeffect joined #perl6
16:54 arthur-_ moritz_: yes that's what I want to do, create an OpaquePointer, set some things in it ( hostname, port ) , then feed it to connect, but I don't find in the examples how to do that
16:54 masonkramer do we want C<for $bag -> $i { ... } > to iterate over its keys? If not - how do we want to unroll Bags?
16:55 arthur-_ all the source says is : class OpaquePointer { }
16:55 kanishka joined #perl6
16:55 arthur-_ not much
16:57 REPLeffect left #perl6
16:58 jnthn arthur-_: That's the point
16:58 jnthn It's opaque
16:58 jnthn You're meant to obtain one from somewhere
16:59 jnthn If you need to create and fill a struct "from scratch" rather than getting one back from a C function, there's not a way to do that yet in Zavolaj. :(
16:59 arthur-_ oh
17:00 jnthn The MySQL API gets awya wiht needing this though. It has something that makes and returns the connection object
17:00 jnthn But I don't see anything in the API here that does that. :S
17:00 REPLeffect joined #perl6
17:01 toebu joined #perl6
17:01 masak rakudo: my %h; say %h.min: *.value
17:01 arthur-_ jnthn: ok, so I need to add a function to the lib
17:01 p6eval rakudo 690e37: OUTPUT«Inf␤»
17:01 masak this just bit me. I expected to get a Pair out, because I didn't consider the case where the hash is empty.
17:01 masak not sure it's a bug, though.
17:01 masak just something to watch out for.
17:02 arthur-_ jnthn: for now I could get away with the default options, but for that I need to pass something that will make option false in if ( options ){  ( https://github.com/mongodb/mongo-​c-driver/blob/master/src/mongo.c line 146 )
17:02 arthur-_ jnthn: but I don't find how
17:03 toebu left #perl6
17:03 arthur-_ passing an empty OpaquePointer makes it not connect
17:03 jnthn arthur-_: Try passing a pir::null__P()
17:03 arthur-_ jnthn: gives me an error
17:03 arthur-_ ( 1sec )
17:03 moritz_ write another C function that returns such a struct from primitive C type
17:04 arthur-_ Null PMC access in isa_pmc()
17:04 arthur-_ in '&infix:<=>' at line 1
17:04 arthur-_ in main program body at line 11:examples/mongodb.p6
17:05 jnthn Hm.
17:05 jferrero joined #perl6
17:05 arthur-_ moritz_: that is what I will do eventually, but just to be able to go further today without writing C, I want to try having it using it's default options
17:06 arthur-_ ( and passing pir::null__P() like in the mysql driver gives an error )
17:06 jnthn Yeah, I was gonna say, I'm sure it works in the mysql one...
17:08 M_o_C joined #perl6
17:09 icwiener left #perl6
17:10 arthur-_ jnthn: http://pastebin.com/2GGLcZeY , I'm doing it like in the mysql one
17:15 fhelmberger left #perl6
17:15 risou_ joined #perl6
17:16 arthur-_ jnthn: I see the connection in the mongodb logs, so the C-part seems to work ... the problem is probably after the call to the C lib, but the NativeCall.pm6 file makes no sense to me
17:16 risou left #perl6
17:20 arthur-_ ( maybe ) the error occurs at line 1106 in NativeCall.pir :     $P384 = "&infix:<=>"($P377, $P383)
17:20 arthur-_ does not make any sense to me
17:21 arthur-_ or line 2689
17:24 REPLeffect left #perl6
17:25 timbunce left #perl6
17:26 REPLeffect joined #perl6
17:27 FlamingRed left #perl6
17:27 masonkramer after making head rakudo, when I run perl6: Incompatible versions of `perl6_ops' oplib. Found 2.8.0 but loaded 2.9.1
17:28 wamba left #perl6
17:28 ggoebel joined #perl6
17:28 masonkramer nevermind
17:31 REPLeffect left #perl6
17:31 kanishka left #perl6
17:32 timbunce joined #perl6
17:34 arthur-_ this: http://pastebin.com/K71cZGtf produces a "Type check failed for assignment" error, I'm guessing it is because I don't return a pointer or something, how do I get a pointer for something in C ?
17:38 moritz_ but wouldn't you get an "type check failed in return" if it were the return line?
17:39 moritz_ and don't return pointers to local variables in subroutines, they are on stack and get re-used when the function exits
17:39 arthur-_ I get a Type check failed for assignment for this line : my OpaquePointer $options = make_mongo_connection_options('localhost', 27017);
17:39 arthur-_ so it does not return a OpaquePointer
17:39 arthur-_ but I just noticed compiling the lib gives warnings :
17:39 arthur-_ src/mongo.c: In function ‘make_mongo_connection_options’:
17:39 arthur-_ src/mongo.c:36: warning: return from incompatible pointer type
17:39 arthur-_ src/mongo.c:36: warning: function returns address of local variable
17:40 moritz_ right, that's what I meant
17:40 arthur-_ moritz_: so if I don't return a pointer to a local variable, how do I do in C a function that returns a pointer to a mongo_connection_options struct ?
17:41 moritz_ arthur-_: you use malloc() to allocate a new struct
17:41 arthur-_ urk !
17:41 arthur-_ this is getting more and more complicated
17:42 arthur-_ moritz_: how would you do it ? ^^
17:42 moritz_ yes, urk!. It's C, of course it's irksome
17:42 moritz_ I'd do it with malloc
17:42 arthur-_ can you help a little by showing how you would rewrite http://pastebin.com/K71cZGtf ?
17:43 arthur-_ ( if it's not too much code )
17:43 * arthur-_ goes searching doc on malloc
17:44 * arthur-_ fears he will have to worry about free()
17:44 moritz_ mongo_connection_options *opts = (*mongo_connection_options) malloc(sizeof mongo_connection_options);
17:45 moritz_ rest should remain the same
17:45 arthur-_ ok I try it, thanks
17:45 moritz_ and after you stop using it, you need to free() the option (but not in the function, but in its caller)
17:45 arthur-_ ok
17:45 moritz_ though my C is a bit rusty at the moment
17:46 REPLeffect joined #perl6
17:48 arthur-_ moritz_: src/mongo.c:33: error: expected expression before ‘mongo_connection_options’
17:48 tadzik duh, I thought there is silence on the channel, and it was my ssh session which was frozen
17:49 moritz_ uhm, did I confuse the casting syntax with C++ again?
17:50 arthur-_ sizeof feeds (), that's all I was able to see and correct
17:50 arthur-_ the rest I don't know
17:50 justatheory joined #perl6
17:50 arthur-_ s/feeds/needs/
17:52 kanishka joined #perl6
17:52 REPLeffect left #perl6
17:54 arthur-_ mongo_connection_options * make_mongo_connection_options( char host[255], int port ){
17:54 arthur-_ mongo_connection_options *opts = malloc(sizeof(mongo_connection_options));
17:54 arthur-_ strcpy( opts->host , host );
17:54 arthur-_ opts->port = port;
17:54 arthur-_ return opts;
17:54 arthur-_ no compilation error, but perl6 typecheck error
17:54 timbunce left #perl6
17:55 moritz_ so what's the exact error message?
17:55 toebu joined #perl6
17:55 toebu left #perl6
17:56 arthur-_ arthur@aquarelle /t/zavolaj> perl6 examples/mongodb.p6
17:56 arthur-_ Type check failed for assignment
17:56 arthur-_ in '&infix:<=>' at line 1
17:56 arthur-_ in main program body at line 14:examples/mongodb.p6
17:56 arthur-_ line 14 is : my OpaquePointer $options = make_mongo_connection_options('localhost', 27017);
17:57 tadzik arthur-_: the new NCI may land in a few days, that'd probably open a way to create/introspect structs, and stuff
17:58 moritz_ arthur-_: if you remove the type constraint from the variable, and in the line after   say $options.WHAT;  what's the result?
17:59 arthur-_ moritz_: I look
17:59 arthur-_ tadzik: nice !
18:00 tadzik arthur-_: actually, it's only not merge because no one wants to fight with svn merge while git is so close
18:00 arthur-_ Method 'WHAT' not found for invocant of class 'UnManagedStruct'
18:00 tadzik heh
18:00 moritz_ there you go, you get an UnManagedStruct and not an OpaquePointer
18:00 arthur-_ oh
18:01 tadzik "answer 4 not available for 2 + 2"
18:01 arthur-_ oh so I just type it to UnManagedStruct
18:01 arthur-_ trying
18:02 arthur-_ In "my" declaration, typename UnManagedStruct must be predeclared (or marked as declarative with :: prefix) at line 14, near " $options "
18:02 moritz_ just omit the type constraint for now
18:02 arthur-_ moritz_: yes, worked !
18:02 arthur-_ thanks !
18:04 arthur-_ oh no it does not connect
18:04 arthur-_ maybe because I pass $options to mongo_connect, and mongo_connect wants Opaque : sub mongo_connect( OpaquePointer $client, OpaquePointer $options)
18:05 arthur-_ not good
18:07 arthur-_ but sub make_mongo_connection_options( Str $host, Int $port ) returns OpaquePointer
18:07 arthur-_ so why does it give me a UnManagedStruct
18:07 REPLeffect joined #perl6
18:08 moritz_ no idea
18:09 arthur-_ maybe I won't have a perl6 mongodb driver today after all ...
18:09 meppl left #perl6
18:10 arthur-_ tadzik: you thing the new NCI will fix this ?
18:10 Chillance left #perl6
18:11 arthur-_ ( or help me understand what I do wrong )
18:11 mberends joined #perl6
18:12 tadzik arthur-_: the new NCI would enable you to peek inside structs, modify them, and stuff (iirc)
18:12 tadzik oh wait, I'm wrong
18:12 tadzik forget I said anything
18:12 arthur-_ ouch
18:12 arthur-_ forgot
18:14 tadzik so the only way to introspect structs is probably to write a C library for it, Zavolaj-friendly
18:14 tadzik with getters and setters
18:15 risou_ left #perl6
18:15 moritz_ or write a function that pack into / unpack from structs
18:15 jnthn Zavolaj needs to be extended at some point to support structs.
18:15 jnthn It's on the todo list once the new NCI lands.
18:15 jnthn It's also non-trivial to write. :)
18:16 tadzik jnthn: does this rely on the new NCI?
18:18 arthur-_ jnthn: do it now ^^
18:18 meraxes left #perl6
18:18 tadzik jnthn: what skills does that require?
18:19 tadzik yay, I can compile Rakudo on feather \o/
18:19 tadzik that opens a way to smoketesting again
18:19 plobsing what about different representational polymorphism? wasn't that supposed to be the 6-ish way of handling structs?
18:20 plobsing s/different//
18:20 moritz_ plobsing: jnthn is working on it (though not primarily for NCI purposes), but it's going to take some time
18:21 REPLeffect left #perl6
18:22 dalek rakudo: 2c66f9a | masak++ | src/core/Cool-str.pm:
18:22 dalek rakudo: [src/core/Cool-str.pm] 500% speedup of .trans
18:22 dalek rakudo:
18:22 dalek rakudo: Keep a hash with the next index of each substring to be substituted,
18:22 dalek rakudo: and then pick the smallest one through each iteration. (Or, more
18:22 dalek rakudo: informally, "skip the boring parts".) This makes the number of
18:22 dalek rakudo: iterations through the main loop proportional to the number of
18:22 dalek rakudo: substitutions actually made.
18:22 dalek rakudo: review: https://github.com/rakudo/rakudo/commit/​2c66f9a19607046e4d6ceffbbfb7b47710286c2f
18:22 arthur-_ so nobody knows why it returns a UnManagedStruct instead of a OpaquePointer ?
18:22 REPLeffect joined #perl6
18:23 jnthn tadzik: Mostly, understanding meta-model bits enough to be able to pull data out of objects and construct Parrot unmanagedstructs and map back again later
18:23 jnthn tadzik: It's more fiddly than anything, and I suspect hard to debug when you hit problems.
18:23 jnthn tadzik: Feel free to have a try. :-)
18:23 jnthn arthur-_: Nothing ever returns OpaquePointer, fwiw. It's just a place-holder name.
18:24 tadzik hmm, I'd have to hit deeper into Parrot, and I still have no opportunity
18:24 arthur-_ jnthn: my brain exploded
18:25 arthur-_ seems writing a mongodb driver is too hard for me
18:27 tadzik maybe the NCI stuff is a good topic for Advent Calendar then?
18:27 moritz_ or maybe not :/
18:28 * arthur-_ wants lots of doc on NCI
18:28 masak blog post! http://strangelyconsistent.org/blog/​november-7-2010-man-we-suck-at-this
18:28 REPLeffect left #perl6
18:29 toebu joined #perl6
18:30 meraxes joined #perl6
18:31 REPLeffect joined #perl6
18:31 arthur-_ ok I give me 2 more hours to get this working
18:34 arthur-_ jnthn: the code if you have time to help : http://pastebin.com/Z4vZ2qtw
18:39 meppl joined #perl6
18:45 arthur-_ is there a perl6-help mailing list or something ?
18:45 moritz_ there's perl6-users@perl.org
18:45 arthur-_ ok
18:46 arthur-_ writing there, maybe I can get some help
18:46 masak yes! use it! it sees way too little traffic these days.
18:46 masak tadzik++ moritz_++ # using it the other day
18:49 jnthn dinner &
18:49 masak ooh! good idea!
18:50 tadzik on 8 PM?
18:51 masak is that unusual?
18:51 toebu left #perl6
18:51 tadzik I'm usually too hungry before 8 PM to resist with dinner so long
18:51 masak hey! Haskell 2010 (formerly known as Haskell Prime) has been released!? http://www.haskell.org/onlinereport/haskell2010/
18:51 masak tadzik: me too. but I got up late today.
18:53 tadzik masak: I got up at like 1 PM
18:53 masak :)
18:53 tadzik is it something like R* for Haskellers?
18:54 moritz_ tadzik: it's a document, not a distribution
18:54 masak tadzik: Haskell Prime has been a long time coming.
18:55 masak it's had issues similar to Perl 6, in that it tries to improve on something already successful.
18:55 toebu joined #perl6
18:55 moritz_ how much of it does GHC implement?
18:55 masak no idea.
18:55 kjeldahl_ left #perl6
19:01 toebu left #perl6
19:07 masak some people on this channel might enjoy MJD's talk about git: http://perl.plover.com/yak/git/
19:08 kanishka left #perl6
19:08 masak om nom nom &
19:08 masak left #perl6
19:13 patspam left #perl6
19:14 MayDaniel left #perl6
19:16 REPLeffect left #perl6
19:19 REPLeffect joined #perl6
19:21 kjeldahl left #perl6
19:25 REPLeffect left #perl6
19:31 kanishka joined #perl6
19:34 tri joined #perl6
19:36 zorgnax joined #perl6
19:38 REPLeffect joined #perl6
19:46 REPLeffect left #perl6
19:47 kjeldahl joined #perl6
19:47 REPLeffect joined #perl6
19:55 zorgnax left #perl6
20:01 masonkramer did my Bag / Set ideas letter make it to the mailing list?
20:09 diakopter I think so
20:16 arthur-_ and my Problem with NativeCall one ?
20:20 diakopter to which list was that one sent
20:22 arthur-_ perl6-users
20:22 arthur-_ found it ! ( at least the first part, the problem with isa_pmc() ) , well at least fixed it by removing returns OpaquePointer
20:28 araujo http://pastie.org/1276960
20:32 REPLeffect left #perl6
20:33 REPLeffect joined #perl6
20:39 arthur-_ jnthn: any Idea what could give me this error ? No NCI thunk available for signature 'iptt'
20:39 arthur-_ while doing something like that : sub mongo_count( OpaquePointer $client, Str $db, Str $ns, Str $a ) returns Int is native('libmongoc') { ... }
20:41 timbunce joined #perl6
20:41 timbunce left #perl6
20:45 nexusone left #perl6
20:50 Onepamopa joined #perl6
20:52 Onepamopa left #perl6
20:58 patspam joined #perl6
20:58 patspam left #perl6
21:08 nexusone joined #perl6
21:16 arthur-_ plobsing: how do I use parrot-libjit-fb in Perl6 ? ( if I can )
21:17 moritz_ araujo: what is 'no'?
21:23 lichtkind joined #perl6
21:25 plobsing arthur-_: all you have to do is load the library. then it takes over the NCI using the same interface.
21:26 plobsing so it should work transparently from under zavolaj
21:26 arthur-_ use NativeCall; ?
21:27 rgrau` left #perl6
21:27 plobsing you'll need to also loadlib it. probably "pir::loadlib__s('libjit_fb')" or something like that
21:27 arthur-_ I try
21:28 arthur-_ ===SORRY!===
21:28 arthur-_ rtype not set
21:28 plobsing rtype?
21:29 arthur-_ plobsing: don't know ....
21:29 moritz_ arthur-_: it means that you tried to assign something which is read-only
21:29 arthur-_ moritz_: oh ok
21:30 arthur-_ not sure where, I just added the loadlib thing
21:30 arthur-_ plobsing: code is here : http://pastebin.com/FTXfDtWV
21:33 sorear (Out of curiousity, why aren't you using Perl 5?)
21:33 wallberg joined #perl6
21:33 arthur-_ sorear: ?
21:36 plobsing arthur-_: submitted update to code that I think should work
21:37 arthur-_ plobsing: update ?
21:38 plobsing to your pastebin
21:38 plobsing basically s/__s/__ps/
21:39 arthur-_ plobsing: I'm not sure where I can see it ... I try s/__s/__ps/
21:39 arthur-_ plobsing: no bug, but same problem as without libjit-fb :
21:39 arthur-_ No NCI thunk available for signature 'ipttp'
21:40 araujo moritz_, false
21:40 arthur-_ ( I think I understood that libjit-fb was supposed to avoid creating that problem, but I'm not sure )
21:41 moritz_ http://perlgeek.de/article/dis​covering-meta-object-protocol # any feedback?
21:41 plobsing arthur-_: that is precicely the problem  libjit-fb as well as gsoc_nci are trying to address
21:42 arthur-_ plobsing: so why do I still have the problem, I do something wrong ?
21:43 plobsing I think somehow it is trying to build a thunk *before* the dynamic framebuilder is loaded
21:43 plobsing I'm setting up the required infrastructure (mongo install, r* install) to be able to test further
21:43 arthur-_ thanks a lot
21:46 masak joined #perl6
21:46 mkramer moritz_: just the title is exciting to me!  Awesome topic.  Reading it now
21:46 masak o/
21:47 arthur-_ ( for mongodb I try to use the C lib : https://github.com/mongodb/mongo-c-driver )
21:47 moritz_ \o masak
21:47 moritz_ masak: I just pasted http://perlgeek.de/article/dis​covering-meta-object-protocol in the backlog, and would welcome your feedback
21:48 diakopter moritz_++
21:48 masak ah, so that's the exciting title :)
21:48 * masak reads
21:49 tri left #perl6
21:49 lue happy end of daylight savings! (in the US at least)
21:50 diakopter in the US *except* Hawaii :)
21:50 diakopter (and other exceptions in the USA)
21:51 mkramer I hope you will disect the final code snippet piece by piece.  Why is the method .^add_method named with a ^ in front? what is ^compose?  Where can I learn more about ClassHOW?
21:52 moritz_ mkramer: thanks; I meant to explain ^, but forgot it
21:54 lue Would the [% %] I read about in the Web.pm README be the way to embed P6 in webpages like you can in PHP?
21:55 flussence s/in PHP/in Template Toolkit/
21:55 flussence ;)
21:56 lue So it's not like how you embed PHP in .php files?
21:56 masak moritz_: nice post.
21:56 masak moritz_: I have no comments on content, except that I found the semicolon at the end of method greet misplaced.
21:56 * moritz_ revmoes
21:59 flussence I'll admit I haven't actually *looked* at Web.pm yet, but the difference between PHP and TT is that TT has its own template code unless you explicitly ask for perl via a [%PERL%] block.
22:00 flussence at this stage of development, Web.pm probably does the PHP thing, yeah :/
22:00 wallberg left #perl6
22:01 flussence (or not, considering how easy it is to write a template language in p6 :)
22:01 moritz_ mkramer, masak: incorporated your feedback, thanks
22:02 moritz_ mkramer: I don't actually know where to read more about ClassHOW, because we don't have a proper API spec
22:02 toebu joined #perl6
22:02 lue Because I would like to start experimenting with using P6 on the web so that I can build a site when I can host it somewhere.
22:03 mkramer Anyway, nifty post, thanks
22:05 wallberg joined #perl6
22:05 wallberg left #perl6
22:08 lue maak: I just can't get test 29..46 of compiler.t compiling, so I think its somewhat safe to say what I add doesn't break those tests
22:09 lue sorry, masak (stupid keyboard)
22:10 toebu a little problem :-) a program about mice: start with one female mouse ... after 10 weeks it bears 6 kids ... 3 female, 3 male ... after that it bears a new set every six weeks ... all females are fertile ... mice do not die ... how many mice do you have after x weeks ... find a cool way two program this in perl6 ...
22:13 Tene toebu: how many weeks before females are fertile, or are they fertile at birth?
22:13 moritz_ toebu: 1) find a solution 2) make it cool (while keeping it correct)
22:14 flussence looks like a straightforward algebra thing to me...
22:14 moritz_ flussence: the 10 weeks vs. 6 weeks thing makes it a bit harder than fibonacci
22:15 nexusone left #perl6
22:15 moritz_ if that wasn't teh case, female poluation would be 1, { 3 * $_ + 1 } ... *
22:15 masak masonkramer++ # p6l email
22:16 moritz_ and @male := @female.map: 2 * * - 1
22:16 masak masonkramer: I may not agree with all of your suggestions, but I agree very much with the need to explore that spec space.
22:16 * moritz_ -> sleep
22:16 masak lue: did you get those tests to pass on a fresh checkout of Yapsi?
22:17 lue checkout on the whole thing?
22:17 masak yes.
22:17 masak because if they fail on an unmodified Yapsi, then we have a problem.
22:17 masak but I don't believe they do, since they work here.
22:18 Raynes left #perl6
22:19 toebu Tene: females get fertile after 4 weeks ... and have their first kids after another 6 ... hence 10 weeks for the first generation
22:20 toebu moritz_ got the correct solution already ... (I need 11 integers for it ...) but I wonder how others would solve this
22:20 lue git stash ; git checkout [commands] # right?
22:20 Guest22875 joined #perl6
22:21 masak lue: `git stash` should give you a clean index.
22:22 masak and if you haven't made any local commits, that's the same as getting a clean checkout.
22:22 masak but... make sure you don't have old .pir files anywhere.
22:22 lue WIP on master: cce1b5a [doc/announce/2010.11] small fix
22:22 toebu after 52 weeks there are 4423 mice
22:23 lue is that what my stash should look like?
22:23 arthur-_ plobsing: any progress ?
22:23 masak lue: yes, that's the latest commit on github.
22:24 * masak bumps the SIC version
22:25 lue where would these old .pir files be?
22:25 masak in lib/ or blib/
22:25 plobsing arthur-_: mongodb build giving me grief
22:25 risou joined #perl6
22:25 lue The only thing is Yapsi.pir in blib/lib
22:25 kjeldahl left #perl6
22:26 arthur-_ plobsing: oh ok, tell me if I can help
22:27 masak lue: nuke it.
22:28 dalek yapsi: 74884bf | masak++ | lib/Yapsi.pm:
22:28 dalek yapsi: [Yapsi] bumped SIC version
22:28 dalek yapsi:
22:28 dalek yapsi: Between releases, the SIC version is always the version number of the
22:28 dalek yapsi: upcoming release.
22:28 dalek yapsi: review: https://github.com/masak/yapsi/commit/7​4884bfe49f8676f57d00eafc0bd0a0b8f370df0
22:28 masonkramer left #perl6
22:28 lue initiating missile...
22:28 masonkramer joined #perl6
22:30 plobsing arthur-_: problem is likely on my end. I was trying to run multiple builds simultaneously. retrying unloaded.
22:31 lue aah! Should I proceed to nuking the entire repo? [then re-clone it of course]
22:32 masak lue: no, why?
22:32 masak lue: do the tests pass now?
22:33 lue no :(
22:33 kensanata joined #perl6
22:33 masak then yes, maybe nuke the repo and do a clean check-out.
22:33 Plastic_Chicken left #perl6
22:33 masak now would be the time to rescue your changes, though.
22:34 lue I just looked at t/compiler.t
22:34 lue ...
22:34 lue 29-46 are meant to say "will not compile", aren't they? [hand approaches forehead...]
22:35 masak lue, a test passes if it says "ok". are we agreed on this?
22:35 lue yes. [sorry for wasting time]
22:36 masak I take your reply as meaning that we are agreed, but that you learned it very recently. :)
22:36 masak does that mean that your patch actually passes all the test? that's good news, then.
22:38 lue I ignored the ok's by mistake, and when I saw "not"s, I immediately went into "O NOES WONT PASS!" mode
22:38 mavrc left #perl6
22:39 lue .oO(Please wait while at least a couple new tests are written for the patch.)
22:39 masak I don't meet a lot of people in my trade who are unfamiliar with TAP. had I not assumed you were familiar with it, I might have realized sooner what was amiss.
22:40 sorear good * #perl6
22:40 masak sorear: \o
22:41 lue Just so you know, I'm eligible to apply for Google Code-In :)
22:46 M_o_C left #perl6
22:49 _kaare left #perl6
22:50 * masak -> zzz
22:50 masak left #perl6
22:59 rgrau_ joined #perl6
23:04 arnsholt left #perl6
23:08 toebu left #perl6
23:15 Grrrr left #perl6
23:17 lue phenny: tell masak Here's your Yapsi patch: https://gist.github.com/667105
23:17 phenny lue: I'll pass that on when masak is around.
23:19 meppl left #perl6
23:20 Grrrr joined #perl6
23:29 awwaiid_ joined #perl6
23:29 awwaiid_ p6eval: "README" ~~ :e
23:29 awwaiid_ er
23:30 awwaiid_ rakudo: "README" ~~ :e
23:30 p6eval rakudo 2c66f9: OUTPUT«Method 'e' not found for invocant of class 'Str'␤  in 'Enum::ACCEPTS' at line 5246:CORE.setting␤  in main program body at line 10:/tmp/_rex9Endx9␤»
23:30 awwaiid_ so, does ~~ :e not work because it isn't done, or because that's not how it works anymore? :)
23:31 awwaiid_ As an excercise, I'm building me a wiki, you see, and am sticking pages into their own files. So I wanna see if a page exists.
23:32 sorear rakudo: "README".IO ~~ :e
23:32 p6eval rakudo 2c66f9:  ( no output )
23:32 sorear rakudo: say "README".IO ~~ :e
23:32 p6eval rakudo 2c66f9: OUTPUT«Bool::True␤»
23:32 sorear there's no current spec for this stuff
23:33 toebu joined #perl6
23:33 awwaiid_ ok, thanks
23:34 arthur-_ plobsing: going to .zZzZ , please tell me if you find something, good luck !
23:34 plobsing will do
23:35 sorear TimToady: ping
23:36 awwaiid_ sorear: I've added a small note to the wiki tablet at http://www.perlfoundation.org/perl6/inde​x.cgi?perl_6_lookup_tablet#filetest_ops
23:38 sorear TimToady: I'd like some clarification on how S05:1225 is supposed to work
23:39 sorear if you have something like token foo($str) { $str }; / [ foo | <foo("foo" ~ "bar")> ] /, does the LTM engine evaluate the expression?
23:41 toebu left #perl6
23:41 sorear awwaiid_: $file.:x is wrong in any event
23:42 sorear syntactically, even
23:44 awwaiid_ unrelatedly, %*ENV doesn't like me much -- I can get individual values out, but %*ENV.perl or %*ENV.keys gets mad.
23:44 awwaiid_ perl6: say %*ENV.keys.perl
23:44 p6eval rakudo 2c66f9: OUTPUT«Method 'key' not found for invocant of class 'String'␤  in <anon> at line 5017:CORE.setting␤  in 'Any::join' at line 1␤  in 'List::perl' at line 2675:CORE.setting␤  in main program body at line 22:/tmp/bvykKgjKAI␤»
23:44 p6eval ..pugs: OUTPUT«*** Can't modify constant item: VUndef␤    at /tmp/zRa6Cu1c9Q line 1, column 5 - line 2, column 1␤       /tmp/zRa6Cu1c9Q line 1, column 5 - line 2, column 1␤»
23:47 sorear %*ENV in Rakudo is not a real hash
23:47 sorear it's a ugly half-implemented wrapper over the Parrot unique EnvHash object
23:51 toebu[s9] joined #perl6
23:56 PacoLinux left #perl6

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

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs