From: Robin Edwards Date: Thu, 17 Dec 2009 16:41:58 +0000 (+0000) Subject: adjusted plan X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3827aee1e88b71e4e86250137534477a3fa70d75;p=p5sagit%2FDevel-Declare-Keyword.git adjusted plan --- diff --git a/README b/README index 6ced004..c31d0aa 100644 --- a/README +++ b/README @@ -1,30 +1,27 @@ ABOUT This module aims to provide an easy interface to Devel::Declare. -I suggest you take a look at these first: - -Devel::Declare -http://search.cpan.org/~flora/Devel-Declare-0.005011/lib/Devel/Declare.pm - -MooseX::Declare -http://search.cpan.org/~flora/MooseX-Declare-0.32/lib/MooseX/Declare.pm - -I really don't know what I am doing, so all feedback / abuse is welcome. - -robin dot ge at gmail dot com +PLAN +* find usescases from: http://cpants.perl.org/dist/used_by/Devel-Declare +* and go through perl's -existing- keywords print $fh "sddfsd". $f, $c etc +* look at ... metalua ... and common lisp reader macros. -TODO +* use carp * remove globals -* add support for blockless keywords -* add eos inject see MXD +* write pod for Keyword::Declare + * cleanup parser construction (check if code exists etc) * write default action to return whatever the parse routine matched -PLAN -* alter Keyword::Declare to sub class of DD:C:S? -* create new Keyword::Parser class for storing parse routines +* add pre and post block hooks with shadow { setup_shit() ;exec_block(); do_shit; return $ret} +* add blockless support + +* alter sig syntax to: + keyword method (Maybe[Ident] $ident, Maybe[Proto] $proto, Block $block) { + +* long term goal, a hints file describing syntax to be shared with ppi / vim etc -SYNTAX +CURRENT SYNTAX #parse an action routines called for each entry in proto keyword method (ident?, proto?, custom, block) { $block->name($ident); # name the block @@ -54,41 +51,4 @@ action proto ($match) { } IRC - rob: hey, we were talking about this - basically, the answer is to standardise the declaration forms - so you have something like - keyword method (Proto?, Name?, Block) { - and then that can we statically analyzed by something like PPI - in order to work out what the syntax is for the keyword - then anything using 'keyword' can be supported by a single set of code - I think you'd first have to standardise the syntax for declaring declarations - but yes, I see what you mean :) - a structured macro facility would help there. but we're some way off being able to do that - kentnl: yes - kentnl: that's the point - kentnl: we write a Devel::Declare keyword -called- keyword - and standardise on that - we desperately need APIs for things like "parse a block" (properly) - yes. I was hoping we vcould at least work out how to fake them in the process - I have a long-term plan to let much of the Perl parser work in a recursive-descent manner - also, for pedanticsness sake, wouldn't the signature be keyword method ( Name?, Proto?, Block ) , unless of course, you meant the example to do "method ( $foo, $bar, $baz ) mymethod { } " notation - -... - - Same technique as is used to insert the semicolon in Moose::Declare is a good starting point. - Yeah, injecting into the backend of the block is, currently, a no no. - yea but by that point its compiled the block, so I can't seem to inject code there - until we can parse a block - But you can inject something into the beginning which sets up a datastructure that your end of scope stuff can make use of. - Obviously, you need to do something before the block which _declares_ the thing that your 'after' stuff can see - yea - may run into issues if a keyword like method is used for anon sub though? - And you can always insert 'setup_shit; $ret = do {<$block_contents' and have an EOS like '; do_shit; return $ret}' - MXD's EOS stuff catches that as well, I think. - ok - Basically, at the point you set up the insertions, you know if you have a name or are anonymous, so you know whether you need to insert a semicolon at the end or not. -#mk_parser() - Just build a method based on $ident and dispatch to that. - ok - I'd suggest making an object as early as possible, your dispatch issues get so much easier then.