From: Everett, T. <TEverett@ALASCOM.ATT.com> - 2002-09-06 19:25:14
|
-----Original Message----- From: Mattia Barbon [mailto:mb...@ds...] Sent: Friday, September 06, 2002 8:38 AM To: wxp...@li... Subject: [wxperl-users] Behaviour change for 0.15 > I'd like to deprecate that feature and have > Wx::Button->new( ... ) return a scalar reference, > while MyButton->new( ... ) will still return an > hash refernce; this will help saving some memory, > and is something that I wanted to do since some time, > but I always got more important things to do... *raises hand* This makes sense to me, but seeing as the other discussion going on at this moment is about SCALAR refs vs. HASH refs, might I posit a recommendation? What if there were AsHash and AsScalar calls? The two of them would be used to force a ref of a given type to the other type. Things would have defaults (as described in the rest of your stuff), but users could always do things like: my $b = Wx::Button->new( ... )->AsHash; $b->{foo} = 1; $b->{BAR} = 2; That would let people override the defaults on a per instance basis. I'm guessing there would be little use for the AsScalar call, but somebody might find it useful sometime:). The AsHash call would do all of your normal hash tracking stuff. Also, FindWindow might have alternate variants FindWindowAsHash and FindWindowAsScalar that would do the right thing without the additional overheard of building the object and converting it. Is this doable? Does it make any sense? It might reduce all these arguments between people who want things one way or the other. --Toby Everett |