Re: gtk2-perl / easily accessing objects properties

goran kirra net writes:


There is no semantic meaning in returning a value when doing a
set, neither the new nor the old value, in my opinion.


you have not been lisping enough :-)

Possibly - though I do use functional style programming a lot :).

I think, and that's the way it is implemented, 
that SET should return the previous value.
I might be useful and nice:

  # lock window size
  my $oldvalue = $win->resizable(0);
  .... (do stuff) ......

I don't discuss the fact that it may be useful, in order to do
what you showed (though this use might be 0.1% of the set
usages), I was pointing out that there is no *semantic* meaning
in returning a value.

and since you use:

$value = $win->resizable;

to GET it would be inconsistent not to return something
when you do a SET with the same function.

I don't agree with pretending it's a matter of consistency. There
is no such 'consistency' in returing something in set, because
set and get and opposite functions.

Don't get me wrong though. I don't vote against "set" returning a
value. I just think, first, it's illogical, second, there is no
definitive argument to choose whether it should return the old or
the new value.

Guillaume Cottenceau -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]