Exponential operator

Don nospam at nospam.com
Tue Aug 11 00:07:23 PDT 2009


Miles wrote:
> Don wrote:
>> You didn't respond to my assertion: even if you _could_ do it, why would
>> you want to? ** sucks as an exponential operator. I dispute the
>> contention that ** is a natural choice. It comes from the same language
>> that brought you  IF X .NE. 2
> 
> There are too many languages that support ** as an exponentiation
> operator, that is the reason ** is a likely candidate. Your reasoning
> seemed to be:
> 
> - Fortran is bad;
> - Fortran had ** as its exponentiation operator;
> - So, ** is bad as an exponentiation operator.

Not at all! I'm attacking the fallacy that "** must be a good choice 
because so many languages use it".

* The ONLY reason other languages use ** is because Fortran used it.
* Fortran used ** because it had no choice, not because it was believed 
to be good.
* We have choices that Fortran did not have. The best choice for Fortran 
is not necessarily the best choice for D.

Note that there are no C-family languages which use ** for 
exponentiation, so there isn't really a precedent.

However, the syntax is really not the issue. The issue is, is there 
sufficient need for a power operator (of any syntax)?


> I don't care for ** or .NE., really. I don't like * as a multiplication
> operator, in fact. I'd rather have × as multiplication, ↑ as
> exponentiation, ∧ as logical and, ∨ as logical or, ¬ as a logical not, =
> as equality, ≠ as inequality and ← as assignment.
> 
> I don't know why, but every time I say this, it brings all sorts of
> controversies and euphoric reactions.
Lack of keyboards.



More information about the Digitalmars-d mailing list