Re: Questioning non-NULL boxed types
- From: Joshua N Pritikin <vishnu pobox com>
- To: Tim Janik <timj gtk org>
- Cc: gtk-devel-list gnome org
- Subject: Re: Questioning non-NULL boxed types
- Date: Tue, 14 Aug 2001 23:54:48 +0530
On Tue, Aug 14, 2001 at 11:07:14AM +0200, Tim Janik wrote:
> this behaviour was implemented for GString and GValueArray mostly as a test
> case for value initializers. i'm now questioning whether we want to keep
> that behaviour, the drawbacks/pros i see are:
>
> - not allowing NULL is slightly inefficient in setups like:
> g_value_init (&value, G_TYPE_GSTRING);
> g_value_set_boxed (&value, my_gstring);
> since an intermediate 0-length GString is created at g_value_init() time
> - for languages that suppot NULL strings/arrays etc, this behaviour implies
> information loss, since a NULL GString != 0length GString, same for
> GValueArray
> + LBs that can't handle NULL strings or arrays don't need to put additional
> logic into their glue code
> + LBs that can't handle NULL strings or arrays don't loose information over
> the C API if NULL is not a representable string/array in GValue
i'm not involved with the perl-gtk interface, but i have plenty of experience
interfacing perl with C libraries. The main thing that i want when looking
at an API is detailed control, which should turn into efficiency. i don't
care much about the complexity of the API (within reason! PerlQt pushes
the limits ;-). i expect torture, because i know that my job is to hide
the messy details.
i vote for maximum efficiency. $0.02 (i'm not doing the implementation
so discount by opinion appropriately. ;-)
> of course this all assumes that there are LBs out there that have problems
> representing NULL strings/arrays, so reports thereof would help in making
> the final decision over this, e.g. perl wouldn't be an issue as it could
> map things as:
>
> my $mystring = "n-length string";
> my $mystring = ""; # 0-length string
> undef $mystring; # NULL-string
>
> i'm not so sure about arrays (i'm pretty perl illiterate ;)
Perl doesn't have NULL arrays, but i bet undef can work for NULL arrays just
as well as scalars. Perl is very flexible with types.
--
Get self-realization at <http://sahajayoga.org> ... <http://why-compete.org> ?
Victory to the Divine Mother!!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]