Semantics of ^^, Version 3 (Final?)

Don nospam at nospam.com
Wed Dec 9 04:34:23 PST 2009


Rainer Deyke wrote:
> Don wrote:
>> f() ^^ f() is not a constant expression. It won't get transformed. It
>> can be *interpreted* at compile time, but that'll generate an error.
> 
> That's a very fine distinction. 

Yes. This is a very narrow special case. Bill Baxter and others have 
argued that it is such an important one, that it needs to be allowed. 
But it's surrounded by nasty stuff which definitely must not be allowed.

  One that may not survive future
> evolution of the D language, and may not respected by other
> implementations of the D language. 

I think you're confusing 'pure' with 'constant expression'. They are not 
the same thing.

To repeat what I said in the previous post:
f() is *not* a compile-time constant. Never. But you can use it to make one.

  (I /should/ be removed.  Having
> different rules for operators and functions unnecessarily complicates
> the language.) 

Do you mean the fact that constant folding always happens for operators, 
but that CTFE doesn't happen automatically?

  Code that depends on this distinction is highly fragile.
>  It should not be possible to write code that depends on this distinction.

How can you write code that depends on this distinction?



More information about the Digitalmars-d mailing list