Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: [RFC] automatic property getters and setters: msg#00104

gnome.gtk+.perl

Subject: Re: [RFC] automatic property getters and setters

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>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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