Camelia, the Perl 6 bug

IRC log for #november-wiki, 2009-03-19

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:45 ihrd1 joined #november-wiki
03:27 Tene_ joined #november-wiki
07:29 ihrd1 left #november-wiki
08:27 masak joined #november-wiki
12:17 ihrd joined #november-wiki
12:34 ihrd hi there
12:51 ihrd masak, I see you messages in the log
12:51 masak hello.
12:52 ihrd dispatcher fully in master, so we can remove this branch
12:53 ihrd asteriks was blocken, but now I fell I can make it works, I will do that
12:53 masak cool.
12:54 masak I'll remove the dispatcher branch.
12:54 masak ihrd++
12:54 ihrd ah, plz, use ++ when I done something :)
12:54 masak you answered my question :)
12:54 ihrd I still ill and that makes my sad :(
12:54 masak also, you implemented dispatch in November.
12:55 masak ihrd: I wish you good health. get lots of rest and liquid.
12:55 ihrd but I skid with new shine Web::Dispatcher
12:56 ihrd I cant first, but I do second :)
12:57 ihrd what you thinking about my tiny example, Forest?
12:57 * masak can't parse 'skid with new shine'
12:58 masak sounds great, though :)
12:58 masak ihrd: I haven't had time to look closely at Forest, but I'll be glad to.
12:58 masak I really like the name.
12:58 masak I'll look at it this evening, when I'm not at $WORK.
12:59 ihrd I mean skid like car do
12:59 masak ok, I get it now.
12:59 ihrd or slip
12:59 masak 'slip' in projects means 'postpone'.
12:59 ihrd I just found thet words in dic
13:00 masak :)
13:00 ihrd in russian we use phrase like this
13:01 ihrd to sign situation when someone go forward slow and with trouble
13:02 masak so, just to make clear, 'skid with new shiny Web::Dispatcher' means 'make slow progress with the new shiny Web::Dispatcher'?
13:04 masak if so, I'm still looking forward to it when it arrives. :)
13:05 masak working code doesn't even have to involve a full stack... but you know that, so no need to say it. :)
13:07 ihrd Tene_, how are you?
13:08 ihrd masak: I hope fix my body, and make progress on this weekend
13:09 masak ihrd: I'm hoping for progress here too, tonight and in the weekend.
13:09 masak currently porting Rack's Util, Request, Response
13:09 ihrd masak++
13:10 masak discovering things missing in Rakudo that we need.
13:10 masak specifically, turning a string into its UTF-8 bytes.
13:11 masak Parrot should be able, but the Parrot devs seem slightly befuddled as to why I would want to do this.
13:11 ihrd my  Template. blocked by rakudobug again
13:12 masak aye, saw that.
13:12 masak no workaround available?
13:12 ihrd Jonathan :)
13:12 masak sure, but short-term.
13:12 ihrd he said this one simple to fix, and he do thest
13:13 masak oki.
13:13 ihrd thet in next few days
13:13 ihrd can you put our propousal pod to the root of web repo?
13:14 masak sure, good idea.
13:14 * masak does that
13:14 ihrd and I think we should make list of related repos in README
13:14 ihrd Maya, November, URI
13:14 masak definitely.
13:15 masak and also describe the contents of doc/ in the README
13:15 ihrd and links to blogs where we mark progress
13:15 masak yes, links to all blog entries about this.
13:15 ihrd I will do my first post on this weekend
13:17 masak goodie.
13:17 masak I don't think it's bad that we're slightly out of phase.
13:17 masak I might take a week's vacation later instead and let you catch up :)
13:20 ihrd yes I will wright to TPF about my ailment
13:21 masak sure.
13:44 ihrd I do not recived any emails from Adrian from the 5 March
13:46 masak same here.
13:46 masak 2009-03-05 was the last time he wrote to me.
13:55 ruoso ihrd, please consider putting the Request::Method in the end of the arguments
13:55 ruoso since the verb is most relevant to the last part of the uri
13:55 ruoso not to the first
13:56 ruoso and I also suggest adding a marking for the start of the uri
13:58 ruoso additionally, I'd consider having all the multi installed in a single variable
13:58 ruoso my &a = Multi.new
13:59 ruoso &a.push($candidate);
13:59 ruoso &a.(args...)
14:00 ruoso ihrd, that already works in rakudo....
14:00 ihrd hi Daniel :)
14:00 ruoso hi ihrd
14:01 moritz_ wow, ten non-bots in here. It's getting crowded :-)
14:01 ihrd what benefits of this?
14:01 * masak enjoys #november-wiki being crowded
14:01 masak bots are welcome too.
14:02 ruoso ihrd, one thing that was making me unconfortable was how the candidates would be installed in the namespace
14:02 ruoso putting it into a variable makes it cleaner
14:03 ruoso so the actions can be registered in the &dispatcher multi
14:03 ruoso so I asked jhntn about it, and he implemented Multi.new in rakudo
14:03 ruoso to the second point...
14:04 ruoso having the request method in the end of the arguments, make the verb close to the last part of the uri
14:05 ruoso which means that the uri identifies which resource and the last argument identifies which verb
14:05 ruoso this is mostly important to later support calling reduce with that multi
14:06 ihrd if I have class with methods how I can put it in this variable?
14:06 ruoso ihrd, you can always declare the method as my or our
14:06 ruoso and use it as &foo
14:07 ihrd I mean I like to have normal class with methods
14:07 ruoso I see... but why do you want that?
14:07 ruoso action dispatch is completely non-oo
14:07 ihrd because this make app maintable
14:08 ihrd if you have standrad API for resources you can use roles
14:08 ruoso by resources you mean what catalyst calls "action", right?
14:08 ihrd with tou resouces
14:09 ihrd no, I mean controller
14:09 ruoso the thing is that a "controller" is not a "resource"
14:09 ruoso it is simply a "package" of "actions
14:10 ihrd yes, this is not fully the same
14:10 ruoso I mean, it's completely different
14:10 ihrd this is about app organization
14:10 ruoso right...
14:10 * ruoso brb &
14:11 ihrd I think we can put all resource methods in one calss
14:11 ruoso ihrd, but that is not really sane in OO terms, is it?
14:11 ihrd in this case you can resource as object
14:11 ruoso right...
14:12 ruoso that's my point
14:12 ruoso each "resource" is an object
14:12 ihrd and resource has methods -- GET, POST, PUT, DELETE
14:12 ihrd other methods is... like private actions
14:12 ruoso maybe... although I would leave that as an argument... and just call "execute'
14:13 ruoso because you can then have also "begin" and "end
14:13 ruoso which are part of the processing
14:13 masak as long as you adhere to Rack's interface here, I'm happy.
14:13 masak and that will probably be easy.
14:14 ruoso rack seems to be way before that
14:14 masak right.
14:14 masak it's quite low-level.
14:14 masak but also very reasonable.
14:14 ihrd before and us agreematn to interact
14:15 ihrd s/us/as/
14:15 masak aye.
14:15 ruoso you just need to build the "arguments" from the request... then call the dispatcher
14:15 ruoso ok, let me put my perspective
14:15 ruoso I'd expect the multi dispatcher to work as a "reducer"
14:16 ruoso which means that it would return the "resource"/"action" object that is going to handle this request
14:16 ruoso so you can call .begin, .execute, .end
14:17 ruoso so, the dispatcher would look like
14:17 ruoso my @parts = $*app.request_split($*request);
14:17 ruoso my $action = @parts.reduce: &dispatcher;
14:18 masak ruoso: is there somewhere I can read about this .reduce thingy?
14:18 masak I feel I don't know anything about it.
14:18 ruoso my $error is context<rw>; try { $action.begin; $action.execute; CATCH { $error = $_; $_.handled = 1 }}; $action.end;
14:18 ruoso masak, that's the standard list reduce
14:18 ihrd this is one of the basics of functionsl programming
14:19 moritz_ the standard .reduce doesn't work with multi methods, does it?
14:19 ruoso moritz_, it is supposed to work...
14:19 masak ruoso: oh! that's ingenious, really.
14:20 ruoso moritz_, we still didn't really figure out how it will do it, tho
14:20 masak I just hadn't made the connection. I know the op form well.
14:20 ruoso moritz_, I proposed a way of doing it, which was to define a named argument to be sent to .postcircumfix:<( )>
14:21 moritz_ ruoso: yes, I know
14:21 ruoso masak, so you see what I mean now?
14:21 masak ruoso: oh yes.
14:21 moritz_ ruoso: and it bothers me a lot do base the dispatch on something that's neither specced nor implemented yet
14:21 ruoso that's why it's important to have a marker for the start and for the end of the args
14:22 ruoso moritz_, it can work without the reduce, for start...
14:22 ruoso it's not as cool...
14:22 ruoso but it still works
14:22 masak let's start by building something that works.
14:22 masak then we can refine it.
14:22 masak we're not getting a grant for building air castles. :)
14:23 masak ruoso: I definitely like the idea, though.
14:23 ruoso masak, I'm just trying to point it to that direction
14:23 masak aye, of course.
14:23 moritz_ first build a very simple MMD based dispatcher, like I proposed
14:23 moritz_ then it's a piece of cake to plug in other dispatchers
14:23 ruoso which is why i say to put two special args
14:24 ruoso one on the start
14:24 moritz_ and the default dispatcher can be changed later on
14:24 ruoso and other in the end
14:24 ruoso it wont hurt now
14:24 ruoso and enables reduce-based dispatch later
14:26 ruoso putting the req method in the end, for that same reason
14:27 ruoso masak, do you see what I mean?
14:27 masak sure.
14:28 masak but it's not me you have to convince, it's ihrd.
14:28 masak he's the one writing the dispatcher.
14:28 ruoso ihrd, do you see what I mean? ;)
14:28 ihrd not fully :(
14:29 ihrd Ok, use reduce looks like elegant way.
14:29 ihrd and you just want agreement
14:29 ihrd about chunks
14:30 ihrd but I still do not see how you see full app
14:30 ihrd I like idea to make resources useful as objects
14:30 ihrd I feel we can use OOP here
14:31 ruoso specially compose roles into a specific resource
14:31 ihrd we can make resource inheritance, too
14:34 ihrd If I understand right you see action like free pices of code
14:35 ihrd but I thinking about structure for app
14:36 ihrd mb this is not so perlish
14:37 ihrd but when I work with real life project I like to have strict structure for web apps
14:39 ihrd do you understand what I mean?
14:40 ihrd (I need dic to understand you, but you have no dic from russianenglish mess to understand my)
14:41 ruoso role Resource { multi method begin {...}; multi method execute {...}; multi method end {...} }
14:42 ruoso ihrd, for start, I see some code overhead in order to register the resources...
14:42 ruoso but that can later be fixed by a sub-language....
14:42 ruoso controller Fooo { resource bar { } }
14:44 ruoso ihrd, the dispatcher is then responsible for finding the appropriate resource to that request
14:44 ruoso in order to do that, it first generates the arglist from the request
14:45 ruoso my @parts = my_splitter($*request);
14:45 ruoso after having the parts, it can invoke the multi
14:45 ruoso my $action = &resource_finder(|@parts)
14:46 ruoso when we have reduce-with-multi working, we can replace that by
14:46 ruoso my $action = @parts.reduce: &resource_finder;
14:46 ihrd uhu
14:47 ruoso then you can perform the action...
14:47 ruoso my $error is context<rw>; try { $action.begin; $action.execute; CATCH { $error = $_; $_.handled = 1 }}; $action.end;
14:48 ruoso actually $action.*begin, $action.*execute, $action.*end
14:48 ruoso so composed roles can have its own execute called
14:51 ihrd yes
14:52 ruoso ihrd, basically it's the same as the sketch I wrote
14:52 ruoso but replacing the regex-based stuff
14:52 ihrd yes, I see
14:52 ruoso for a multi-based stuff
14:53 ihrd I read you what you wrote carefull, and execute it in my head
14:53 masak moritz_: what's underspecced re multis and .reduce?
14:54 ruoso masak, it isn't yet...
14:54 masak it isn't underspecced yet?
14:54 ruoso but the general expectation is that it should be able to reduce calling a multi with varying-arity
14:54 moritz_ masak: there's no mention of what it does with multis
14:56 ruoso the most logical way of doing it is begin trying with the higher arity...
14:56 ruoso and if that fail try with lower....
14:56 masak ruoso: ok. that sounds vaguely like LTM to me.
14:57 ruoso yes...
14:57 moritz_ ruoso: why it is the most logical way?
14:57 masak moritz_: because it gives the long-paramlist ones a change before the short-paramlist ones match.
14:57 ruoso I don't really know... maybe I'm just contamined by LTM in regexes
14:58 masak this sounds like a question for p6l.
14:58 moritz_ the most intuitive way for me would be to do a multi  dispatch that allows left over items, and pick the narrowest match
14:59 masak moritz_: 'left over items'?
14:59 * masak is so glad purl isn't here
14:59 moritz_ masak: do a dispatch with an argument list, but not all arguments have to be used for the dispatch
14:59 moritz_ so some trailing items can be neglected
14:59 masak ah, as in ;; ?
14:59 moritz_ jnthn will kill me
15:00 masak :P
15:00 moritz_ masak: kinda like. But ;; is in the parameter list, not in the argument list
15:00 masak oh, ah.
15:00 moritz_ and I don't know before where to place the ;;
15:00 masak right.
15:00 ruoso ihrd, do you see why we need two marker arguments in the start and in the end of the @parts? while the request method is in the end...
15:01 masak but please let's try to design something that doesn't require changes in the Perl 6 Spec. :)
15:01 ruoso moritz_, but even with LTM, it needs to support "left overs"
15:01 moritz_ ruoso: aye
15:01 moritz_ anyway, I think this is too much effort for a rather small problem set
15:01 ihrd ruoso: to see start and end of the chain?
15:03 ruoso ihrd, yes
15:04 ihrd but I still in confusing. You have array ofactions
15:04 ihrd actions is multies
15:04 ruoso I don't have an array of actions
15:04 ruoso I have an array of uri parts
15:05 ruoso that is reduced, by a multi, to an action object
15:07 ihrd ah, yes. this multies just return an action object
15:09 ruoso at first, you will be required to have all the uri parts as args of your multi...
15:09 ruoso but when .reduce works with reduce
15:09 ruoso with multi
15:09 ruoso you can have the action you're chaining as the first argument, and only the arguments of your own action
15:09 ruoso like
15:10 ruoso &multi.push sub (RootMarker, 'foo', $bar) { return Action::Chained('/foo/*') };
15:11 ruoso &multi.push sub (Action::Chained('/foo/*'), 'baz', $bla) { return Action::Chained('/foo/*/baz/*') };
15:12 ruoso &multi.push sub (Action::Chained('/foo/*/baz/*'), Request::Method::GET) { return Action::Public('GET /foo/*/baz/*') };
15:13 ruoso my $action = (RootMarker, 'foo', 123, 'baz', 456, Request::Method::GET).reduce: &multi;
15:19 ihrd in my Ctalyst apps I use Chained to do security checks and get some data
15:19 ihrd for example /company/1/offers
15:19 ruoso ihrd, I *only* use Chained actions
15:20 ihrd chained get comapny, and check can I see offers
15:20 ihrd in me 'Forest' sketch I am trying to make
15:20 ihrd multies work with this
15:21 ihrd I do not need stash to put geted stuff in it
15:21 ihrd I can just use it in the call to the multies
15:21 ruoso the stash
15:21 ruoso ?
15:22 ihrd $c->stash->{company}
15:22 ruoso $c is no longer needed
15:22 ruoso we have context variables
15:22 ruoso $*request in place of $c->req
15:23 ihrd I am speaking about how that done in Catalyst. I just do not see how you actions share data.
15:23 ruoso by using context variables
15:25 ihrd context variables just variables you can get by CALLER::$foo or you mean something different?
15:26 ruoso not CALLER::$foo, simply $*foo
15:26 ruoso it's not just the CALLER scope
15:26 ruoso it's the whole dynamic scope
15:29 ihrd ok
15:31 ihrd I do not see what changed
15:31 ihrd I mean you still put you stuff in var
15:32 ruoso right... that's what variables are for
15:33 ihrd and I am speaking about how I drafted chained
15:36 ihrd in my draft you can just return from Link args for the next call
15:36 ruoso ihrd, what you designed looks like forward, not chained
15:37 ihrd hm
15:38 ihrd you can use $rest to change way in that sketch, yes
15:40 ihrd but idea is to use multies again. you can have multi Link (...) {...} and same resource can work different as specific part of the chain
15:40 sri_kraih_ joined #november-wiki
15:42 ruoso ihrd, it still looks like forward... which is the opposite of chain
15:43 ihrd I do not see. why?
15:44 ruoso because in chained actions, this action assumes the other was already executed
15:45 ruoso you don't have to think about it
15:46 ihrd can you show real-life example?
15:47 ruoso the docs in Catalyst::DispatchType::Chained explains it
15:48 * ruoso later &
15:55 ihrd re-read this pod and still do not understand what I missed. Yes, actions in the chain assumes prev Chained actions executed before. This is right for my model too.
16:08 ihrd deep night, I am going to sleep. See you!
16:10 ihrd left #november-wiki
17:02 ruoso left #november-wiki
17:02 ruoso joined #november-wiki
18:50 sri_kraih_ hmm, sounds like you are porting catalyst
19:00 Tene joined #november-wiki
19:03 ruoso sri_kraih_, at least I'm pushing a lot in that direction
19:36 sri_kraih_ will be interesting to see how far you can get with the rack port
19:38 sri_kraih_ i'd like to get Mojo running on rakudo as soon as possible
19:44 sri_kraih_ not such a big rack fan personally, too much constraints, but it's a good first candidate for porting
21:54 Tene okay, working on tags tonight.
21:54 Tene going home in an hour or two, gonna start then.

| Channels | #november-wiki index | Today | | Search | Google Search | Plain-Text | summary