From: Sergei S. <ser...@ya...> - 2007-03-18 02:16:12
|
--- Eric Wilhelm <scr...@gm...> wrote: > # 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 > --------------------------------------------------- > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users > I am not sure I clearly understand what it's about, but why new syntax/language to describe hierarchical relationship if Perl already supports hierarchical data structures ? Something like that: my $children_array_ref = # or should it be hash ref ? [ { # first child custom_bit => { type => 'ctrl', class => 'Thing::Control', args => { arg1 => value1, ... argN => valueN } }, # custom_bit text_ctrl => { type => 'ctrl', label => "", # I'm not sure about this style => { te => MULTILINE|READONLY|DONTWRAP # these are meant to be bitwise OR'ed constants } } }, { # second child ... } ]; Whenever I see another language inside Perl, I'm getting really nervous - another (possibly incomplete) definition, another (possibly buggy) parser ... ... Well, the original example is likely still Perl, but why a subroutine where plain hierarchical data structure should suffice ? Regards, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news |