Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6book, 2009-10-18

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

All times shown according to UTC.

Time Nick Message
11:13 masak joined #perl6book
17:17 dalek joined #perl6book
18:18 moritz_ I CAN HAZ PUSHED TO book, BUT dalek EATED IT
18:18 moritz_ anyway, I'd appreciate review of the MMD chapter
18:18 jnthn oh noes!
18:18 jnthn moritz_: I'm refraining from further coding today to do book tasks. ;-)
18:19 moritz_ ;-)
18:19 jnthn moritz_: Something to commit to the OO chapter comes first, and then I'll try and review your MMD bits. :-)
18:19 moritz_ great
21:21 jnthn Just giving my OO scribblings a read through, then commit coming. :-)
21:30 dalek book: 2873520 | jonathan++ | src/classes-and-objects.pod:
21:30 dalek book: Start writing the classes and objects chapter, based on the already committed example.
21:30 dalek book: review: http://github.com/perl6/book/commit/2873520b2d1e4aaa5f5a0964f072eeab8494b585
21:31 jnthn I've got some ideas for adding to that to cover some more OO features too, but that explains I think all of the example. :-)
21:31 moritz_ jnthn: the things I wrote so far also cover more than the initial example
21:32 jnthn moritz_: nod
21:32 moritz_ jnthn: which IMHO is a good thing, because you should be able to understand the example rather soon
21:32 jnthn moritz_: I intend to discuss other features as extensions (like, things we could add to the initial example), so far as I can.
21:32 jnthn Unless it's just way to strained to do so.
21:32 jnthn *too
21:32 moritz_ +1
21:33 jnthn But without actually adding them to the initial example code.
21:33 moritz_ for the regex chapter I decided to start with a simple example
21:33 moritz_ and then when the regex features are explained, I start with the JSON grammar
21:33 jnthn So that the initial example isn't over-taxing.
21:33 moritz_ and takl about grammars, goal matching etc.
21:33 jnthn +1 to that approach too
21:34 jnthn I think we just have to pick what works best for each chapter, but keep "by example" as the philosophy.
21:34 jnthn That is, it's better to be explaining code than talking abstract concepts.
21:34 * moritz_ has a hard time sticking to that
21:35 moritz_ if somebody wants to add more examples to the stuff I wrote - feel free ;-)
21:35 jnthn Yes, it's hard.
21:36 moritz_ hej
21:36 moritz_ I have a nice idea for extending the OO example
21:36 jnthn Ooh, do tell. :-)
21:36 moritz_ for inhertance
21:36 moritz_ a RandomTask or so
21:37 moritz_ that executes dependencies in random order
21:37 jnthn Actually
21:37 jnthn I had thought of ParallelTask
21:37 moritz_ you could use such things to test the 'make -j ' feature
21:37 jnthn Which would give an opprotunity to explain >>. too.
21:37 moritz_ without actually using concurrency
21:37 moritz_ +1
21:37 jnthn The reason I'm a bit "hmm" about it though...
21:37 jnthn ...is that it's the dependencies that can be done in parallel
21:37 jnthn Or in a random order.
21:38 moritz_ people will ask "why not use real threads?"
21:38 jnthn Rather than the task (as in, the callback).
21:38 moritz_ we need a better name, yes
21:38 jnthn Like, Task::ParallelDependencies
21:38 moritz_ aye
21:38 jnthn But that sucks a bit too.
21:39 jnthn I'm thinking that we maybe have a separate example and even chapter to cover roles.
21:39 moritz_ wfm
21:40 jnthn That way, we don't have to be too object-heavy.
21:40 jnthn And can even have another chapter inbetween.
21:40 jnthn On something else.
21:40 jnthn Or at least, we then have a more managable chapter.
21:41 moritz_ well, the OO chapter isn't exactly huge yet
21:41 jnthn moritz_: True.
21:41 jnthn Well, I've not much feeling for how text here maps to book pages though.
21:42 moritz_ the regex chapter is 50% larger already, and still missing most grammar features
21:42 jnthn Hmm
21:42 moritz_ (but maybe that needs splitting too)
21:42 jnthn To me the bigger motivation was more "separate main example".
21:43 moritz_ if we consider saying good-bye to the idea of having just 6 chapters, we can keep the chapters short
21:43 jnthn Oh, I'd always thought that too cute to be practical. ;-)
21:43 jnthn I wasn't entirely sure if it was a serious suggestion or not at the time.
21:44 moritz_ probably just an idea
21:44 jnthn aye
21:44 jnthn For MMD, for minor fixes, any objections to me just commiting fixes?
21:45 moritz_ please go right ahead
21:45 jnthn (spotted a grammar-o)
21:45 colomon_ joined #perl6book
21:45 last_ joined #perl6book
21:47 jnthn One other question
21:47 jnthn multi to-json(Num  $d) { ~$d }
21:47 jnthn multi to-json(Int  $d) { ~$d }
21:47 moritz_ jnthn: you say that 'has $.done' is equivalent with 'has Bool $!done; method done() { return $!done }
21:47 jnthn I think the second of those is redundant?
21:47 moritz_ shouldn't it be a multi?
21:47 jnthn moritz_: It's not a multi today.
21:47 moritz_ jnthn: akshually that number business is going to change a bit
21:47 jnthn In Rakudo.
21:47 jnthn Does the spec say it should be?
21:47 moritz_ we'll have Int !~~ Num by latest spec
21:47 moritz_ afaict
21:47 moritz_ but rather Int ~~ Numeric and Num ~~ Numeric
21:47 jnthn ah, ok
21:48 jnthn Still that could then become one thingy.
21:48 moritz_ aye
21:48 jnthn Anyway, won't change it, just something I noticed.
21:48 moritz_ you can add a # TODO: clarify numeric types   or so
21:50 moritz_ and in the OO chapter: we should mention explicitly that 'has $.thing' means that inside the class assignment has to happen to the !-twigiled attribute
21:50 jnthn good idea, done that
21:50 moritz_ that's something that has bitten just about everybody so far
21:50 moritz_ including masak and me
21:50 jnthn moritz_: I do expalin that later on...maybe it should be mentioned earlier too though.
21:50 moritz_ oh, I'm not so far yet
21:50 jnthn Add a TODO note or jfdi
21:50 jnthn If you feel strongly it should be earlier than it is, or if it's not strong enough.
21:51 moritz_ jfdi++
21:52 moritz_ does 'handles' work on array attributes?
21:53 moritz_ rakudo: class A { has @.a handles <push> }; A.new.push(5)
21:53 jnthn "specially"
21:53 p6eval rakudo 827734: OUTPUT«You used handles on attribute @!a, but nothing in the array can do method push␤in Main (file <unknown>, line <unknown>)␤»
21:53 jnthn moritz_: I always feel a bit "hmm" about that bit of the spec.
21:53 moritz_ there's something special with delegating to an array?
21:53 jnthn Rakudo is following spec here...
21:53 jnthn Yes
21:54 jnthn Spec is like, if it's an array then look through it to find an object that can be delegated to.
21:54 jnthn And if it's a hash, whine
21:54 jnthn Note that it goes on the sigil
21:54 jnthn Not on what's actually inside.
21:54 moritz_ erm.
21:54 jnthn So if the sigil is $, handles always works as expected.
21:54 jnthn Yes, "erm" is a good comment on this.
21:55 jnthn If your delegation object happens to be an array:
21:55 jnthn has @handlers handles 'foo';
21:55 jnthn then Perl 6 assumes that your array contains a list of potential
21:55 jnthn handlers, and you just want to call the I<first> one that succeeds.
21:55 jnthn (that's c/p from S12)
21:55 moritz_ just read it, yes
21:55 jnthn And hash a bit below.
21:55 jnthn Though that's not implemented.
21:55 jnthn 'cus I'd not so keen on implementing conjectural things when we've enough non-conjectural to do. ;-)
22:05 dalek book: 97f1702 | moritz++ | src/classes-and-objects.pod:
22:05 dalek book: [OO] this sentence no verb ;-)
22:05 dalek book: review: http://github.com/perl6/book/commit/97f17020f2d9a1affc0ad39e026e64fb63836407
22:06 jnthn Verbs overrated.
22:07 moritz_ indeed.
22:17 dalek book: 639cb7a | jonathan++ | src/multi-dispatch.pod:
22:17 dalek book: Some minor grammar tweaks and other little bits in the MMD chapter.
22:17 dalek book: review: http://github.com/perl6/book/commit/639cb7a381968fd2a3fdeb923782ba37c8dac838
22:22 moritz_ jnthn++ # lots of fixes and improvements
22:23 jnthn moritz_: Impression of objects/classes bits? Too gutsy? Too detailed?
22:23 moritz_ jnthn: I think it's very good, but maybe requires too much prior OO knowledge
22:24 moritz_ wrt object/instances/methods
22:25 moritz_ any general thoughts on the MMD chapter?
22:25 jnthn Well, question is who we're writing for. I was thinking existing programmers, not programmer newbies.
22:26 moritz_ right, that's the question
22:26 moritz_ it
22:26 jnthn MMD chapter - for the first example, it depends what comes before it. Like, it assumed .trans
22:26 jnthn And .join, map, etc
22:26 jnthn If those have been covered plenty before, that's fine.
22:26 moritz_ .trans probably not
22:26 moritz_ we have to add that somwhere
22:27 moritz_ but the rest, yes
22:27 jnthn It may be prettier to use the @things.map({...}).join(...) rather than doing both sub and method call syntax though.
22:27 jnthn That bit of the code looked a bit of an eye-full mixing them.
22:27 moritz_ re OO - I just found it's an area where there's a lot of confusion
22:27 jnthn And "what order do those bits get done in"
22:28 jnthn I didn't spot anything particularly wrong in the explanation of multi-dispatch though.
22:28 moritz_ recently a programmer asked, after half an hour IRC discussion "so an object is the same as an instance? if somebody had told me that before..."
22:28 jnthn Hmm, yeah.
22:28 moritz_ right, it can use stilistic cleanups
22:28 jnthn Aye.
22:29 jnthn The substr example seemed a bit of a "sudden" jump from what came before to me.
22:29 jnthn I'm not sure why.
22:29 moritz_ it needs a heading inbetween
22:29 jnthn I just did a double take and felt I'd missed something somehow.
22:29 jnthn That'd help.
22:29 jnthn It may be that we don't need two arity related examples.
22:30 jnthn The details on candidate sorting matched up with my understand on the whole though.
22:30 jnthn I think multi-methods bit wants to be moved to OO.
22:30 moritz_ wfm
22:30 jnthn Avoids forward references.
22:31 jnthn And means we can use an extension to the existing example.
22:32 jnthn object vs instance - yeah...I've probably mixed my terms too.
22:32 moritz_ just introduce them as aliases the first time you use them ;-)
22:32 jnthn I tend to view them as two aspects of the same thing.
22:32 jnthn I'll tend to talk about them as objects when I just want to refer to them casually.
22:33 jnthn But I'd usually say "instance of class X" rather than "object of class X"
22:33 jnthn I'd never really thought too much about when I used which. :-)
22:33 jnthn But you're right, it needs consideration here.
22:34 dalek book: c100c05 | moritz++ | src/regex-and-grammar.pod:
22:34 dalek book: [RX] more about grammars, goal matching
22:34 dalek book: review: http://github.com/perl6/book/commit/c100c052eaacc9d238efc4649db916aaba39d601
22:34 dalek book: dc98ead | moritz++ | src/multi-dispatch.pod:
22:34 dalek book: [MMD] use method form of map consistently
22:34 dalek book: review: http://github.com/perl6/book/commit/dc98ead444b3993cb6276585af2223299c1c5062
22:34 moritz_ I also tried very hard to use I<candidate> very consistently whenever I refer to a single routine, not the whole multi
22:35 moritz_ it sometimes reads a bit weirdly
22:35 jnthn I didn't find it so weird.
22:35 moritz_ good
22:36 jnthn But maybe I'm just too used to seeing it called "candidate" in the code all the time. ;-)
22:39 moritz_ anyway, bed time here
22:39 moritz_ good night
22:39 moritz_ (and thanks for the review)
22:42 jnthn thanks for yours too - night

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