Exponential operator

Simen Kjaeraas simen.kjaras at gmail.com
Sat Aug 8 01:22:39 PDT 2009


On Fri, 07 Aug 2009 18:57:12 +0200, Michel Fortin  
<michel.fortin at michelf.com> wrote:

> On 2009-08-07 12:33:09 -0400, Miles <_______ at _______.____> said:
>
>> Lars T. Kyllingstad wrote:
>>> Neither of the natural candidates, a^b and a**b, are an option, as they
>>> are, respectively, already taken and ambiguous.
>>  I think that a ** b can be used, is not ambiguous except for the
>> tokenizer of the language. It is the same difference you have with:
>>    a ++ b  -> identifier 'a', unary operator '++', identifier 'b' (not
>> parseable)
>>    a + + b  -> identifier 'a', binary operator '+', unary operator '+',
>> identifier 'b' (parseable)
>
> But to be coherent with a++ which does a+1, shouldn't a** mean a to the  
> power 1 ?

No. As we can see, ++ is the concatenation of two addition operators, so
the equivalent for exponential would be a****, a^^^^, or a*^*^. :p

-- 
   Simen



More information about the Digitalmars-d mailing list