octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51605] operands ++ and -- via function


From: Ernst Reissner
Subject: [Octave-bug-tracker] [bug #51605] operands ++ and -- via function
Date: Mon, 7 Aug 2017 04:55:11 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0

Follow-up Comment #6, bug #51605 (project octave):

@John 
maybe I do not understand correctly. 

Example: I have a class pn (polymorphic numbers) 
whatever it is, it comprises double numbers. 

I can write 
   a  = pn(4);
   a += pn(3);
and then a is 7 (as pn-number)

I just overwrote plus(a,b) 
which overwrites not only + as in matlab, but also +=. 
So far so good. 
It is, as you say, syntactic sugar, 
i.e. a+=b is short for a = a + b. 
Thus I think it is mandatory, 
that plus overwrites not only + but also +=. 

Now i think, that ++a is just short for a+=1. 
Consequently, i think plus shall affect also ++a operator. 
The result should be something like 
a+=1, where 1 must be the one-element in the class. 
I think ++a should be short for a+=pn(1), 
if a has type pn, 
i.e. it should be short for a = plus(a,pn(1)). 
To use ++, pn(1) must be defined of course. 



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51605>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]