Semantics of ^^, Version 3 (Final?)

Don nospam at nospam.com
Wed Dec 9 01:59:13 PST 2009


Rainer Deyke wrote:
> Lars T. Kyllingstad wrote:
>> Rainer Deyke wrote:
>>> I don't care if x^^y with y < 0 is 0, a runtime error, or even undefined
>>> behavior.  However, having different behavior if x is a compile-time
>>> constant than if x is a variable is unacceptable because it silently
>>> changes the (defined) behavior of a function when a runtime parameter is
>>> changed to a template parameter or vice versa, or even when the compiler
>>> becomes a bit more clever about CTFE.
>> I don't think it's a problem: Either it works as expected, or it causes
>> a compile-time error.
> 
> Not quite.  Under the proposal, -1^^-1 works (i.e. produces the correct
> result) at compile time but fails at runtime.
> 
No. That's why I wrote it as a transformation rule. CTFE is not 
permitted to perform transformations, it can only evaluate.



More information about the Digitalmars-d mailing list