September 21, 2001 Operator | ||||
---|---|---|---|---|
| ||||
> For that matter, ** won't work because the is already an infix and binary * operator.
>
> x ** y => x * (*y)
>
> I agree with the idea though. I like perl because of it's liberal use of infix and unary operations. I like C++ because it let me do the same, but it would be nice to have more operator symbol at my disposal, and to be and to mess with precedence. Since before first grade we are taught infix operations. They feel much more natural for anything remotely numeric.
>
> Dan
I continue hier the speach.
Java creator don't like operator overloading , so it wasn't implement inside Java. It the same for D.
But what about creating "new" operator to avoid very heavy notation in scientific calculation for exemple ?
The key word "operator" from the c++ could be used. It's a 2 input operator. We can imagine .* for matrix computation (like in mathlab ?).
It will be nice to define mathemical propertites like :
- if a op b = b op a
- if (a op b) op c = a op (b op c)
- if a op1 (b op2 c) = (a op1 b) op2 (a op1 c) -- imagine op1=* and
op2=+
- if a nul object (e) exist a op e = e op a = a
- Operator priority : a op1 b op2 c = a op1 ( b op2 c) or a op1 b op2 c
= (a op1 b) op2 c
So we can make some "extend" to the language without destoying the coherence of D.
nicO
|
Copyright © 1999-2021 by the D Language Foundation