More on semantics of opPow: return type

Don nospam at nospam.com
Mon Dec 7 22:01:08 PST 2009


Lionello Lunesu wrote:
> On 8-12-2009 1:43, Andrei Alexandrescu wrote:
>> Nice analysis. IMHO this should lead us to reconsider the necessity of
>> "^^" in the first place. It seems to be adding too little real value
>> compared to the complexity of defining it.
> 
> No, Don's just being awefully thorough. If you'd revisit all existing
> operators with the same thoroughness you would probably give up the
> whole idea of writing a language. Apart from the int/int division
> there's the int<<int, "What if I shift more than 31?" "What if I shift
> with <0?" and of course int+int "What to do on overflow?" etc..
> 
> I think ^^ can be made to work just fine. Let's not get carried away
> trying to make it perfect.
> 
> L.
Exactly. The fallback case is to just make int^^int an int.
It's only because I was looking at the range propagation stuff inside 
the compiler, that I got the idea that we could better than that. But, 
as Andrei says, maybe it's just not worth any more thought at this stage.



More information about the Digitalmars-d mailing list