Monday, October 09, 2006

New Action Dispatcher - Targeting Things

The Goo has a new action dispatcher that does type-based dispatch. The action handler is chosen based on the type of Thing and it works from the web and the shell:

http://goo.localhost/r?arg1=tn7rc
shell> goo r tn7rc
shell> goo resolve tn7rc
shell> goo p HelloWorld.pm
http://goo.localhost/profile?arg1=HelloWorld.pm

But there are at least two other environments where I want to do actions on Things: email and while editing. Previously I mentioned the idea of ThereDOCs (e.g., p>>) - a way of embedding removable commands into text that help you context switch. Although there is a nice symmetry between Perl's HereDOCs <<>> - the ">>" characters are overloaded in the context of email (e.g., >> forwarding quotes) and Perl6 (i.e., hyperoperator).

So the new ThereDOCs (i.e., embedded action character sequence) will look like this: ~> and <~. The dispatcher must analyse the target of the action for 'Things' and based on type do the dispatch.

# imaging you're editing some code
use Hello::World; <~t # you want to jump to the tests for this module
use Template::Simple; <~p # you want to profile this module

# use Uri Guttman's sublime Template::Simple
Template::Simple->new->render("complicated.tpl", $tokens); <~p # jump to the profile of complicated.tpl

My::Logger::write("/tmp/look.log", $message); <~t # jump to the tail of look.log

When it comes to email I should be able to resolve a task by forwarding an embedded action to goo@somedomain.com. For example,

To: nigel@turbo10.com
CC: goo@somedomain.com
Subject: resolve~> tn5rc

Because all actions go via the Dispatcher it is also a natural place for remembering the trail of actions.

0 comments: