[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: inherted overload & mixed type operations



On Mon, Jan 10, 2000 at 09:51:09PM +0100, Marc Lehmann wrote:
> > > Well, other languages do not share this problem, since they do not
> > > overload based on one of the operands chosen randomly.
> > 
> > Which "other languages" do you have in mind here?  
> 
> _No_ other language chooses overloaded functions randomly like perl ;*)

So does not Perl.

> But to be more helpful: C++ (for example) lets you overload based on both
> types.

Only if *you* know all the types in advance.  Which you can do in Perl
as well: put the logic for recognizing that the second argument is
PDL::Complex into PDL::overloaded_multiply.

> > If i() returns an overloaded object, the *-method for this object will
> > be called.
> 
> No.

???

> > If you can demonstrate otherwise, it is a bug.
> 
> See my last mail. I am also looking for a more simple testcase, but it is
> difficult to find (and seems to require a few function calls). That the
> problem goes away after first usage might indicate some caching bug. For
> example:
> 
> =============================================================================
> use PDL;
> use PDL::Complex;
> 
> $sin = (i) * (zeroes(50)->xlinvals(2,4)) + 5;
> =============================================================================
> 
> dies with an error message, since PDL's * is being called, while:

Recompile Perl with -DDEBUGGING, and run with -Do option.

Ilya


Follow-Ups from:
Marc Lehmann <marc@gimp.org>
References to:
Marc Lehmann <marc@gimp.org>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Marc Lehmann <marc@gimp.org>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Marc Lehmann <marc@gimp.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]