Thoughts about "Compile-time types" talk

NaN divide at by.zero
Thu May 16 08:12:49 UTC 2019


On Wednesday, 15 May 2019 at 18:57:02 UTC, Alex wrote:
> On Wednesday, 15 May 2019 at 18:31:57 UTC, NaN wrote:
>> On Tuesday, 14 May 2019 at 17:44:17 UTC, H. S. Teoh wrote:
>>> On Mon, May 13, 2019 at 08:35:39AM +0000, Martin Tschierschke 
>>> via Digitalmars-d wrote:

>> If you envisage a regular if statement being able to be both 
>> CT/RT depending on whether the value inside its brackets is 
>> known at CT or not what do you do about whether it introduces 
>> a new scope or not? Static if does not, but regular if does, 
>> if you want them unified something has to give.
>
> That is not true.
>
> Any type is either known at "CT" or not. If it is not then it 
> can't be simplified. If it is known then it can. A compiler 
> just simplifies everything it can at CT and then runs the 
> program to do the rest of the simplification.

You're conflating how it is implemented with the semantics of the 
actual language. I understand how static if works, what im saying 
is if you want to just have "if" and for the compiler to infer 
whether it's CT or RT, then you have the same construct with 
different semantics depending on the context.




More information about the Digitalmars-d mailing list