Why CTFE is context-sensitive?

Pierre Talbot ptalbot**mustberemoved** at hyc.**thistoo**io
Tue Jan 28 13:20:30 PST 2014


On Monday, 27 January 2014 at 21:12:30 UTC, deadalnix wrote:
> On Monday, 27 January 2014 at 18:30:43 UTC, Pierre Talbot wrote:
>> On Monday, 27 January 2014 at 04:07:04 UTC, Andrei 
>> Alexandrescu wrote:
>>> On 1/26/14 3:22 AM, Pierre Talbot wrote:
>>>> Hi,
>>>>
>>>> I was wondering why CTFE is context sensitive, why don't we 
>>>> check
>>>> every expressions and run the CTFE if it applies?
>>>
>>> Compilation would get awfully slow (and sometimes won't 
>>> terminate).
>>>
>>> Andrei
>>
>> So it is theoretically possible? I mean if the compilation 
>> doesn't terminate, the execution won't either for at least one 
>> program input, so we can detect an infinite loop at 
>> compile-time. Moreover, isn't the same problem with 
>> context-sensitive CTFE?
>>
>> Pierre
>
> lolwut ? How do you make the difference between a program that 
> won't terminate ever and one that will terminate eventually 
> (say, in several years) ?

With resource bounds (such as memory, time or number of 
operations) but from what others said I understand now that it's 
a bad idea. Moreover, I just thought there were programs designed 
to not terminate (for example server).
Thanks to all.


More information about the Digitalmars-d mailing list