views:

24

answers:

2

Hello, everyone!

I'm talking about operators which not return a value but modify (overwrite) the first operand.

Example in pseudo-code:

      add  :=  return op1 + op2
increment  :=  op1 = op1 + op2

Given this mapping schema:

add -> increment
subtract -> decrement

What could possibly be the names for other operators?

multiply, divide, power, ... (what else?)

I was thinking about add->selfAdd, multiply->selfMultiply, but these names are somehow stupid.

NOTE: What's all this for? It's for an experimental programming language. Because of certain circumstances there may be only words, no operator signs, so I can't use ++ for increment or *= for selfMultiply.

+1  A: 

I've usually heard *= and += referred to as "multiply-assign" and "add-assign".

Dan Story
This naming is more understandable than my proposal with addSelf. But sadly it's even longer to type.
java.is.for.desktop
Since no one seems to come up with a better idea, I'll mark this as correct answer ;)
java.is.for.desktop
A: 

I believe you are describing the differences between unary and binary operators/operations.

Neil N
Not quite. Think of negation: it could be done as unary operator: `negate(someNumber)` (takes one operand) and as a zero-nary operator: `someNumber.negate()` (takes no operands).
java.is.for.desktop