|
|
Choosing A Webhost: |
Re: [RFC] automatic property getters and setters: msg#00104gnome.gtk+.perl
On Sat, 2004-06-12 at 15:23, muppet wrote: > > While toying around with param_test.pl, I found a small glitch in > > gperl_value_from_sv, though: it never checks if the sv is NULL or undef > > -- so returning undef from the custom GET_PROPERTY made it croak in > > gperl_get_object_check. The attached patch (hopefully) fixes that by > > returning FALSE if the sv is not ok. > > i had seen that, too, and meant to fix it but decided not to conflate > things. > > gperl_value_from_sv() and gperl_sv_from_value() should fail only by > croaking and should always return TRUE. this is something decided a > long, long time ago, but the signatures were never unchanged to avoid > breaking existing code. Ah, I didn't know about that. > and, rationalizing it to myself; g_value_init() sets a default value > (whatever 0 means to that type) that should correspond roughly to > whatever we would map undef to, so bailing out early should be fine, and > should not be an error because we did map the sv (undef) to a value. > > if (!sv || !SvOK(sv)) > return TRUE; > > now, is it really a good idea? there's an implicit behavior for most of > those types; enums will croak on undef (currently) telling you that you > sent an invalid value through. this change will silently skip that > warning. of course, that warning was often hard to track down... is > that alright? Yeah, I see your point. What about doing that check in the G_TYPE_OBJECT branch of the switch then? If we don't check the SV, gperl_get_object_check will always croak and returning undef from a subroutine that is supposed to return an object will not work. Bye, -Torsten
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Gnome2::VFS 1.001 (stable), Torsten Schoenfeld |
|---|---|
| Next by Date: | Re: default params for GtkTextView scoll_to_(mark|iter), Torsten Schoenfeld |
| Previous by Thread: | Re: [RFC] automatic property getters and setters, muppet |
| Next by Thread: | Glib 1.043 (stable), muppet |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |