Camelia, the Perl 6 bug

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

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

All times shown according to UTC.

Time Nick Message
05:53 Tene joined #november-wiki
07:27 p6eval joined #november-wiki
07:42 masak joined #november-wiki
07:51 masak Tene: I've been reading up about hpricot, a tags lib in Ruby.
07:52 masak first off: yes, we definitely want a tags library in Web.pm.
07:58 masak second, please have a look at and let yourself be inspired to the appropriate degree by http://wiki.github.com/why​/hpricot/hpricot-challenge
07:58 zarah masak's link is also http://tinyurl.com/bw2tau
08:06 * Tene reads
08:08 wayland76 joined #november-wiki
08:08 masak wayland76: oh hai :)
08:08 wayland76 hi :)
08:09 wayland76 Is this just for November, or web stuff in general?
08:09 masak technically, it's just for November.
08:09 masak but November will be the first one against the wall when Web.pm arrives, so...
08:09 masak ...we tend to discuss Web.pm here as well.
08:09 moritz_ de factor more general
08:09 moritz_ s/or/o/
08:10 wayland76 Ok.  Because I have a bunch of p5 modules that do authentication
08:10 wayland76 either inline or HTTP Auth, depending on what you like
08:10 masak moritz_: I like "defactor". it's what we'll do with November with the help of Web.pm.
08:10 * Tene full of cough drugs, can't think.
08:10 moritz_ ;-)
08:10 wayland76 And backending onto Authen::Simple
08:10 * Tene sleeps instead
08:11 masak Tene: night.
08:11 masak see you soon.
08:11 masak wayland76: ok.
08:11 wayland76 And I'm wondering whether anyone already has auth plans, or whether I should investigate porting these?
08:11 masak wayland76: the latter.
08:11 wayland76 Tene: Hope you're well soon.  Goodnight :)
08:11 masak I haven't even thought about auth yet.
08:11 masak we need it, that's all.
08:11 wayland76 ok, well, I'm trying to build Parrot, et. al.
08:12 masak it's one of those things I'm thinking of putting into layer one of Web.pm.
08:12 wayland76 I'm one of the few people in the world who knows how to do optional HTTP Auth :)
08:12 masak wayland76: welcome, then. :)
08:12 masak wayland76: here's my PLAN. http://github.com/masak/web/blob/cc61a6​014be5cbee4cd574ce1f741de2ae642bf9/PLAN
08:12 zarah masak's link is also http://tinyurl.com/b37czv
08:13 masak if you want to send a patch or a pull request to that, I'd be delighted.
08:15 wayland76 One thing -- I note you comment that all the templates are going to be XML-based.  What does that mean?
08:16 wayland76 (links welcome :) )
08:16 masak wayland76: no, that's not quite what I mean, I think.
08:16 masak all the templates in the Genshi port will be XML based.
08:16 masak see the link to Genshi.
08:16 masak that's because the technology requires it in that case.
08:17 masak ihrd++ has plans for a simpler Templating engine which will not be XML based.
08:17 masak one which looks a bit more like PHP or JSP.
08:19 wayland76 Ok.  Because my request was going to be that the templating engine work both inside and outside Web :)
08:19 masak wayland76: oh, of course.
08:19 masak we'll tend to build everything like that.
08:19 masak also, we'll tend to build everything to be as hot-swappable as possible.
08:20 wayland76 Because I use Text::Template a lot, and hate the multiple competing templates in Perl5 when HTML::Mason is clearly superior :)
08:20 * masak checks out HTML::Mason
08:20 wayland76 The cool things about HTML::Mason are autohandlers and dhandlers :)
08:21 masak noted.
08:21 wayland76 The bad thing is it only works with a big setup around it :)
08:21 masak aye.
08:22 masak Web.pm will be a big setup, but on the other hand we don't want to paint people into a corner, or build them into a closed garden.
08:23 wayland76 I don't mind the big setup, but when doing sysadmin, I like something simple like Text::Template
08:24 masak yes, I can see the use for that.
08:27 masak wayland76: if you'd care to add a short paragraph about that in the PLAN file, you'd increase your chances of having it your way.
08:30 wayland76 I'll keep that in mind, and may get around to it in the next few days
08:30 masak cool.
08:31 masak I plan to blog a little now about the first week of Web.pm.
08:31 masak will mainly talk about the approach we seem to be taking, and some code reading I've done so far of Sinatra.
08:32 masak does anyone have a favourite bible quote? :) preferably something relevant to specs.
08:32 masak I've found Moses and the mountain so far.
08:36 wayland76 Proverbs might be a good source for that sort of thing
08:37 wayland76 Or the first few chapters of Genesis (but of the tree in the centre of the garden, thou shalt not eat)
08:38 masak ooh.
08:38 masak good idea.
08:40 masak "An Ceiling Cat sed to teh man, ov evury tre in teh gardin iz ok u eatz: But of teh tre of teh nawlej of gud an evl, you not eatz cuz wen u eatz taht tre i fur sure mek u ded. Srsly."
08:40 masak perfect.
09:07 spinclad but of teh tre of lolaj of WAI an NOWAI eatz u not else KTHXBAI!
09:09 wayland76 masak: To edit that plan, I need my own fork, right?
09:09 masak wayland76: either that, or you just download my tree, edit and email me a patch.
09:10 masak but I guess the Github Way is to fork, yes.
09:10 wayland76 ok
09:10 masak plus, that would look good on paper, and might merit you a mention in my blog post if you hurry. :)
09:19 wayland76 Ok, I forked, I've changed the files, and git-diff agrees they're changed.  How do I send you the changes?
09:19 wayland76 git-diff | mail masak ?
09:19 masak wayland76: you forked on github?
09:20 wayland76 yes
09:20 wayland76 But I didn't branch in my repo :)
09:20 masak if so, commit, push and then do a "pull request" through the web interface.
09:26 * wayland76 typed "gut push" by accident :)
09:26 masak what a funny coincidence, I almost surfed to guthub just now.
09:26 masak maybe a good candidate for web squatting.
09:27 moritz_ already registered
09:27 masak dang.
09:27 masak all the gut urls are already taken. :P
09:29 wayland76 That one took me a while (monolingual here), but I got it :)
09:30 masak :P
09:33 masak wayland76: how's that pull request coming along? I'm proof-reading the blog post now.
09:34 wayland76 Well, I've sent one.  Has it arrived at your end?
09:34 * masak checks
09:34 masak it has indeed.
09:34 wayland76 Yay!
09:35 wayland76 I'm hoping to send in a patch for rakudo later, so it was good to have a practise run :)
09:36 masak glad to be of assistance. :)
09:49 masak wayland76: I'm going to accept half of your commit.
09:50 masak re "Ideally, the templating system will also work in non-HTML, non-Web environments.", that is both implied (by the Ganshi tutorial page), and not really a goal of that layer of Web.pm -- we have other modules for people who don't like XML templating.
09:52 wayland76 I was hoping we could have just one templating module
09:52 wayland76 But I'm happy if that doesn't go in the Web PLAN
09:53 masak wayland76: we'll have at least two templating modules as it looks now.
09:54 wayland76 Well, I don't like it, but I guess I can live with it :)
09:55 masak wayland76: I'm perfectly fine discussing it, and having you convince me that two kinds of needs exist. :)
09:55 masak until then, the answer is "just don't use one of them".
10:01 wayland76 But that's my problem -- sometimes I want to use templating with HTML, and sometimes without.  If these are separate templating systems, then I have to learn both
10:01 wayland76 Or force one of them to do something it's designed to prevent you from doing :)
10:02 masak wayland76: if I get my way, one will be a subset of the other.
10:04 wayland76 How about if we changed it to "Ideally, the lower levels of the templating system will also work in non-HTML, non-Web environments."
10:04 wayland76 Would that work?
10:04 masak yes, but that's a given. no "ideally".
10:07 wayland76 Sounds fine, then :)
10:07 wayland76 (ie., drop the "ideally")
10:07 masak aye.
10:07 masak I'll do that.
10:08 * masak does 'git fetch wayland master'
10:17 masak wayland76: something in your work environment adds line-ending spaces. just thought you should know.
10:24 wayland76 What, on every line?
10:25 wayland76 Or just the ones I was editing?
10:27 masak just yours.
10:36 wayland76 Ok.  That only happens when it word wraps.  And it doesn't bother me :)
10:36 wayland76 Believe it or not, I use "nano" :)
10:36 masak I believe you.
10:36 masak but be aware that some people will be offended if you send patches with line-ending spaces.
10:37 masak (I don't mind much, but I'd rather not have them there, so I removed them.)
10:40 wayland76 Fine by me (about removing them).  I'll worry about it when it happens, but thanks for the warning :)
10:41 masak perl -i.bak -pe's/ +$//' file
10:42 wayland76 ok :)
10:42 masak throw that in a script in a bin/ dir somewhere. problem solved. :)
12:02 ihrd joined #november-wiki
12:08 ihrd hi there
12:11 wayland76 hi :)
12:12 ihrd wayland76: hi, I am reding logs. Today my first night of the grant
12:13 ihrd start to diggin in all this opinions and links
12:15 masak ihrd: aloha.
12:15 ihrd I see some parts, but actualy do not have complite plan for this work
12:15 ihrd a lot of ways and posibilites
12:15 ihrd masak: HAI
12:16 masak ihrd: I think our topmost priority should be to move November over to Web.pm.
12:16 masak I'm not sure I know yet which parts we need for that.
12:16 masak maybe it'll be a piece-by-piece process.
12:17 masak no, strike that. most _likely_ it'll be a piece-by-piece process. :)
12:17 ihrd templater, routines, coockies + sessions, authorization
12:17 masak aye.
12:17 moritz_ please do authentication first
12:17 moritz_ then authorization
12:17 masak moritz_: why?
12:17 masak ah.
12:17 masak sure.
12:17 moritz_ because it's the more basic task
12:18 ihrd :)
12:18 masak aye.
12:18 masak auth and sessions are somewhat bundled, I think.
12:18 masak we already have a templater, but we don't really like it.
12:18 masak ihrd: what do you mean by 'routines'?
12:19 ihrd masak: generaly, way to handle requests
12:20 masak like, dispatcher?
12:21 ihrd yes
12:21 masak great.
12:22 ihrd 'Routines' this is from the rails
12:22 masak ah.
12:23 ihrd in Catalyst you have Controllers and actions, and you set attributes for dispatcher
12:24 masak ok.
12:24 ihrd in rails you have one file routines.rb with DSL about how to handle URIs
12:24 masak ah.
12:24 masak do we need any DSLs for Web.pm?
12:24 masak because right now, we can't build'em in Rakudo.
12:25 ihrd Tags.pm is the some sort of DSL
12:25 masak which Tags.pm? from CPAN?
12:25 masak or the one Tene's about to build?
12:25 ihrd no, we speak about it... yes Tene`s
12:26 ihrd what you want to have in Rakudo for DSLs?
12:26 masak and by "DSL" here, you mean a lot of sub names that look like a whole new language, right?
12:26 masak sort of like CGI.
12:26 masak (from CPAN)
12:27 ihrd CGI is big, and handle the request and Tags helpers in one
12:28 masak aye.
12:28 masak just using it as an example of a "DSL" in Perl.
12:28 ihrd yes, basicle a lot of subs. I mean helpers for specific propouse
12:29 ihrd oh, excuse my English, awfull. I need spell dictionary for pidgin
12:29 masak it's going well so far, methinks.
12:30 masak I'll ask if I don't understand.
12:30 masak ihrd: did you read my report on the first week?
12:30 ihrd thank you
12:31 ihrd yes, I read all emails and you blog post. And reading logs of this chanel right now
12:32 masak excellent.
12:33 masak some people don't like the name Web.pm because they think it's too general.
12:34 masak I think Web.pm itself is fairly general. it does web things.
12:34 masak it does exactly what the name of the module says it does.
12:36 ihrd right now we do not have any strong conception, so I can`t prefer name. Web.pm is okay for my as work-name.
12:36 masak indeed.
12:37 masak but I think we should name all the components.
12:37 wayland76 Auth and Sessions can be are independent, but work together
12:37 masak wayland76: then what matters is to make them work well together.
12:38 wayland76 Yah, exactly
12:38 ihrd masak: yes, HTML::Tags, HTTP::Request, Template::Simple
12:38 masak ihrd: aye, maybe for those.
12:39 masak but for bigger things, like the MVC framework and some of the templaters, we should give them unique names.
12:39 masak like Rack, Sinatra, Genshi, Rails and Catalyst.
12:39 wayland76 My UserAuth package which I was talking about porting depends for at least some of its functionality on CGI::Session, CGI::Cookie, and Authen::Simple (or any other Authen module you want to slot in)
12:40 masak ok.
12:41 masak I'd like to see a detailed explanation about how that works. is there any CPAN Pod I should read?
12:41 masak s/Pod/POD/
12:41 wayland76 How which works?
12:41 wayland76 the UserAuth package I did?
12:41 masak the interaction between UserAuth and the other CPAN modules.
12:42 wayland76 This was never submitted to CPAN -- I got lazy :)
12:42 wayland76 I can zip it up and send it to you, though :)
12:42 wayland76 It has documentation in it
12:44 masak I'd appreciate that.
12:45 wayland76 (same terms as perl itself, of course :) )
12:47 masak aye.
12:54 masak how can Sinatra (and HTTP::Server::Simple::CGI from CPAN) act as a whole web server?
12:55 masak and, perhaps more importantly, should we try to do the same in Web.pm?
12:55 ihrd masak: okay, we need name. But first we need conception and architecture --  why and how we put all things together in f/w. As I say before, it is still a lot of parts and a lot of ideas about, not complite vision for now.
12:55 masak ihrd: agreed.
12:55 wayland76 I agree that at least level 1 should be called Web
12:55 masak I've started in PLAN to put together all I've every thought about the subject.
12:56 masak but much still remains.
12:56 masak and much work remains to turn it into a coherent whole.
12:56 wayland76 I don't think Web should act as a whole web server -- I think we should work with CGI in Apache, with mod_parrot, and with others to follow as people want them
12:56 ihrd I think dispatcher is one of the 'core' stuff
12:56 masak wayland76: maybe you're right that the upper levels shouldn't be called Web.pm -- that remains to be seen. for now, I don't want to exclude those level just becuase they're more advanced.
12:57 wayland76 masak: Agreed
12:57 masak wayland76: have you tried Sinatra?
12:57 masak there's something very alluring about writing five lines of code and then deploying it as a full stack web app.
12:57 wayland76 no.  About the only thing I've actually tried is Drupal
12:57 ihrd I have too ideas I like here: 1) REST 2) :Chained 3) Routines
12:57 masak I'm not saying we should force the web server on anyone.
12:58 masak ihrd: please add them to PLAN if you have the time.
12:58 masak I can review it and polish the English if you want.
12:58 masak ihrd: simply a list of those three would be very good.
13:00 ihrd frankly speaking, my plans to work hard on the grant today is broken, btw I start immersion
13:00 ihrd masak: yes, I will do
13:00 masak ihrd: oh well. hope that you're free to do it soon.
13:00 wayland76 Don't worry, I failed in my goal today of having an up-to-date parrot RPM by the end of the day :)
13:02 rkendall joined #november-wiki
13:02 masak rkendall: welcome :)
13:02 ruoso joined #november-wiki
13:03 masak ruoso: welcome. :)
13:03 Matt-W joined #november-wiki
13:03 ihrd masak: I start today, my day 0 I think. I will work every day.
13:03 masak Matt-W: welcome. :)
13:03 ruoso anyway
13:03 masak ihrd: no worries. you make your schedule.
13:03 ruoso today's crazy idea follows:
13:04 masak ihrd: but it's good that we meet here to discuss sometimes, not just reading each other's commit messages.
13:04 ruoso one of the most important featuers I've been using in Catalyst is the fact that it is engine-agnostic
13:04 masak aye.
13:04 Matt-W masak: thought I should pop in and keep an eye on you :P
13:04 masak ruoso: what does that mean for you?
13:04 rkendall glad to be hear
13:04 masak Matt-W: aye, I need it.
13:04 ruoso I used Catalyst to build a XMPP client
13:04 masak oh, cool.
13:04 ruoso to build a CLI app
13:04 ruoso and even to embbed in some other cat app
13:05 masak ruoso: by engine, you mean things like Apache, yah?
13:05 ruoso yes
13:05 ruoso Catalyst::Engine::*
13:05 masak ok.
13:05 ruoso (myself being the author of two)
13:05 masak :)
13:05 ruoso but one thing Catalyst didn't make pluggable
13:06 ruoso was the semantics of the request
13:06 ruoso I always need to translate into HTTP semantics
13:06 ruoso even if I'm talking XMPP
13:06 masak ruoso: my current plan is to port Rack from Ruby.
13:06 ruoso Rack?
13:06 masak ruoso: I guess that one uses HTTP semantics as well.
13:07 masak ruoso: see PLAN in the Web.pm repo.
13:07 masak http://github.com/masak/web/tree/master/PLAN
13:07 ruoso link?
13:07 zarah masak's link is also http://tinyurl.com/7jywvo
13:10 ruoso masak, my point is that you have several pieces that will form your framework
13:10 masak wow, 12 people in here. that's a record. and three bots.
13:10 masak ruoso: indeed.
13:10 ruoso the biggest catalyst strength is to make those as separated as possible
13:10 ruoso that's actually the biggest RoR weakness
13:11 ruoso RoR is much more monolitic
13:11 rkendall ...it's also nice if it's easy to use all of the bits together
13:12 ruoso sure... I think the use of a custom grammar in the end will make that very easy
13:13 masak well, things like Sinatra could be said to be monolithic. but it's also nice to have before you choose a real engine.
13:13 masak ruoso: custom grammar for what?
13:13 ruoso controller Foo { action bar { } }
13:15 masak ah, yes.
13:16 masak but first, the underlying semantics. :)
13:16 ruoso well
13:16 masak it'll be a while yet before Rakudo has modifiable grammars.
13:16 ruoso the basic parts of that semantics are:
13:16 ruoso 1) receiving a request
13:16 ruoso that's the "engine" part
13:16 ruoso it knows how to be triggered for an event
13:17 masak aye.
13:17 ruoso and generates a "Request" object
13:17 masak I, for one, think that Web.pm should be able to handle the engine part standalone if it has to.
13:17 masak but work well with Apache et al too.
13:18 ruoso in Catalyst the "Request" object is very HTTP-specific
13:18 ruoso this is something that can be fixed
13:18 ruoso you can have a much more generic "Request" role
13:18 ruoso and have a HTTPRequest role to complement it
13:18 masak ruoso: ok.
13:18 masak ruoso: sounds like a good thing.
13:18 ruoso this "Request" object is the thing that takes us to the second step
13:18 ruoso 2) dispatch
13:19 masak aye.
13:19 masak ihrd++ is on top of that.
13:19 ruoso This takes info from $req in order to dispatch
13:19 masak November already has a dispatcher, even.
13:19 ruoso I think the generic request role would provide
13:19 ruoso has $.uri
13:19 * masak needs to turn ruoso++'s steps into a diagram of some sort
13:19 ruoso has %.params
13:20 masak might be good to have a diagram to show people.
13:20 rkendall I would have thought the idea for Web.pm would be to be HTTP specific, otherwise isn't it stretching the scope a bit.
13:20 masak indeed.
13:20 ruoso rkendall, you sure can implement the Web part only, for now
13:20 ruoso but it doesn't hurt to make it extensible
13:21 rkendall I guess it bears thinking about
13:21 ruoso The mistake in Catalyst in the dispatch part
13:21 ruoso is to make each dispatch type independent
13:21 ruoso like
13:21 ruoso it first tries to dispatch "Regex"
13:21 ruoso if that fails
13:21 ruoso it tries "Chained"
13:21 ruoso if that fails "Path"
13:21 ruoso you need a way to provide an unified dispatching
13:22 ruoso I think the good way of doing it is basically to consider everything "Chained", while support different part matching algorigthms
13:23 masak aye, we talked about that the other day.
13:23 masak I emailed the discussion to the november-wiki mailing list.
13:23 masak ihrd liked the idea.
13:23 ruoso (look for Catalyst::DispatchType::Chained)
13:23 ihrd ruoso: hi, sorry, I have thoughts, but all my attention on the reading you chat, I have no time to answer :) English is not my original language, and I am tired now, so reading take all of me :)
13:24 masak ihrd++ # for trying
13:24 ruoso the third step is actually having no third step
13:24 ruoso ;)
13:24 masak 3. ???
13:24 masak 4. profit!
13:24 ihrd yes, I send email about this too, I like :Chained in Catalyst
13:25 masak ihrd: I like the fact that you know what ruoso++ is talking about :)
13:25 ruoso see Catalyst::Action::RenderView
13:25 ruoso most cat applications have a "end" action is a Catalyst::Action::RenderView
13:25 ihrd masak: you can read Manual::Intro for fast breif about types in Catalyst dispatcher
13:25 ruoso that only calls a "default" view if no response was set yet
13:25 masak ihrd: will do. thanks.
13:25 ruoso but that's app to the application, not to the framework
13:26 ruoso s/that's app/that's up/
13:26 masak indeed.
13:26 ruoso that's a very important aspect of Catalyst
13:26 ruoso that's why it's so easy to use multiple views in the same app
13:27 masak it would be nice to eventually drop November over on an MVC framework.
13:27 masak but I'm afraid that is outside the scope of the grant.
13:27 masak ihrd: have you thought about the MVC framework and databases?
13:28 ruoso masak, I'd suggest not trying to implement a ORM in your framework
13:28 ruoso it should be external to it
13:28 masak ruoso: see earlier discussion about giving the larger parts real names.
13:28 ihrd ORM is a big deal
13:28 masak ruoso: at this point, I don't know if they will form a part of Web.pm in some real sense.
13:29 masak ruoso: perhaps they will just be very compatible on some API level, or some such.
13:29 ihrd we can`t make as part of this grnt
13:29 ruoso masak, you shouldn't expect any API on the model
13:29 ruoso that's also a big strength in Catalys
13:29 masak ruoso: I don't know what to expect yet. :)
13:29 ruoso masak, see Catalyst::Component
13:30 * masak opens another tab in his browser
13:30 ihrd I use Catalyst a lot, so when I think about web MVC I thiking in Catalyst maner
13:31 ruoso ihrd, cool...
13:32 ruoso I think I need to subscribe to the list you're using...
13:32 ruoso where is it hosted?
13:33 ruoso masak, putting it simple... the thing that Catalyst really implements is the Controller part, both the model and the view are just in the "Component" level, which means that it is up to each implementation to decide what to do
13:33 ruoso they are named "Model" and "View"
13:33 ruoso so you can do
13:33 ruoso $c->model('Name')
13:33 ruoso instead of
13:33 masak ruoso: http://groups.google.com/group/november-wiki
13:33 ruoso $c->component('Model::Name')
13:33 zarah masak's link is also http://tinyurl.com/awn2o7
13:34 masak ruoso: ok. I need to read up on Catalyst, but I hear what you're saying.
13:34 ruoso while the application is running
13:35 ruoso Catalyst has this core variable "$c"
13:35 ruoso which, interestingly, is named "context"
13:35 ruoso then you have $c->request
13:35 ruoso $c->response
13:35 ruoso $c->session
13:35 ruoso $c->stash
13:35 ruoso and so on
13:35 ruoso that obviously can be replaced by
13:35 ruoso $*request
13:35 ruoso $*response
13:36 ruoso $*session
13:36 ruoso $*stash
13:36 ruoso actually
13:36 ruoso %*session
13:36 ruoso %*stash
13:37 ruoso that being said
13:37 ruoso $*request and $*response
13:37 ruoso might be expected to be declared by the engined
13:37 ruoso *engine
13:37 ruoso so the dispatch part can simply assume that
13:38 ruoso Ok...
13:38 ruoso now to the most important core aspect of how Catalyst works
13:38 ruoso which is Class::C3
13:39 ruoso Catalyst is so easily extensible because adding a plugin is just a matter of adding another superclass to the application
13:39 ruoso because every processing step always call $self->next::method
13:40 ruoso so all plugins can have code executed in any step of the processing
13:40 ruoso just by implementing that method and calling $self->next::method in the end
13:43 ruoso I'm not sure if $obj.*method() is supposed to do that, but I think not
13:43 ruoso or maybe yes...
13:43 ruoso but plugins should be translated as Roles in Perl 6
13:44 ruoso so you instantiate the application, and starts composing the roles of all the plugins
13:44 ruoso very much important
13:44 ruoso also
13:44 ruoso is that each action is really an object, not just a method
13:44 ruoso because you need to be able to compose roles there too
13:50 ruoso indeed...
13:50 ruoso after some testing
13:50 ruoso that can be represented in terms of multi methods, role composition and $obj.*method
13:50 ruoso so no need for next::method
13:54 ruoso masak, http://dev.catalystframework.​org/old-wiki/wiki/FlowChart/
13:54 zarah ruoso's link is also http://tinyurl.com/djdc6j
13:54 masak ruoso: awesome.
13:59 ruoso masak, but mst has been saying that "begin" and "auto" should also be represented in terms of chained actions
13:59 masak okay.
13:59 ruoso "end" and "default" I think still need to be somewhat special
14:00 masak mm.
14:00 ruoso masak, but maybe they don't
14:01 ruoso maybe you can just consider an action that would match when no other did
14:01 ruoso as for default
14:03 ruoso and if everything is designed in terms of chained
14:03 ruoso you can consider that the action will be called in two phases
14:03 ruoso "execute" and "end"
14:04 masak ok.
14:04 ruoso then the same chain is used to end the request
14:04 masak this doesn't tell me much, since I don't know Catalyst yet.
14:04 masak but it's in the logs for when I do.
14:04 ruoso basically
14:04 ruoso an action is an object
14:05 ruoso where Catalyst calls "execute"
14:05 ruoso when it does,
14:05 ruoso it usually ends up executing the code that is in the sub
14:05 masak ok.
14:05 ruoso in order to generalize "end", it would call an additional method "end"
14:05 ruoso instead of doing a second dispatch to that
14:05 ruoso which is what cat does today
14:06 masak ok.
14:06 ruoso today cat does several dispatches in each request (as that flowchar shows)
14:06 ruoso begin, auto, the action itself, end
14:06 ruoso and optionally default
14:06 ihrd a lot of dispatch
14:06 ruoso the idea is to consolidate all of that into a single chained dispatch
14:06 masak sounds nice.
14:07 masak if it can be done, that is.
14:07 masak "as simple as possible, but no simpler"
14:07 ruoso one of the problems cat suffers today
14:08 ruoso is the lack of a difference between control exceptions and failures
14:08 ruoso which can be fixed in Web.pm
14:08 masak ruoso: do you have a concrete example of that?
14:08 ruoso masak, the block that explains how auto processes
14:08 ruoso it needs to check for a "false" return
14:09 ruoso also
14:09 masak uh huh.
14:09 ruoso when you want to "detour" the dispatch from a given point
14:09 ruoso it gets very confused
14:09 masak like me, right now. :)
14:09 masak what do you mean by "'detour' the dispatch"?
14:09 ruoso that can be solved by using ControlExceptions
14:10 ruoso let's say you're dispatching a chain
14:10 masak ok.
14:10 ruoso but at some point, you realise there's an error
14:10 masak during the dispatch?
14:10 ruoso while dispatching an inner action of a chain
14:10 masak ok.
14:10 ruoso masak, do you understand the common use of chained dispatch?
14:10 masak no, not at all.
14:11 masak this is not my department, it's ihrd's
14:11 ruoso say you have a blog
14:11 masak I'd like to understand it, but I simply haven't read up on it yet.
14:11 ruoso then you have the url
14:11 masak aye.
14:11 masak I'm with you so far. :)
14:11 ruoso /blog/category/foo/post/bar/comment/bla
14:11 masak sure.
14:11 ruoso that's usually represented as a set of chained actions
14:11 masak ok.
14:12 ruoso comment(1 arg) -> post(1 arg) -> category(1 arg) -> blog(0 args)
14:12 ruoso and they get executed from inner-to-outer
14:12 masak uh huh.
14:12 ruoso first the "blog" action, then "category", then "post" then "comment"
14:12 masak sounds reasonable.
14:13 ruoso but if the category doesn't exist, for instance
14:13 ruoso you might want to "detour" the dispatch
14:13 masak "short-circuit", perhaps?
14:13 masak "detour" means going away and then coming back later.
14:14 ruoso catalyst calls it $c->detach('/destination')
14:14 masak ok.
14:14 ruoso but when you mix that with eval blocks
14:14 ruoso it just gets very confusing
14:14 ruoso because that was supposed to be a control exception
14:14 ihrd $c->detach(/error404);
14:15 ruoso but there's no such thing in p5
14:15 masak right.
14:15 masak so this is all about meking use of Perl 6's exception handling.
14:15 masak I like that.
14:15 masak the best kind of code is no code.
14:16 ruoso so, the final picture
14:16 ihrd I hope we will make clear dispatcher
14:16 ruoso 1) the engine code is something external that declares $*request and $*response
14:16 ruoso where you have generic Request and Response roles
14:16 masak ihrd: there certainly doesn't seem to be a shortage of ideas, at least :)
14:17 ruoso but also specific Request::HTTP and Response::HTTP
14:17 ruoso or even
14:17 ruoso Request::Apache and Response::Apache
14:17 ruoso 2) the dispatch code is something that tries to match an action using $*request
14:17 ruoso takes that action
14:18 ruoso calls $action.begin
14:18 ruoso $action.execute
14:18 ruoso $action.end
14:18 ruoso and that's all
14:19 * masak likes that
14:20 ruoso it's important to realize that matching a request to an action
14:21 ruoso implies $*request ~~ $action
14:21 ruoso so you basically ends up with something similar to
14:21 ruoso given ($*request) { when $action1 { }; when $action2 {} }
14:22 ruoso but you'll never actually write that code, of cousre
14:22 masak that sounds very alluring.
14:22 masak it's a great way to explain it, too.
14:22 masak and it works perfect with perl 6.
14:22 masak more such things. :)
14:22 ruoso now the initialization part
14:22 ruoso which is the most hard
14:23 ruoso you need a simple way of getting all that declared
14:24 masak when loading the module?
14:24 masak yes.
14:27 ruoso ideally, you would have a custom grammar
14:28 masak we're not developing ideally right now, though.
14:28 masak we're writing working code.
14:28 masak but yes, noted. we want a custom grammar later.
14:28 ruoso so, the code will require some initialization overhead
14:28 masak right.
14:28 masak as long as we get the semantics right now, we can fix the syntax later.
14:30 ruoso basically, every controller will require something like
14:30 ruoso $*application.register_controller($?CLASS)
14:31 ruoso and every action would be something like...
14:31 ruoso my $action = Default::Action::Class.new();
14:31 ruoso $action does Chained; # for instance
14:31 masak right.
14:31 ruoso $action.chain($otheraction)
14:31 ruoso $action.chain = $otheraction; #actually
14:32 ruoso $action.pathpart = 'something';
14:32 ruoso $action.captureargs = 1;
14:32 ruoso actually
14:33 ruoso my $controller = $?CLASS.ne
14:33 ruoso my $controller = $?CLASS.new
14:33 ruoso $controller.register_action($action);
14:33 moritz_ register-action
14:34 ruoso $*application.register_controller($controller)
14:34 masak :)
14:34 moritz_ dashes are allowed in identifiers, so USE THEM
14:34 masak moritz_: I've also switched over almost completely to dashes.
14:34 ruoso :)
14:34 masak need to go through my projects and dashify them completely some time.
14:34 ruoso $action does Chained{ :chain($otheraction), :pathpart('something') }; is also valid syntax
14:34 moritz_ whenever I see a propose to add some under_scored name to language it makes me cringe
14:35 masak need to start using the p6 colour scheme in vim as well, because dashes ruin the usual perl colour scheme.
14:35 masak moritz_: you should write a p6u mail about it.
14:35 moritz_ masak: I should. And/or blog about it
14:35 ruoso masak, actually
14:35 masak moritz_: aye.
14:36 masak ruoso: oh, parameterized roles FTW.
14:36 ruoso my $controller = Default::Controller::Class.new();
14:36 ruoso my $action = Default::Action::Class.new();
14:36 ruoso $action.begin = { do something };
14:36 ruoso $action.execute = { do something };
14:37 ruoso $action.end = { do something };
14:37 moritz_ couldn't $action just be a sub, and you can wrap that if you want begin/end actions?
14:38 ruoso begin/end happen in a different time then execute
14:38 ruoso it first calls begin in the whole chain
14:38 ruoso then calls execute in the whole chain
14:38 ruoso and then end in the whole chain
14:40 ruoso thinking again
14:40 ruoso you don't really need controllers
14:40 ruoso except for the matter of organizing code in modules
14:42 ruoso so you just have
14:42 ruoso my $action = Action.new();
14:42 ruoso $action.begin = { do something };
14:42 ruoso $action.execute = { do something };
14:42 ruoso $action.end = { do something };
14:42 ruoso $action does Chained{ :path-part<something>, :parent($otheraction) };
14:43 ruoso $*application.register-action(​'/controller-name/local-name', $action); # so you get the private name for the action...
14:44 ruoso hmm...
14:45 ruoso "begin", "execute" and "end" are not good names for the attributes
14:45 ruoso probably better to have them as "begin-closure", "execute-closure" and "end-closure"
14:45 ruoso since you have the actual methods that invoke that closures called .begin, .execute and .end
14:50 ihrd so in your vision app is set of Action objects, chained actions.
14:51 ruoso the dispatching part of the app
14:51 ruoso yes
14:51 ruoso you still need to handle the other components
14:55 ihrd I will re-read this log tomorrow, when I will be cheeful, and ask my questions. thank you!
14:55 masak ihrd++
14:56 ruoso ihrd, masak, I'm doing some sketches on some roles that related to this discussion
14:56 ihrd (masak: this question can be stupid, add my karma if it is not)
14:56 masak :)
14:56 masak ruoso: cool.
14:57 masak I'm amazed at the way people volunteer in this Web.pm effort.
14:57 ruoso but I do think we're going to need a more generic name, tho ;)
14:59 masak thank you, noted.
14:59 ihrd I am going to sleep, bb
15:00 masak ihrd: see you around.
15:00 ihrd left #november-wiki
15:39 ruoso masak, I think I just had another crazy idea
15:39 masak let's hear it.
15:39 ruoso what if the URI -> Action matching is done by an application-wide grammar?
15:40 ruoso where dispatching the action is the action of the token?
15:40 masak that does indeed sound crazy :)
15:40 masak could you paste a piece of example code or sump'n?
15:40 ruoso I thought about it when I realized that matching the action will require to store match information
15:40 ruoso for capture args
15:40 masak aye.
15:41 ruoso and I would need to store the match in the request
15:41 ruoso to look there later
15:41 ruoso so it's probably better to make it a grammar
15:41 ruoso that calls the appropriate actions
15:42 ruoso that's actually very cool
15:42 ruoso because when matching
15:42 ruoso /blog/category/foo/post/bar
15:42 ruoso it could look for the category 'foo' during the matching
15:43 ruoso and fail that rule otherwise
15:43 ruoso allowing a different rule to proceed
15:46 masak that sounds cool.
15:46 ruoso masak, http://sial.org/pbot/35415
15:46 ruoso that's from before the latest crazy idea
15:47 masak ruoso: do you mind if I commit that to the Web.pm repo?
15:47 ruoso not at all
15:48 ruoso it's just that I hadn't cloned it yet
15:48 * masak goes ahead
15:48 ruoso otherwise I would add it myself
15:51 Tene_ joined #november-wiki
15:52 ruoso masak, in that file, the run-action method should actually enclose the begin and execute in a try block which would put any exception into a context variable before runnnig .*end
15:52 masak uhm.
15:53 masak I didn't read it carefully, I just stored it away for when I'm ready to understand it.
15:53 masak don't ask me to modify source code I don't grok. :)
15:53 ruoso ok... I'll send another revision in a sec
15:54 ruoso (I should clone the repo at some point... but I can't do it right now)
17:55 ruoso http://sial.org/pbot/35421 - updated version of the notes I wrote

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