Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6book, 2009-10-21

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

All times shown according to UTC.

Time Nick Message
07:25 masak joined #perl6book
12:11 lichtkind joined #perl6book
12:36 lichtkind_ joined #perl6book
13:31 masak meeting tonight?
13:31 moritz_ oops
13:31 moritz_ wrong way 'round
13:32 moritz_ masak: yes
13:32 * moritz_ hopes for more attendees than last week
13:39 masak I'll come.
14:03 masak when we do the release later in the week, do we plan to release things with '# TODO' comments in them?
14:04 * moritz_ plans to, yes
14:05 jnthn what time? 1800 utc?
14:05 moritz_ yes, I think so
14:05 masak I think so too.
14:06 masak anyone mind s/Stone/Rock/ in the Rock-Paper-Scissors game?
14:06 moritz_ go right ahead
14:06 moritz_ as long as you :g it :-)
14:08 masak I will :)
14:08 masak rakudo: enum Signs <Rock Paper Scissors>; multi wins(Rock $, Paper $) { 1 }; multi wins(Paper $, Rock $) { 1 }; multi wins(Scissors $, Paper $) { 1 }; multi wins(::T $, T $) { 0 }; multi wins ($, $) { -1 }; say wins(Rock, Paper)
14:08 p6eval rakudo 073d5e: TIMED_OUT
14:08 masak that works locally.
14:08 * masak kicks p6eval
14:08 masak I would argue that an enum is nicer than three empty classes.
14:08 moritz_ it is
14:09 masak I'll make the changes separately, for great justice.
14:09 moritz_ and feel free to do hack any improvements in, I don't feel stronlgy about "owning" that chapter
14:09 masak excellent.
14:13 jnthn masak: yeah but
14:13 jnthn I'm not sure that's going to type sort the way you want.
14:13 jnthn Hmm...maybe
14:14 jnthn Does draw still work?
14:14 masak I'll check.
14:15 masak why would it type sort differently, by the way.
14:15 masak s/\./?/
14:16 jnthn I'm not sure enum elems count as nominal types.
14:16 masak they better do, or they'll have me to deal with!
14:16 moritz_ if the aren't, they shouldn't be allowed as type constraints
14:17 moritz_ std: enum Foo <Bar Baz>; my Baz $x;
14:17 p6eval std 28870: OUTPUT«ok 00:02 112m␤»
14:17 masak draw works.
14:33 dalek book: abc7de1 | masak++ | src/multi-dispatch.pod:
14:33 dalek book: [MMD] s:g:ii/stone/rock/
14:33 dalek book: Also tried to prefer the ordering 'rock, paper, scissors' as this is
14:33 dalek book: familiar to people.
14:33 dalek book: review: http://github.com/perl6/book/commit/abc7de1cb4f73a7508d35d35732eada197c532cc
14:33 dalek book: e5d44d9 | masak++ | src/multi-dispatch.pod:
14:33 dalek book: [MMD] replaced the classes by an enum decl
14:33 dalek book: review: http://github.com/perl6/book/commit/e5d44d94105ddca8247856592735ecb8b6ab04eb
16:00 dalek joined #perl6book
17:05 colomon joined #perl6book
17:08 perlpilot joined #perl6book
17:15 moritz_ What I did last week: * Wrote about MMD, regexes and a bit about grammars * wrote a release announcement * Got lots of feedback. masak++ and jnthn++ in particular
17:15 moritz_ What I plan to do this week:
17:15 moritz_ * Announce the book, and make a "release"
17:15 moritz_ (if nobody provides a toolchain for conversion to HTML or PDF it will be
17:15 moritz_ just a tarball of .pod files)
17:15 moritz_ * Split regexes and grammars
17:15 moritz_ (into separate chapters)
17:15 moritz_ * More about grammars
17:15 moritz_ * Action methods for grammars
17:15 moritz_ What I'm blocking on
17:16 moritz_ * Tuits
17:16 moritz_ * More good examples
17:16 moritz_ EOR
17:16 masak oh, we're pre-reporting?
17:16 moritz_ I suggested that last week. Nobody objected ;-)
17:17 masak ok, here goes:
17:17 masak did last week: the Task class example, various minor corrections, an SVG diagram for MMD.
17:18 masak plan to do this week: help with release, help set up toolchain if we get the tools.
17:18 masak blocking on: tuits, focus, plain ol' time.
17:18 masak .eor
17:22 moritz_ masak: could you add the +1/0/-1 to the table in that awesome SVG thing?
17:22 moritz_ I'm thinking of the color blind here
17:22 masak consider it done.
17:30 masak moritz_: hm. you wrote +1 instead of just 1. I'm thinking whether that might not be a good idea, in the table, in the coloured code next to the table, and in the chapter text. what do you think?
17:31 moritz_ masak: for symmetry I'd prefer to use +1 everywhere, but I'm also fine with justing 1 everywhere
17:32 masak same here. I'll try +1 everywhere, since we haven't done that yet.
17:32 masak if I put all the changes into one commit, they won't be difficult to separate from the rest.
17:32 moritz_ +1 ;-)
17:33 takadonet joined #perl6book
17:33 masak :P
17:33 moritz_ masak: do you have local changes to the regex-chapter?
17:33 masak nope.
17:33 moritz_ good.
17:37 masak but even if I did -- this is git, so no problem. :)
17:37 * moritz_ just splitted it into two chapters
17:38 masak (it's not you, it's English grammar. 'split')
17:38 moritz_ oh
17:38 moritz_ right
17:38 masak we spent years in school rehearsing that. instead of fixing the problem at its root. :)
17:39 moritz_ well, I learned that too. And then spent countless hours on IRC where your grammar can decay, and nobody tells you (except masak++ ;-)
17:40 masak it's a gamble telling people. they are wont to get defensive.
17:42 moritz_ well, you can safely tell here, because you'd have to correct it in the repo in the end anyway ;-)
17:44 masak that's a good reason. :)
17:56 masak skimming the regex chapter, I don't see anything about code assertions and similar not-yet-in-Rakudo-but-in-Rakudo-star stuff.
17:56 moritz_ aye
17:56 moritz_ my plan was to add them when they actually work
17:57 masak that might be a good plan.
17:57 moritz_ so that I can actually test them
17:57 perlpilot (working code)++
17:57 masak I'll start thinking about good examples already, though. :)
17:57 masak it would be neat to hook up all code snippets in the book to a testing framework, somehow.
17:57 moritz_ aye
17:58 moritz_ masak: there's a very good example for assertions: parsing whitespace-significant formats
17:58 masak right, with indentation and things.
17:58 moritz_ ^^(\s+) <{ $0.chars >= $limit }>
17:58 masak I agree.
17:58 masak another common, simple example is IP numbers.
17:59 moritz_ right
17:59 moritz_ maybe a good IPv6 grammar would be nice
17:59 masak I like it because the corresponding 'pure regex' is possible to write out, and it look pretty hideous in comparison. :)
17:59 perlpilot Did we say that the book was going to have one voice or if each chapter would have its own voice?
17:59 moritz_ that chesk the max. number of colons, at most one :: etc.
18:00 masak perlpilot: are you referring to the use of the pronoun 'I' in the book?
18:00 moritz_ 'I' vs. 'we' should be standardized
18:00 masak moritz_: are we sure IPv6 will take off, though? it might make the book look quaint in 5 years or so.
18:01 perlpilot I was thinking more of the general tone than that.
18:01 moritz_ in 5 years there'll be a much more awesome {Programming,Learning} Perl anyway ;-)
18:01 moritz_ perlpilot: a consistent tone would be nice, IMHO
18:01 masak I'd very much like it for the general tone to be the same throughout the book. but I'm not going to worry about that in a few months.
18:01 moritz_ btw it's meeting time ;-)
18:01 masak right now it's spit-out-many-examples.
18:01 moritz_ any more reports?
18:02 masak any lurkers actually participating in the meeting?
18:02 perlpilot I've done nothing but read.  EOR  :)
18:02 moritz_ perlpilot++ # concise report
18:03 moritz_ rakudo: token ws { A+}; say 'fAAAb' ~~ m/:s f b/
18:03 p6eval rakudo 073d5e: OUTPUT«␤»
18:03 moritz_ rakudo: token ws { A+}; say 'fAAAb' ~~ m/:s[]f b/
18:03 p6eval rakudo 073d5e: OUTPUT«Confused at line 2, near "f b/"␤in Main (file <unknown>, line <unknown>)␤»
18:04 moritz_ rakudo: token ws { A* }; say 'fAAAb' ~~ m/:s f b/
18:04 p6eval rakudo 073d5e: OUTPUT«␤»
18:04 moritz_ so overriding ws only works in grammars right now?
18:04 masak doesn't surprise me.
18:05 perlpilot Should I mention the book effort in the Rakudo release announcement?
18:05 moritz_ perlpilot: no need, there's going to be a separate announcement on Friday
18:05 perlpilot It's not a question of "need" as much as "want" :)
18:06 moritz_ it's fine by me either way
18:06 masak I'd like to see if we can get hold of chromatic before Friday, and ask him nicely about the converter he mentioned.
18:06 moritz_ rakudo: role A { method foo { 'foo' } }; grammar B does A { token TOP { <foo> } }; say B.parse('foo')
18:07 p6eval rakudo 073d5e: TIMED_OUT
18:07 masak ooh, interesting. grammars doing roles.
18:08 moritz_ and it fails
18:08 moritz_ No such attribute '$.pos'
18:08 moritz_ in Main (file src/gen_setting.pm, line 288)
18:08 KyleHa joined #perl6book
18:08 masak works here.
18:08 masak prints "foo"
18:09 moritz_ curious
18:09 masak very.
18:09 * moritz_ needs to run a 'make install'
18:10 masak maybe you just found a bug which was fixed before it was reported. :)
18:10 chromatic joined #perl6book
18:11 masak chromatic: oh hai. about that converter from POD to... was it LaTeX?
18:11 perlpilot joined #perl6book
18:12 moritz_ sorry, have to run for supper, bbl
18:13 chromatic Yes, it's Pod::PseudoPod::LaTeX on the CPAN.  We use it at Onyx Neon for all of our projects.
18:13 masak oh, on CPAN.
18:14 masak that makes things easier.
18:14 * perlpilot was under the impression that it was proprietary last time this came up
18:14 perlpilot CPAN++
18:15 chromatic We have a custom LaTeX stylesheet, but I hesitate to describe formatting instructions as *proprietary*.
18:17 perlpilot I meant the code that grappled with pseudo pod, but you're right, that word is probably not quite what I meant at all.  :)
18:19 dalek joined #perl6book
18:20 dalek joined #perl6book
18:22 dukeleto_ joined #perl6book
18:22 PerlJam joined #perl6book
18:22 jnthn joined #perl6book
18:22 pmichaud joined #perl6book
18:38 hugme joined #perl6book
18:40 moritz_ ls
18:40 masak I just pushed a script that generates a .tex file from the POD sources.
18:40 moritz_ masak++
18:40 masak moritz_: there are no files here.
18:40 masak only people :)
18:40 moritz_ "ls" just means "list", not "list files"
18:40 masak true.
18:41 masak and according to Plan 9, everything is files, so...
18:41 KyleHa Plan 9 is from outer space.
18:43 masak someone is very welcome to create a Makefile from what I just made.
18:43 dalek book: 026f34f | masak++ |  (2 files):
18:43 dalek book: [bin/book-to-latex] script to generate a .tex file
18:43 dalek book: This works for me to generate a PDF file:
18:43 masak it's probably not hard.
18:43 dalek book: $ perl bin/book-to-latex > book.tex
18:43 dalek book: $ pdflatex book.tex
18:44 dalek book: Now, could someone who knows how please make a Makefile
18:44 dalek book: that does the above?
18:44 dalek book: review: http://github.com/perl6/book/commit/026f34f5d40c94bd37c91faebc7d4fa2b784dab4
18:45 moritz_ I've added all of the previous ops who are registered to freenode to the access list
18:45 jnthn hi hi hi!
18:45 jnthn Am I late to b00k meeting?
18:45 moritz_ jnthn: yes
18:45 moritz_ so we can just become op when necessary
18:45 moritz_ no need to carry around our donoughts publicly ;-)
18:46 jnthn Also, what on earth happened while I was doing @otherjob...
18:46 moritz_ jnthn: feather went down
18:46 jnthn ah
18:46 jnthn gah, now we irssi window numberings have changed. :-/
18:46 PerlJam actually feather appears to have stayed up, it's just that its neetwork connection went away for a while
18:47 moritz_ right
18:47 PerlJam jnthn: you can save those (I forget the syntax)
18:47 moritz_ the processes were still running
18:47 jnthn I'll be posting in the wrong place for days.
18:47 jnthn Yeah, my screen session lived.
18:47 moritz_ jnthn: /window move $number
18:47 jnthn moritz_: oh wow!
18:47 jnthn moritz++
18:49 jnthn So...people call the game Rock Paper Scissors?
18:49 PerlJam jnthn: in the USA they do
18:49 jnthn Oh.
18:49 jnthn Paper Scissor Stone in proper English.
18:49 masak oh.
18:49 jnthn ;-)
18:49 jnthn Erm, British. I meant British English.
18:49 jnthn :-)
18:50 PerlJam (I think it's a minor cultural thing that anyone can get used to, so the british english way would be fine by me)
18:50 moritz_ we should keep two branches, one in Proper English, one in Slanglish ;-)
18:50 PerlJam The USAian version has the benefit of unique first characters
18:50 jnthn Don't forget the Geordie branch, which is just like the others, but eveyr sentence ends in "like", like.
18:52 moritz_ rakudo: say 'a.b' ~~ m/<.ww>b/
18:52 masak is this still the meeting? or are we just having an after-meeting chat?
18:52 p6eval rakudo 073d5e: TIMED_OUT
18:52 moritz_ I suppose it's after-meeting chate
18:52 moritz_ *chat
18:52 moritz_ sorry, I had to run off, so I kinda lost track
18:53 jnthn I'm backlogging at the moment. Is there anything anyone wanted to ask me?
18:53 jnthn Since I managed an off-by-1 error.
18:53 jnthn (1 hour, that is...)
18:53 moritz_ ;-)
18:53 moritz_ don't think so
18:54 masak jnthn: so you were actually 15 minutes early? :P
18:54 jnthn Yeah, I'd just finished dinner and was going to write my pre-meeting report of what I did for book this week. ;-)
18:55 moritz_ well, write it now
18:55 jnthn Fine
18:55 jnthn Scribbled some stuff in the OO chapter.
18:55 jnthn Reviewed moritz++'s MMD chapter
18:55 jnthn EOR
18:55 masak jnthn++
18:55 jnthn I'm planning to do more on OO chapter during the next week, unless that conflicts with anyone?
18:56 moritz_ not with me
18:56 jnthn My only other thing. Moritz wrote "'I' vs. 'we' should be standardized". I agree.
18:56 moritz_ I'm focusing on grammars for now
18:56 moritz_ I'd prefer 'we'
18:56 moritz_ erm
18:56 jnthn I don't mind strongly which one, but I hate fixing up text from one to the other, so would rather try and having it right.
18:56 moritz_ we'd prefer 'we'
18:57 jnthn We'd prefer it too.
18:57 jnthn Are we amused?
18:57 masak I don't use either much.
18:57 moritz_ we can haz pluralz_
18:57 moritz_ s/_/?/
18:57 moritz_ (tippgicht)
18:58 moritz_ (tipp = typing, gicht = gout)
18:58 jnthn German is awesomecombinatinglanguage.
18:58 * masak is considering heading home
18:58 jnthn "we" works for me though
18:58 jnthn I think it's what I've been using.
18:58 chromatic Where's this pronoun use?
18:59 masak I'm not sure it's such a big problem. there's lots of editing to be done once we have all the material anyway.
18:59 * jnthn isn't quite sure how to answer that
18:59 masak we will read the text hundreds of times...
18:59 jnthn chromatic: Erm, "in the bits of the book written so far" is the first answer that comes to mind. :-)
18:59 jnthn chromatic: What is it specifically that you're asking?
19:00 chromatic How do you address the reader?  As "you" or as "we"?
19:00 jnthn I've been using "we" so far.
19:00 jnthn But the discussion is mostly, should we try and standardize on one.
19:00 * moritz_ has been using "you", mostly
19:00 chromatic My preference is "you".
19:00 jnthn OK
19:01 jnthn If we^Wyou prefer that, I can switch.
19:01 chromatic I find the imperative mood "Reader, go do this!" clearest.
19:01 masak nod.
19:01 masak and 'we' for the writers makes sense, since we're several.
19:01 jnthn Yes.
19:01 masak and 'we' for both writers and readers also makes sense.
19:02 masak moritz_: did you try creating a PDF?
19:02 moritz_ masak: no, not yet
19:02 masak it already looks pretty cool. 19 pages. :)
19:03 masak I'd say the priority until Friday is to make it look a bit more polished... releasable, simply.
19:03 masak that's probably what I'll be putting my effort on.
19:03 moritz_ I'm writing a bit about grammar inheritance right now, and then will focus on polishing
19:04 jnthn I'm madly sorting out slides for my talks at IPW, and tomorrow will be jumping on a flight, and then will be doing conferency things for next couple of days.
19:04 jnthn So I'm not sure I'll be able to make a lot of time for book before the release - sorry.
19:04 moritz_ no problem.
19:05 masak what moritz_ said.
19:05 masak good luck, and have a good flight!
19:06 jnthn masak: Thanks!
19:06 pmichaud I'll make book time, although I also have a conferency-thing this weekend.
19:06 chromatic Would it help for me to make a quick editorial pass?
19:06 pmichaud But mine isn't quite so far out-of-town as jnthn's
19:06 pmichaud chromatic +1
19:06 chromatic Someone'll have to hugme commit access.
19:07 moritz_ hugme: add chromatic to book
19:07 * hugme hugs chromatic. Welcome to book!
19:07 masak :)
19:07 jnthn .oO( first time I saw hugme used as a verb :) )
19:07 moritz_ we can verb anything!
19:07 jnthn pmichaud: Mine's so far out of town, it's even out of country! ;-)
19:07 chromatic I'm an editor.  I have fiendish word powers.
19:08 pmichaud jnthn: well, sometimes my "in-state" conferences are still farther than your out-of-country ones :)
19:08 jnthn pmichaud: I knew that comment was coming. :-)
19:08 pmichaud ...you could see it coming from halfway across the state?  ;-)
19:09 jnthn ...not literally. Ya state's so big even Hubble can't see accross it.
19:09 pmichaud it's not only size, it's ozone coming from Houston.
19:10 pmichaud "Worst air quality in the U.S.!  Woo hoo!"
19:10 masak sounds like Houston has a problem.
19:10 jnthn :-)
19:11 jnthn Thing with ozone is, unlike methane you can't just blame it on the huge number of cattle.
19:11 chromatic This must be some use of the name "US" which no one outside of Texas intends.
19:12 pmichaud heh.... did you see the poll about Texas seceeding from the union?
19:13 chromatic I voted for it!
19:13 pmichaud so did apparently a majority of folks in the U.S. (outside of Texas)
19:14 pmichaud http://www.dallasnews.com/sharedcontent/dws/news/politics/topstories/stories/101409dntexsecession.3f3cb13.html
19:14 masak hah!
19:15 moritz_ dalek eated my commit. Bah.
19:15 dalek joined #perl6book
19:16 masak dalek was booted because of your commits? :)
19:16 * moritz_ feels mostly inocent
19:18 jnthn Man, these people who commit too much.
19:19 masak "captain! the bots are overheating due to all the commits!"
19:20 masak I really like the development the book has had so far.
19:20 masak I feel I've contributed very little to it, but that might change in the future.
19:21 masak I have think-of-examples running as a background job in my mind.
19:21 jnthn masak: Your have contributed.
19:22 jnthn masak: Your OO example inspired me to write the bits I did.
19:22 masak yeah, that was kinda cool.
19:22 masak I should do more of those drive-by commits.
19:22 jnthn I've have found it a lot harder to start without a good example to work from
19:22 moritz_ same here
19:22 jnthn If you feel like showing the code for some extensions too (not bulk out the original but a more "how we could add to it") to demonstrate delegation and inheritance, that would be excellent.
19:23 jnthn Oh, and multi-dispatch.
19:23 masak I can put together the variant with parallel tasks I mentioned.
19:24 moritz_ and you can delegate to @!dependencies.push ;-)
19:24 masak wohoo! TimToady++
19:24 jnthn Both good examples.
19:24 jnthn Also multi-methods if we can fit those in.
19:24 moritz_ which reminds me, I wanted to write tets for that
19:24 masak logging off. see y'all around. o/
19:24 jnthn o/
19:24 moritz_ seeya
19:25 jnthn moritz_: yay, tests :-)
19:25 jnthn moritz_: I suspect that while we enabled tests for named and attributive parameters, they both might be more extensively tested too.
19:25 jnthn moritz_: Further to that, signature literals also now work. I'm nt sure we have/enabled any tests for those either.
19:26 moritz_ we don't have that many
19:26 jnthn *nod*
19:26 moritz_ rakudo: say (-> $x, $y { }).signature === :($x, $y)
19:26 jnthn I'm not saying you do them all, but maybe stuff to put in TASKS file. :-)
19:26 p6eval rakudo 073d5e: OUTPUT«0␤»
19:26 moritz_ rakudo: say (-> $x, $y { }).signature eqv :($x, $y)
19:26 jnthn moritz_: I didn't actually make them do a whole lot yet.
19:26 p6eval rakudo 073d5e: TIMED_OUT
19:27 jnthn moritz_: I mean, .perl and introspection on 'em work.
19:27 moritz_ that should be enough to get eqv to work too
19:27 jnthn Before you couldn't even write a signature literal without it exploding.
19:27 moritz_ ae
19:27 moritz_ aye
19:27 jnthn Feel free to put eqv support in, if you like. :-)
19:32 dalek book: f027e5e | moritz++ | src/ (5 files):
19:32 dalek book: PseudoPod starts at =head0, so decrease the heading level by one everywhere
19:32 dalek book: review: http://github.com/perl6/book/commit/f027e5ed2fd667a7b9ca200ceda4bb1abaf003a4
19:39 KyleHa left #perl6book
19:58 colomon Might I get a commit bit for the book?  I've just found a typo...  :)
19:59 moritz_ hugme: add colomon to book
19:59 * hugme hugs colomon. Welcome to book!
19:59 colomon Thanks!
20:03 colomon Is it okay if I edit sentences as well?
20:03 moritz_ sure
20:05 PerlJam colomon: you can only edit odd numbered lines that do not end with a consonant
20:05 PerlJam :-)
20:05 colomon is that before or after I'm done editing them?
20:06 moritz_ depending on the moon phase
20:06 moritz_ the correct algorithm is still being worked on
20:06 * PerlJam consults some tarot cards for colomon's answer
20:12 colomon Huh.  I'm having a heck of a time trying to get my change into the PDF.  Like book-to-latex worked once and that was it....
20:13 moritz_ it works here
20:14 colomon apparently I am suffering from "made dumb by the battering of a 13-month-old" syndrome.  I've got it working now.
20:16 colomon and of course now I realize I'm editing in a git sandbox clone without write privileges.  where is that git book?
20:17 moritz_ just edit .git/config
20:17 moritz_ url = git@github.com:perl6/book.git
20:17 moritz_ now it's proably url = git://something
20:19 colomon ye-ha!  I've gone down the dark path to editing text....
20:19 dalek book: cac7c9f | (Solomon Foster)++ | src/multi-dispatch.pod:
20:19 dalek book: Add missing t to arbitrary.  Rewrite first sentence of paragraph to flow more naturally (IMO).
20:19 dalek book: review: http://github.com/perl6/book/commit/cac7c9fee974660f310fbc3b81716561f0c49eac
20:20 moritz_ colomon++
20:24 colomon Ack, while I was working on that, I managed to bork up a $work build by typing svn up in the wrong place.
20:35 colomon I'm still reading the JSON example (and learning stuff, hurrah!)
20:36 colomon Having just reached the first paragraph of page 6, I'm wondering how to-json($d where undef) actually matches anything.
20:37 colomon Or is undef always of type Any?
20:38 moritz_ any object in Perl 6 can be undef
20:38 moritz_ if it responds with False to .defined
20:39 colomon So if I have an undef Int variable, to-json will fire off the (Int $d) case rather than the ($d where undef) case?
20:40 moritz_ right
20:41 colomon seems like maybe that could use further clarification in the text.
20:49 moritz_ ah, that's an even simpler way to get an undef Int
20:53 PerlJam colomon: the first paragraph under Constraints is awkward.  If you can think of a way to make it less so, that would be awesome
20:55 colomon PerlJam: nothing jumps to mind at the moment, but I will try to look at again later when I don't have a 13-month-old pounding on me.  :)
20:55 dalek book: 437783b | moritz++ | src/multi-dispatch.pod:
20:55 dalek book: [MMD] further clarifications requested by colomon++
20:55 dalek book: review: http://github.com/perl6/book/commit/437783b74b89bed8afe4142f690c400289253859
20:57 moritz_ colomon: does that answer your question?
21:01 colomon moritz_: it's a good start, for sure.  the second half of the question is explaining how this applies to the to-json example.
21:04 colomon Another way of saying this is when I saw the to-json example, I figured ($x where undef) must beat (Int $x) for undefined Ints.   (Mind you, I didn't understand how.)
21:05 colomon then later I understood that it wouldn't, but then I was confused about the example.  :)
21:07 PerlJam C<$d where { $d ~~ undef }>   That should be $d where { $_ ~~ undef }, right?
21:07 moritz_ PerlJam: the two are equivalent
21:08 PerlJam right, but only because $d is in the scope of the block.
21:08 PerlJam Two different things that do the same thing leads to confusion  :)
21:08 moritz_ it alwyas is, in the case of constraints
21:08 moritz_ PerlJam: but feel free to change it if you think it's clearer the other way round
21:09 PerlJam I'll think on it some.
21:09 PerlJam After the Rakudo release I'll probably hack the book in my spare time
21:09 colomon I've always done it $d where { $d ~~ undef }.
21:10 colomon Seems more natural to my C++ perverted mind.
21:10 PerlJam Can we do  $foo where &some_sub  ?
21:11 moritz_ sure
21:11 PerlJam I guess that gets translated to $foo where { $foo ~~ &some_sub }   #  :-)
21:11 moritz_ aye
21:12 PerlJam not at all what I meant though.
21:12 moritz_ which in turn calls some_sub
21:12 moritz_ what did you mean?
21:12 PerlJam shorthand for C<$foo where { some_sub($foo) }>
21:13 moritz_ that's what it does
21:13 * PerlJam hasn't delved into the particulars of constraints enough to remember much of anything about the syntax
21:13 PerlJam moritz_: are you saying that C<some_sub($foo)>  and C<$foo ~~ &some_sub> are equivalent?
21:14 moritz_ yes.
21:14 moritz_ at least if some_sub is unary
21:14 PerlJam obviously I hadn't thought about that at all, but it seems weird.
21:15 moritz_ it is very convenient
21:15 moritz_ anything that expects a matcher and does a smartmatch against that can be fully customized by a closure
21:16 * PerlJam reads S03 again
21:20 PerlJam Hmm.
21:22 PerlJam So ... C<$x ~~ &some_sub> checks the arity of C<&some_sub> and if it's 0 or 1, calls C<some_sub>, but if the arity is > 1, it dies a horrible death?
21:22 moritz_ either that, or it fail()s or so
21:24 PerlJam Or, in keeping with the language of the paragraphs preceeding the table, it could read the signature directly (that's how I read "pattern types").
22:21 d4l3k_ joined #perl6book
23:21 dalek joined #perl6book

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