[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GdkRectangle, again
- From: "Ross McFarland" <rwmcfa1 neces com>
- To: <gtk-perl-list gnome org>
- Subject: Re: GdkRectangle, again
- Date: Tue, 29 Apr 2003 09:54:51 -0400 (EDT)
it's nice to be able to set the members without having to call a function.you
would like to be able to $update_rect->{x} = 5; granted it's just as easy to
say $update_rect->x(5); but that's not what you'd first assume would be the
case. these are c structures that in a c app you directly manipulate. when in
perl that equates to a hash. and that would probably be people's first
assumption to what a GtkRectangle would/should be.
there's nothing keeping you from making it functions that operate on a hash so
that you could choose which way. use it as hash ($rect->{x}) or as a function
($rect->x)
-rm
> On 29 Apr 2003, Guillaume Cottenceau wrote:
>
>> "muppet" <scott asofyet org> writes:
>>
>> > old gtk-perl treated GdkRectangle as a 4-element list in perl. this
>> made it very easy to manipulate the contents of the rectangle in perl,
>> and i switched to this because dealing with a boxed type from perl via
>> member accessor functions is clumsy.
>>
>> I personally favored the orthogonality of methods in gtk2-perl,
>> and that's why we are (were?) using GdkRectangle like all other
>> Boxed types, with methods to access members. E.g.:
>>
>> $pixmap->draw_rectangle ($gc, TRUE,
>> $update_rect->x,
>> $update_rect->y,
>> $update_rect->width,
>> $update_rect->height);
>>
>> E.g. even more readable than hash ref thing. There's also
>> ->values so that you can do things like:
>>
>> my (undef, undef, $w, $h) = $update_rect->values;
>>
>>
>> Just my personal point of view, of course.
>>
>> --
>> Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/
>
> I think I have to vote this way as well. Besides it will look really silly
> in Perl 6 to say
>
> $pixmap->draw_rectangle (
> $gc,
> TRUE,
> $update_rect.{x},
> $update_rect.{y},
> $update_rect.{width},
> $update_rect.{height}
> );
>
> instead of
>
> $pixmap->draw_rectangle (
> $gc,
> TRUE,
> $update_rect.x,
> $update_rect.y,
> $update_rect.width,
> $update_rect.height
> );
>
> _______________________________________________
> gtk-perl-list mailing list
> gtk-perl-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-perl-list
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]