Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2014-12-31

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:02 [Coke] lizmat;yes. adu: yes.
00:03 adu yeah, perl6-m $(which panda) works fine
00:18 BenGoldberg joined #perl6
00:23 KCL_ joined #perl6
00:32 adu joined #perl6
00:33 adu what's the recommended way to parse command-line arguments?
00:51 skids joined #perl6
00:53 japhb adu: Use the built-in command-line parsing based on signature introspection of MAIN
00:55 adu japhb: thanks!
00:55 adu how do I set default, optional and required parameters?
00:55 japhb (As an example, `bench` in https://github.com/japhb/perl6-bench uses this extensively.  Details of implementation are in src/core/Main.pm in Rakudo.)
00:56 adu japhb: so MAIN (:$output = "-")?
00:57 japhb adu: multi sub MAIN($required, $defaulted = "foo", $optional?, :$option, :$required_option!, :$option-with-default = "bar")
00:57 adu :)
00:58 japhb Also, if you run the command with -? or --help, you will get auto-generated help text.  You can put your own line of help after each variant using #| style doc comments above each multi sub MAIN.
00:58 adu that's super cool
00:58 japhb :-)
01:05 japhb What's the IRC name that matches 'zhuomingliang' on GitHub?
01:07 [Coke] I never had adu's panda problem, btw.
01:08 adu [Coke]: I never had this problem until I upgraded to Yosemite
01:08 [Coke] ah. still on 10.9 here.
01:10 Ven adu: you might be interested in my advent blog post "the cool subset of main" :P (self-plug ftw)
01:10 Ven japhb: JimmyZ I think
01:10 adu Ven: thanks
01:10 japhb Ven: thanks
01:11 dayangkun joined #perl6
01:12 adu oOo NonFile?
01:14 Ven adu: yes?
01:15 Ven (might want to have that third eye checked out)
01:15 adu does perl6 have switch-case?
01:16 Ven adu: given / when does that
01:28 raiph joined #perl6
02:05 Ven left #perl6
02:05 Ven joined #perl6
02:06 adu joined #perl6
02:20 rmgk_ joined #perl6
02:31 jack_rabbit joined #perl6
02:36 adu omg, I feel so stupid
02:36 adu I can't make a function
02:36 flussence sub foo { :) }
02:36 adu http://pastie.org/9805990
02:37 adu but when I do my $ast = C::Parser::parse("int x;");
02:37 flussence ah, a *function* not a sub... yeah, that's harder.
02:37 adu huh?
02:37 adu why is it harder?
02:37 flussence just being silly, don't mind me... :)
02:38 adu it doesn't work
02:38 adu "Could not find symbol '&parse'"
02:39 flussence oh... hm.
02:39 adu do I need a public ... sub
02:39 adu ?
02:39 flussence stick "is export" on it? (I don't think that'll help, sounds like something weird may be going on)
02:39 adu hmm
02:45 flussence if you rename sub parse to something that's not named "parse" exactly, does it work then?
02:45 adu flussence: nope
02:45 flussence okay, it's not weird symbol collisions at least. I vaguely recall having to avoid things like that in the past.
02:48 lue joined #perl6
02:48 flussence r: module P { sub parse($l) { $l } }; say P::parse(1); # golfed down a bit
02:48 camelia rakudo-parrot 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at gen/parrot/CORE.setting:13811␤  in any find_method_fallback at gen/parrot/Metamodel.nqp:2807␤  in any find_method at gen/parrot/Metamodel.nqp:989␤  in any  at gen/parrot/BOOTSTRAP.nqp:1708␤  …»
02:48 camelia ..rakudo-moar 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at src/gen/m-CORE.setting:13871␤  in any find_method_fallback at src/gen/m-Metamodel.nqp:2737␤  in any find_method at src/gen/m-Metamodel.nqp:988␤  in block <unit> at /tmp/tmpfile:1␤␤»
02:51 flussence well I'm staring at this and can't see what's wrong... so either you're not crazy or we both are :)
02:55 Ven r: module P { our sub parse($l) { $l } }; say P::parse(1);
02:55 camelia rakudo-{parrot,moar} 80b912: OUTPUT«1␤»
02:55 Ven :)
02:56 flussence bah, I tried every scope thing I could think of *but* that...
02:56 adu I've never seen "our" in front of sub
02:57 adu r: module P { sub parse($l) is export { $l } }; say P::parse(1);
02:57 camelia rakudo-parrot 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at gen/parrot/CORE.setting:13811␤  in any find_method_fallback at gen/parrot/Metamodel.nqp:2807␤  in any find_method at gen/parrot/Metamodel.nqp:989␤  in any  at gen/parrot/BOOTSTRAP.nqp:1708␤  …»
02:57 camelia ..rakudo-moar 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at src/gen/m-CORE.setting:13871␤  in any find_method_fallback at src/gen/m-Metamodel.nqp:2737␤  in any find_method at src/gen/m-Metamodel.nqp:988␤  in block <unit> at /tmp/tmpfile:1␤␤»
02:57 adu r: module P { method parse($l) { $l } }; say P::parse(1);
02:57 camelia rakudo-parrot 80b912: OUTPUT«Useless declaration of a has-scoped method in module (did you mean 'my method parse'?)␤Could not find symbol '&parse'␤  in method <anon> at gen/parrot/CORE.setting:13811␤  in any find_method_fallback at gen/parrot/Metamodel.nqp:2807␤  in any find…»
02:57 camelia ..rakudo-moar 80b912: OUTPUT«Useless declaration of a has-scoped method in multi (did you mean 'my method parse'?)␤Could not find symbol '&parse'␤  in method <anon> at src/gen/m-CORE.setting:13871␤  in any find_method_fallback at src/gen/m-Metamodel.nqp:2737␤  in any find_meth…»
02:58 flussence it feels like it should've worked to me, same as it would in Perl 5.
02:58 adu r: class P { method parse($l) { $l } }; say P::parse(1);
02:58 camelia rakudo-parrot 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at gen/parrot/CORE.setting:13811␤  in any find_method_fallback at gen/parrot/Metamodel.nqp:2807␤  in any find_method at gen/parrot/Metamodel.nqp:989␤  in any  at gen/parrot/BOOTSTRAP.nqp:1708␤  …»
02:58 camelia ..rakudo-moar 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at src/gen/m-CORE.setting:13871␤  in any find_method_fallback at src/gen/m-Metamodel.nqp:2737␤  in any find_method at src/gen/m-Metamodel.nqp:988␤  in block <unit> at /tmp/tmpfile:1␤␤»
02:59 adu r: class P { method parse($l) is export { $l } }; say P::parse(1);
02:59 camelia rakudo-parrot 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at gen/parrot/CORE.setting:13811␤  in any find_method_fallback at gen/parrot/Metamodel.nqp:2807␤  in any find_method at gen/parrot/Metamodel.nqp:989␤  in any  at gen/parrot/BOOTSTRAP.nqp:1708␤  …»
02:59 camelia ..rakudo-moar 80b912: OUTPUT«Could not find symbol '&parse'␤  in method <anon> at src/gen/m-CORE.setting:13871␤  in any find_method_fallback at src/gen/m-Metamodel.nqp:2737␤  in any find_method at src/gen/m-Metamodel.nqp:988␤  in block <unit> at /tmp/tmpfile:1␤␤»
02:59 adu r: class P { our method parse($l) is export { $l } }; say P::parse(1);
02:59 camelia rakudo-moar 80b912: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤  in method parse at /tmp/tmpfile:1␤  in block <unit> at /tmp/tmpfile:1␤␤»
02:59 camelia ..rakudo-parrot 80b912: OUTPUT«Type check failed in binding; expected 'P' but got 'Int'␤  in method parse at /tmp/tmpfile:1␤  in block <unit> at /tmp/tmpfile:1␤␤»
03:09 raydiak m: class P { our sub foo is export { say 42 }; method foo { foo }; }; P::foo; P.foo; import P; foo; # the 3 obvious options
03:09 camelia rakudo-moar 80b912: OUTPUT«42␤42␤42␤»
03:10 avuserow m: class P { method parse($l) { $l } }; say P.parse(1);
03:10 camelia rakudo-moar 80b912: OUTPUT«1␤»
03:10 romel left #perl6
03:18 avuserow adu: ^
03:18 avuserow oh I guess raydiak++ already showed that option :)
03:19 adu oh
03:19 adu raydiak++
03:19 raydiak fwiw, the general trend in P6 has been towards the is export solution, unless your interface is OO anyway, in which case you'd probably use a class method...calling with fully-qualified package name w/:: is less common, because unlike P5, subs are not paackage vars by default, so it doesn't work unless the author explicitly thought to add "our" all over the place
03:19 raydiak :)
03:26 adu raydiak: thanks for the help, I never used perl5, so this is all new to me
03:27 adu my interest in perl6 is almost entirely the mouth-watering grammars :)
03:29 raydiak ah, then yeah I'd go without the :: stuff unless you have a reason...just mark the sub as you pasted it with 'is export', and probably rename it to c-parse or something
03:30 raydiak and you're welcome of course
03:32 raydiak and from your users code that would look like 'use C::Parser; my $tree = c-parse(slurp "/usr/include/zmq.h");'
03:33 adu oh, I didn't know you didn't need the ::
03:35 raydiak yep, 'is export' in perl 6 means it gets aliased into the caller's namespace, so you don't worry about the package's name at all after the 'use' (which does 'import' too)
03:39 skids joined #perl6
03:39 adu I think I'll use the class/method version
03:44 noganex_ joined #perl6
03:46 ugexe_ joined #perl6
04:14 cbk1090 Is this how to remove a key from a hash... %aHash.delete($someKey);
04:14 raiph joined #perl6
04:25 adu joined #perl6
04:40 raydiak cbk1090: %aHash{$someKey}:delete;
04:41 cbk1090 raydiak, Thank you
04:43 lue joined #perl6
04:43 raydiak cbk1090: you're welcome
04:52 adu how would I represent an enum?
04:53 adu ah enum Bool <False True>
04:54 raydiak http://design.perl6.org/S12.html#Enumerations if you need to know more
04:55 sirdancealot joined #perl6
05:01 adu I figured out the AST!
05:06 kaare_ joined #perl6
05:08 raydiak sweet!
05:13 adu raydiak: my first test was on <ident> and instead of Match.new it says Identifier.new :)
05:14 raydiak adu: ah, the power... :)
05:14 adu lol
05:17 kaleem joined #perl6
05:17 raydiak coincidentally, I'm working in Math::Symbolic::Tree right now, starting to clean the project up and prepare to give it a real API very similar to what you're creating for C right now, but for math
05:19 adu raydiak: is it based on MathML/OpenMath?
05:19 adu raydiak: that's essentially what DROX is
05:20 raydiak adu: nah, I just wanted to write a math grammar, then wanted to make it useful for something, ended up with math::symbolic...it's pure perl
05:20 telex joined #perl6
05:20 xfix joined #perl6
05:25 raydiak adu: ah I see, looks like something I should learn...but no it just takes textual expressions for input...might be cool to give it the ability to read and write mathml
05:25 raydiak dinner
05:25 * adu <3 MathML
05:25 adu not 1 or 2, just 3
05:26 adu because it wasn't until MathML3 that it became compatible with the 10-component OpenMath model
06:05 mr-foobar joined #perl6
06:16 raydiak http://www.openmath.org/ seems down
06:21 adu http://webcache.googleusercontent.com/search?q=cache:-owbGSfrVT8J:www.openmath.org/+&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=us
06:21 JimmyZ raydiak: works here
06:21 adu not here
06:22 adu I'm also getting a wierd html response from something, but not openmath.org
06:23 adu raydiak: are you on IPv6?
06:25 dalek doc: 5a99b97 | (Konrad Borowski)++ | lib/Type/IO/Path.pod:
06:25 dalek doc: Fix method dir example in IO::Path
06:25 dalek doc:
06:25 dalek doc: It now uses IO, instead of Str to prevent depreciation warnings.
06:25 dalek doc:
06:25 dalek doc: Fixes #35.
06:25 dalek doc: review: https://github.com/perl6/doc/commit/5a99b973bd
06:25 dayangkun joined #perl6
06:25 xfix Argh, I was supposed to say path here, not Str.
06:25 xfix Oh well.
06:26 xfix (I like how in Fossil, you can change the commit description even after committing... you can do that in git as well, but it requires forced push that forks the repository)
06:27 adu raydiak: http://web.archive.org/web/20141219235328/http://www.openmath.org/
06:27 adu the web can never die
06:47 araujo joined #perl6
06:49 kaleem joined #perl6
07:05 __rnddim__ joined #perl6
07:07 * raydiak hopes someone creaates a mathml p6 module some day
07:08 Mso150 joined #perl6
07:30 chenryn joined #perl6
07:39 raydiak g'night #perl6
08:12 rindolf joined #perl6
08:15 darutoko joined #perl6
08:22 kjs_ joined #perl6
08:30 avalenn joined #perl6
08:37 rindolf joined #perl6
08:42 adu raydiak: good idea
09:09 KCL joined #perl6
09:43 kjs_ joined #perl6
09:58 sqirrel__ joined #perl6
10:01 stux|RC-only joined #perl6
10:20 kjs_ joined #perl6
10:28 Psyche^ joined #perl6
10:33 virtualsue joined #perl6
10:44 spider-mario joined #perl6
10:59 ilogger2 joined #perl6
11:02 chenryn joined #perl6
11:08 Ven joined #perl6
11:39 Ven joined #perl6
11:50 moritz \o
11:53 virtualsue joined #perl6
12:09 isleofmax joined #perl6
12:11 zakharyas joined #perl6
12:17 xinming joined #perl6
12:23 KCL_ joined #perl6
12:46 sqirrel__ joined #perl6
12:51 rurban joined #perl6
12:54 Ven o/ #perl6
12:59 smls joined #perl6
12:59 darutoko- joined #perl6
12:59 smls o/
13:00 smls My advent article won: http://i.imgur.com/OfKumKC.png :P
13:00 smls Technically because it was hackernews'ed, and not on its own merit, but whatever...
13:00 smls :)
13:08 moritz smls++
13:09 moritz a few years back we had a day with more than 10k page views
13:09 moritz that day it was on the slashdot front page, hackernews (which was much smaller back then), and Tim O'Reilly twittered about it
13:10 smls nice
13:10 moritz https://perl6advent.wordpress.com/wp-admin/index.php?page=stats&amp;blog=10740073&amp;day=2009-12-07
13:11 moritz ah yes, that was our first year
13:13 sirdancealot joined #perl6
13:24 timotimo https://i.imgur.com/A02GMnT.jpg - wat, that is pretty harsh
13:28 timotimo why are we still linking to https://raw.githubusercontent.com/mj41/Perl-6-GD/master/export/Summary%20-%20Compilers'%20features%20-%20GoodData.png as "summary chart" when it's from march 2014?
13:28 moritz we shouldn't
13:33 yeahnoob joined #perl6
13:38 leont joined #perl6
14:00 xfix timotimo, I personally wouldn't call OOP bad. It's just that OOP by default is awful.
14:00 xfix (and well, even with all fixes, object method call operator is still ugly ->)
14:01 xfix I actually somewhat like Perl 5 OOP model, but I also realize it's quite strange.
14:01 xfix It's flexible enough that there are libraries that make OOP easier.
14:02 zakharyas joined #perl6
14:16 yeahnoob|2 joined #perl6
14:19 yeahnoob joined #perl6
14:23 kjs_ joined #perl6
14:24 raiph joined #perl6
14:33 LLamaRider joined #perl6
14:48 estrabd joined #perl6
14:50 perlfan joined #perl6
14:51 gfldex joined #perl6
15:29 Ven smls++ # curse, foiled again!
15:30 salv0 joined #perl6
15:33 Rounin joined #perl6
15:36 skids joined #perl6
15:36 moritz tadzik: ping
15:38 telex joined #perl6
16:00 mvuets joined #perl6
16:00 mr-foobar joined #perl6
16:04 zakharyas joined #perl6
16:06 Spot__ joined #perl6
16:07 b2gills Doe anybody know how to turn `subset Even of Int where * %% 2` into `class Even of Int { ... }`
16:07 lumimies joined #perl6
16:08 moritz b2gills: you can't
16:08 b2gills You mean you can't change the Meta Class?
16:09 moritz I mean you can't use inheritance to narrow down allowed values
16:10 b2gills I figured that much out
16:10 ggherdov joined #perl6
16:10 moritz so what do you want to achieve?
16:10 colomon are you asking for something which is not inheritance?  (ie it's not class Even is Int, but "of"?)
16:11 b2gills I wanted to know how the subset keyword was short for something else
16:11 colomon it's short for saying "where * %% 2" over and over again
16:12 moritz m: subset Even of Int where * %% 2; say Even.HOW.^name
16:12 camelia rakudo-moar 80b912: OUTPUT«Perl6::Metamodel::SubsetHOW␤»
16:12 b2gills Like `" $a "` being short for `qq" $a "` which  is short for `Q:..." $a "`
16:12 moritz b2gills: it has its own meta class
16:12 b2gills I did that already
16:12 moritz b2gills: so it's not reducible to another construct, except in the sense that everything is Turing complete in here
16:13 b2gills Well at some level there is another way to do it ( that is probably compiler specific )
16:14 b2gills I was just trying to think of how Perl 6 handles a lot of the syntactic constructs for the programmer
16:15 rindolf joined #perl6
16:16 b2gills ... perhaps creating a blog post, or a slide-show for others to read/use ( or series thereof )
16:20 virtualsue joined #perl6
16:23 moritz b2gills: also feel free to write such docs for doc.perl6.org :-)
16:25 Ven joined #perl6
16:29 b2gills That my be too much internalized pressure for me to handle. ( It took me weeks to get up enough "courage" to overcome that "pressure" to even start writing the Pi post I wrote )
16:30 b2gills I basically had to shut off my brain and just click the publish button to post it publicly
16:31 TimToady b2gills++ # growth action
16:32 b2gills Yeah I'm finally about at the point I should have been when Perl5 came out
16:37 tadzik moritz: pong
16:41 moritz tadzik: what would it take to install local (bundled) modules with panda, letting it figuring out the dependencies?
16:41 moritz tadzik: I guess what I want to task, I can pass it a project.json file and a bunch of directories, and have panda install them in the correct order?
16:50 ggoebel111111117 joined #perl6
16:50 jdv79 how do i tell what openssl IO::Socket::SSL is using?
16:50 tadzik moritz: that's roughtly what bootstrap is doing
16:51 moritz tadzik: then I guess I'll study (and possibly extend) that a bit more
16:57 TimToady If any of you get to 2015 before me, let me know whether Perl 6 is out yet.  :)
16:58 moritz TimToady: I'm still in 2014, and I've spotted it in the wild!
17:00 moritz m: role A { trusts Int }
17:00 camelia rakudo-moar 80b912: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/4e5NIrjXbm�Method 'add_trustee' not found for invocant of class 'Perl6::Metamodel::ParametricRoleHOW'�at /tmp/4e5NIrjXbm:1�------> �»
17:00 moritz should roles have trust?
17:01 dalek doc: 16122bf | moritz++ | lib/Type/Metamodel/Trusting.pod:
17:01 dalek doc: Document Metamodel::Trusting
17:01 dalek doc: review: https://github.com/perl6/doc/commit/16122bf322
17:03 ZoruaTrainer left #perl6
17:05 adu joined #perl6
17:05 Ven joined #perl6
17:13 njmurphy joined #perl6
17:23 cibs joined #perl6
17:23 Ven joined #perl6
17:40 zakharyas joined #perl6
17:50 b2gills m: class LTA-FALLBACK { multi method FALLBACK ('not-called'){...} }; LTA-FALLBACK.method
17:50 camelia rakudo-moar 80b912: OUTPUT«Cannot call 'FALLBACK'; none of these signatures match:␤:(LTA-FALLBACK: Str $ where { ... }, *%_)␤  in any  at src/gen/m-Metamodel.nqp:2638␤  in block <unit> at /tmp/X0_tGpObDo:1␤␤»
17:54 TimToady m: class LTA-FALLBACK { multi method FALLBACK ('not-called'){...} }; LTA-FALLBACK.not-called
17:54 camelia rakudo-moar 80b912: OUTPUT«Unhandled exception: Stub code executed␤   at <unknown>:1  (/home/camelia/rakudo-inst-1/languages/perl6/runtime/CORE.setting.moarvm:throw:4294967295)␤ from src/gen/m-CORE.setting:13875  (/home/camelia/rakudo-inst-1/languages/perl6/runtime/CORE.setting.…»
17:55 b2gills I just think the error could be improved to say that it couldn't find the method named `method` and none of the `FALLBACK` methods match
17:55 TimToady nod
17:58 LLamaRider joined #perl6
18:02 mr-foobar joined #perl6
18:18 b2gills subset IntStr of Cool where Int|Str; # almost works like it's supposed to
18:18 b2gills m: subset IntStr of Cool where Int|Str; my IntStr $is; $is= 2; multi test(Int $){...}; multi test(Str $){...}; test($is)
18:18 camelia rakudo-moar 80b912: OUTPUT«===SORRY!===␤Cannot invoke null object␤»
18:19 b2gills m: subset IntStr of Cool where Int|Str; my IntStr $is; $is= 2; multi test(IntStr $){...}; test($is)
18:19 camelia rakudo-moar 80b912: OUTPUT«Unhandled exception: Stub code executed␤   at <unknown>:1  (/home/camelia/rakudo-inst-1/languages/perl6/runtime/CORE.setting.moarvm:throw:4294967295)␤ from src/gen/m-CORE.setting:13875  (/home/camelia/rakudo-inst-1/languages/perl6/runtime/CORE.setting.…»
18:27 pmqs_ joined #perl6
18:36 timotimo merry change-of-year, everyone
18:40 TimToady b2gills: thing is, for IntStr you need storage for both an Int and a Str, and a subset won't give you that
18:41 TimToady well, unless you can convince the type system that something is derived from Int while actually (re)converting from Str
18:42 TimToady which just might work, but you'd have to shadow all the Int methods
18:43 b2gills So theoretically IntStr is Int does Stringy
18:43 TimToady niecza works it out so that it's multiple inheritance, but the Str bit is more distant
18:45 TimToady unfortunately rakudo's Int and Str types are not currently able to support "is Int is Str" without prodding
18:45 * TimToady hasn't figured out how to prod them yet...
18:46 TimToady basically both types are acting kind of like natives, insofar as their storage is not composable
18:47 TimToady (under MI, anyway)
18:47 b2gills Well IntStr does run counter to most of the type system
18:48 TimToady it might be sufficient to support IntCool with a .Str override for most purposes
18:48 raydiak won't complete coercion support remove a bunch of the use cases for intstr?
18:48 TimToady but we still need to remember the original string somewhere
18:49 TimToady raydiak: no, we'll always have text that wants to be evaluated in terms of what it looks like
18:49 TimToady if not command line, in < 1 2.3 5i > or as the result of a prompt
18:50 b2gills m: <5e5> ne 5e5
18:50 camelia rakudo-moar 80b912: ( no output )
18:50 b2gills m: say <5e5> ne 5e5
18:50 camelia rakudo-moar 80b912: OUTPUT«True␤»
18:51 TimToady n: say <5e5> ne 5e5
18:51 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:51 TimToady wow
18:51 raydiak ah I see
18:51 b2gills It's almost like niecza is mostly abandoned
18:51 TimToady n: say <1/2> eq '1/2'
18:51 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:51 TimToady n: say <1/2>.WHAT
18:51 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:52 TimToady something broke in niecza
18:52 TimToady n: say < 1/2 >.WHAT
18:52 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:52 b2gills n: say var('1/2').WHAT
18:52 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:52 TimToady n: say 1/2
18:52 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:52 b2gills n: say ''
18:52 TimToady something broke badly
18:52 camelia niecza v24-109-g48a8de3: OUTPUT«(signal ABRT)Stacktrace:␤␤  at <unknown> <0xffffffff>␤  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_string (intptr,intptr,int) <0xffffffff>␤  at (wrapper alloc) object.AllocString (intptr,int) <0xffffffff>␤  at string…»
18:53 raydiak timotimo: and a happy new year to you as well, good sir
18:53 TimToady anyway, IntStr used to work in niecza...
19:10 Sir_Ragnarok joined #perl6
19:36 perturbation joined #perl6
19:47 raiph joined #perl6
19:49 dalek features: 10c1436 | timotimo++ | template.html:
19:49 dalek features: the GoodData summary chart is quite a bit outdated by now.
19:49 dalek features: review: https://github.com/perl6/features/commit/10c1436b2c
19:52 BenGoldberg joined #perl6
20:09 virtualsue joined #perl6
20:24 FROGGS_ joined #perl6
20:33 raydiak aw...new year's day is the 1-year anniversary of the last niecza commit
20:33 moritz :(
20:35 FROGGS[tab] joined #perl6
20:35 b2gills I would prefer it if there was at least 3 different implementations of Perl6, with at least one of them on 3 VMs
20:36 * moritz too
20:37 moritz but I'm not one to start a new implementation
20:37 * raydiak looks at the synopses as an implementor might, and feels overwhelmed
20:37 * moritz is scared of codegen
20:37 b2gills I would also prefer it if JavaScript wasn't the defacto web VM
20:38 moritz or the DOM the standard UI toolkit of the web
20:38 moritz but changing that would be a major project larger than p6, and I prefer to stick with p6 for now :-)
20:40 * TimToady too
20:43 b2gills This is one aspect were I wish Microsoft had been victorious ( you could write in vbscript on IE, and I think at one point with Perl if you downloaded ActivePerl from ActiveState )
20:45 geekosaur vbscript was not an improvement over js...
20:55 psch joined #perl6
20:55 * raydiak has a special irrational hatred for JS and IE which stems from years spent trying to write large webapps as polyglots of the different browser dialects in pre-jquery days
20:56 psch hi #perl6 \o
20:56 raydiak o/ psch
20:56 b2gills geekosaur: It was an improvement the way Microsoft did it, which allowed other languages to use the same facility
20:58 psch o/ raydiak
21:03 b2gills m: multi test ( Cool $r as Rat ){ say $r.WHAT; nextsame }; multi test ( Rat $r ){ $r }; say test 5; # should this actually work?
21:03 camelia rakudo-moar 80b912: OUTPUT«(Rat)␤Nil␤»
21:07 psch m: sub f(|c (Cool $r as Rat)) { say c[0].WHAT; say $r.WHAT}; f 5
21:07 camelia rakudo-moar 80b912: OUTPUT«(Int)␤(Rat)␤»
21:08 psch b2gills: i'm not sure that's conclusive though.  i'd assume nextwith uses the capture as-is, i.e. as in my example, not after spreading to parameters and their coercion
21:08 b2gills m: multi test ( Cool $r ){ callwith($r.Rat) };  multi test ( Rat $r ){ $r }; say test 5
21:08 camelia rakudo-moar 80b912: OUTPUT«Nil␤»
21:09 b2gills m: multi test ( Cool $r ){ test($r.Rat) };  multi test ( Rat $r ){ $r }; say test 5
21:09 camelia rakudo-moar 80b912: OUTPUT«5␤»
21:10 psch b2gills: i think it's that {call,next}{with,same} redispatches on the current dispatcher, and 5 is Cool but not Rat
21:12 psch m: class C { multi method f(Cool $r as Rat) { say "Cool \$ as Rat" }; multi method f(Rat $r) { say "Rat \$r" }; }; c.*f(5)
21:12 camelia rakudo-moar 80b912: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/kL_SXGkjhHâ�¤Undeclared routine:â�¤    c used at line 1â�¤â�¤Â»
21:12 psch m: class C { multi method f(Cool $r as Rat) { say "Cool \$ as Rat" }; multi method f(Rat $r) { say "Rat \$r" }; }; C.*f(5)
21:12 camelia rakudo-moar 80b912: OUTPUT«Cool $ as Rat␤»
21:12 psch m: class C { multi method f(Cool $r as Rat) { say "Cool \$ as Rat" }; multi method f(Rat $r) { say "Rat \$r" }; }; C.*f(5.0)
21:12 camelia rakudo-moar 80b912: OUTPUT«Rat $r␤»
21:13 psch m: Rat.^mro.say
21:13 camelia rakudo-moar 80b912: OUTPUT«(Rat) (Cool) (Any) (Mu)␤»
21:13 psch huh, i'd have expected that to call both.  unless $c.*meth is NYI
21:33 pmurias joined #perl6
21:33 colomon joined #perl6
21:33 pmurias b2gills: the bad thing about multiple implementations is that is splits developers
21:35 b2gills That is true to some extent, but what about the people who start another project because they don't want to work on the current one
21:37 pmurias It's not always bad
21:38 pmurias but it might make sense to look into why they don't want to work on the current one
21:38 colomon niecza was super-important as a proof-of-concept.
21:39 colomon you youngsters ;) may not remember, but there was once a time when "everybody" knew that Perl 6 couldn't run on a VM like JVM or .NET.
21:39 colomon Thus Parrot.
21:39 b2gills I was thinking of something I heard on "Linux Action Show" about the systemd devide
21:40 b2gills At the time it couldn't as easily be built on JVM
21:41 colomon Niecza was the first implementation to prove that running p6 on a VM other than Parrot was even possible; and that it generally could outperform Parrot.
21:42 b2gills As someone who started learning assembly before Perl, I did like that Parrot was more like the underlying hardware
21:42 Mso150 joined #perl6
21:44 colomon Oh, Parrot was a great idea.
21:45 b2gills Some great ideas turn out to be dumb ones
21:45 colomon … I don't know that that's fair to it.
21:46 colomon But I'm very glad we have nqp running on MoarVM and JVM.
21:46 b2gills I didn't mean Parrot in particular, and I think Parrot was needed to get to here and now
21:47 b2gills Strings ending with a null byte was a great idea at the time, but is incredibly stupid now with Unicode
21:48 b2gills So at the time Parrot was the best way forward, and even with a time-machine still would be
21:50 b2gills ( null terminated strings was directed at C and hardware )
21:53 b2gills My feelings for Parrot is similar to my feelings for Neanderthals, at the time they were absolutely necessary, but there usefulness has waned over time. ( I actually hope Parrot can become as useful as Moar eventually )
21:55 xfix joined #perl6
21:56 araujo joined #perl6
22:06 b2gills It seems like `nextwith` et all doesn't work quite right in a multi where it is effectively super-type of the rest of the multis
22:06 b2gills It does work if it is a super-role though
22:08 psch m: multi f(Cool $r) { say "Cool \$r"; nextsame }; multi f(Any $r) { say "Any \$r" }; f(5)
22:08 camelia rakudo-moar 80b912: OUTPUT«Cool $r␤Any $r␤»
22:09 b2gills Maybe its the roles that all of the Cool types do
22:09 psch note it's the narrower type that matches
22:09 psch Cool as Rat vs Rat is the wider type that matches
22:10 psch the dispatcher doesn't consider the narrower type, cause that doesn't match
22:14 dalek roast: 7759c2d | util++ | / (10 files):
22:14 dalek roast: Fix typos.
22:14 dalek roast: review: https://github.com/perl6/roast/commit/7759c2d6de
22:20 b2gills m: multi f ( Cool:D $f ){ nextwith $f.Rat }; multi f( Rational:D $r ){ $r }; say f 5
22:20 camelia rakudo-moar 80b912: OUTPUT«Nil␤»
22:20 b2gills m: multi f ( Cool:D $f ){ nextwith $f.Rat }; multi f(Any:D $a){ $a.WHAT }; multi f( Rational:D $r ){ $r }; say f 5
22:20 camelia rakudo-moar 80b912: OUTPUT«(Rat)␤»
22:21 b2gills I though that 'redispatch' would just try all of the options again, possibly calling the same one infinitely
22:22 psch it calls the next matching candidate
22:22 psch with or without returning, and with the same or new arguments
22:23 b2gills Then redispatch in S 12 should be switched with a different word or phrase
22:25 muraiki_ joined #perl6
22:27 psch S12:940
22:27 synopsebot Link: http://perlcabal.org/syn/S12.html#line_940
22:27 ruoso_ joined #perl6
22:27 sunnavy_ joined #perl6
22:27 psch key words "in the list"
22:27 psch although i do agree that the use of "redispatch" in the code block is misleading
22:28 pmurias b2gills: you think developement on Parrot will resume to the point when it get to the level MoarVM is right now?
22:28 pmurias s/when/where/
22:28 FROGGS__ joined #perl6
22:29 btyler_ joined #perl6
22:29 rhr joined #perl6
22:29 sivoais_ joined #perl6
22:29 petercom1and joined #perl6
22:29 raydiak m: multi test (Cool $r) { &::(&?ROUTINE.name)($r.Rat) }; multi test (Rat $r) { $r }; say test 5; # so is this the best/onlyish way to accomplish that, then?
22:29 camelia rakudo-moar 80b912: OUTPUT«5␤»
22:29 ugexe joined #perl6
22:31 b2gills No but one can hope
22:31 colomon joined #perl6
22:32 psch raydiak: i'd say so.  i'm not sure someone with more insight into S12 might have a different perspective, but to me wanting to do that has a bit of a design smell with it
22:32 psch i'd find the other way around more sensible, i.e. from narrow to wider type, and that works with {next,call}{same,with}
22:32 MilkmanD1n joined #perl6
22:32 psch well, nextsame actually
22:34 mtj_- joined #perl6
22:39 rurban joined #perl6
22:40 b2gills That means that you either have to put the commonest logic in the most basest variant, or start the dispatch over by using the name of the sub (in some form or another)
22:41 skarn joined #perl6
22:44 psch but that does make sense, doesn't it?  having the most common logic in the dispatch candidate that matches most (or even all) use cases
22:47 b2gills It probably does most of the time, but not always. I was using it to allow all Cool types but have it dispatched on the numerator and denominator of a Rational ( without having to do `( Cool $ as Rational ( :$numerator, :denominator($) where 1 ) )` )
22:48 hobbs joined #perl6
22:48 Juerd joined #perl6
22:48 hobbs joined #perl6
22:49 lsm-desktop joined #perl6
22:49 isacloud joined #perl6
22:49 psch b2gills: so your case is "match anything Cool, but if it's already a Rat do something special"?
22:49 njmurphy joined #perl6
22:49 eternaleye joined #perl6
22:50 b2gills No it's allow every Cool but turn it into a Rational and dispatch on the numerator and denominator.
22:50 Spot__ joined #perl6
22:52 integral joined #perl6
22:52 integral joined #perl6
22:53 b2gills I was creating a set of subs that turned a number into a mixed fraction the same way you would write it on paper
22:54 no_libsoup_for_y joined #perl6
22:55 b2gills multi sub as-fraction ( Rational $ (:$numerator, :$denominator where $numerator < * ) ){ "$numerator/$denominator" }
22:55 b2gills multi as-fraction ( Rational:D $ ( :$numerator, :$denominator ) --> Str ){
22:55 b2gills Int($numerator / $denominator) ~ ' ' ~ abs($numerator) mod $denominator ~ '/' ~ $denominator
22:55 b2gills }
23:02 gfldex happy new perl6 year from germany :)
23:09 psch m: sub mixed-fract(Cool $in) { $in.floor ~ " " ~ ($in - $in.floor).Rat.nude.join("/") }; say mixed-fract 612/32 # b2gills
23:09 camelia rakudo-moar 80b912: OUTPUT«19 1/8␤»
23:10 psch that's how i'd do that
23:10 atta joined #perl6
23:10 psch plus a check if a non-integer portion actually exists, so you don't get the extra space
23:13 psch oh, although floor doesn't work for negative numbers i guess
23:13 psch that discussion came up recently :)
23:14 psch m: sub mixed-fract(Cool $in) { $in.floor ~ " " ~ ($in - $in.truncate).Rat.nude.join("/") }; say mixed-fract -612/32 # b2gills
23:14 camelia rakudo-moar 80b912: OUTPUT«-20 -1/8␤»
23:14 psch m: sub mixed-fract(Cool $in) { $in.truncate ~ " " ~ ($in - $in.truncate).Rat.nude.join("/") }; say mixed-fract -612/32 # b2gills
23:14 camelia rakudo-moar 80b912: OUTPUT«-19 -1/8␤»
23:14 psch hm, two minuses isn't right either :/
23:17 psch m: sub mixed-fract(Cool $in) { $in.truncate ~ " " ~ ($in - $in.truncate).Rat.abs.nude.join("/") }; say mixed-fract -612/32
23:17 camelia rakudo-moar 80b912: OUTPUT«-19 1/8␤»
23:17 psch m: sub mixed-fract(Cool $in) { $in.truncate ~ " " ~ ($in - $in.truncate).Rat.abs.nude.join("/") }; say mixed-fract 0
23:17 camelia rakudo-moar 80b912: OUTPUT«0 0/1␤»
23:17 psch the " 0/1" is the wonky bit :P
23:25 psch the easiest way to solve that would be an Int candidate that just .Strs the input i think
23:26 psch oh, of course Cool is a bad param constraint...
23:27 psch m: multi mixed-fract(Int $in) { $in.Str }; multi mixed-fract(Rational $in) { $in.truncate ~ " " ~ ($in - $in.truncate).Rat.abs.nude.join("/") }; say mixed-fract 1/5 #
23:27 camelia rakudo-moar 80b912: OUTPUT«0 1/5␤»
23:28 xfix joined #perl6
23:39 adu joined #perl6
23:40 moritz happy new year everybody!
23:40 no_libsoup_for_y moritz: Happy new year
23:46 sirdancealot joined #perl6
23:46 bcode Year.new(:happy)
23:51 LLamaRider joined #perl6
23:54 adu bcode: that's cute
23:55 bcode I just *had* to think of it when seeing "new year" in here :)
23:58 telex joined #perl6
23:59 moritz m: class Year is Date { }; say Year.new(:happy)
23:59 camelia rakudo-moar 80b912: OUTPUT«2015-12-24␤»
23:59 moritz \o/

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

Perl 6 | Reference Documentation | Rakudo