From: Eric W. <scr...@gm...> - 2007-03-17 21:57:22
|
# from Mark Dootson # on Saturday 17 March 2007 02:13 pm: >the main attraction to me is getting named accessors for your child >controls /menus /toolbars etc. Yes, I think that's fairly key to cleaning up the syntax. Assignment statements which could be taken as implied should be. The same goes for $self (though this is understandably where some people get scared and say "whoa, not so fast.") >I think I'd consider something a touch more verbose Hmm... I'm trying to make it *less* verbose and more concise. What's good about verbose? XML? >involving Class::Accessor::Fast. I've run into problems with the typical 'use base qw(Class::Accessor)' approach and multiple inheritance. Maybe I want a new() method from a package in which I want to override a foo() method with a generated accessor, but the Class::Accessor scheme says "too bad, you get my new()." The solution that I came up with involves letting the accessor generator have it's way with a "secret" base class. While I was at it, I realized we can get rid of the whole __PACKAGE__->mk_foo() stuff too. http://search.cpan.org/search?module=Class%3A%3AAccessor%3A%3AClassy >With regard to your WxPerl::Declares section... >As it stands, the syntax does look very inaccessible. What specifically makes it inaccessible? Or, is it just unfamiliar? I understand the aversion to magic, but once you know the trick, it's not magic anymore. Do you have a suggestion (even if you don't think it would compile, I would like to see it.) There are a lot of component parts that I'm trying to put together, and I'm trying to leave out any syntax that isn't needed. Thus, the arguments to children() are a flat list, where the keyword 'ctrl' (this is actually a subroutine "sub ctrl ($) {$ctrl_token, @_}") marks the start of a new control declaration. children( ctrl custom_bit => 'Thing::Control' => 'argument', 'argument', ctrl text_ctrl => -TextCtrl => "", style(te => 'MULTILINE|READONLY|DONTWRAP'), ... You could probably sprinkle some parenthesis in there without breaking anything, but that might mean you needed to quote more. I'm also considering having ctrl() be a completely different beast, but I haven't come up with a way to manage that without package variables or something which otherwise assumes a state. The benefit of using $ctrl_token is that everything is a list of inputs to children() rather than individual statements. This allows children() to handle lots of implied stuff such as $self, and I think makes it easier to build the single subref which gets installed as the __create_children() method (double-underscores are for wxglade replacement compatibility.) --Eric -- Turns out the optimal technique is to put it in reverse and gun it. --Steven Squyres (on challenges in interplanetary robot navigation) --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- |