Re: operator overloading
- From: Christian Borup <borup borup com>
- To: Gtk+ Perl <gtk-perl-list gnome org>
- Subject: Re: operator overloading
- Date: 28 Apr 2003 20:30:40 +0200
On man, 2003-04-28 at 18:36, muppet wrote:
is there anybody on the list who is familiar with perl's operator overloading
interface?
i tried adding
package G::Object;
use overload '==' => \&G::Object::eq;
to G.pm[1], so that we could use a natural syntax for comparing object
instances. (you can't just compare the scalars, because they are always
different; you need to compare the juicy blessed reference value centers
inside.)
You need to add fallback => 1, so you'd get.
use overload '==' => \&G::Object::eq, fallback => 1;
This statement should work (that being said - overloading can be
somewhat strange).
Without fallback overload assumes that you have defined all applicable
operators.
./borup
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]