proposed syntax change

Don nospam at nospam.com
Fri Aug 7 01:38:19 PDT 2009


Lars T. Kyllingstad wrote:
> Daniel Keep wrote:
>>
>> Lars T. Kyllingstad wrote:
>>> Don wrote:
>>>> The operator which is REALLY missing is exponentiation.
>>>
>>> I've been really missing that one.
>>>
>>> Which operators could be used for exponentiation? I've only ever seen
>>> a**b and a^b used, but I think those are out of the question for D.
>>>
>>> -Lars
>>
>> How about *^
>>
>> ^ isn't valid as a unary operator, thus a*^b cannot be mistaken for 
>> a*(^b)
>>
>> It's a bit of a cop-out combining the two, but should be unambiguous.
> 
> Yeah, not too bad. Would a^^b work?
> 
> -Lars

Yes. I think it's the best option.
Note that we already have the table:
bitwise logical
&        &&
|        ||
^        !=
so there's nothing else you'd want to use ^^ for.
People would get used to it pretty quickly. I think it looks better than 
Fortran's **, actually.  double y = x^^2;



More information about the Digitalmars-d mailing list