[Issue 14018] Treat CTFE-able functions as pure in CTFE-only contexts

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 20 12:56:35 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14018

--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
Personally I'm against this language change as IMO:
* it creates a very strange exceptional rule in type system
* and I don't see much profit from it in real coding.

Here is an example of introduced language complication:
---
int[] f(int i) { return new int[1]; }

mixin template T()
{
    immutable s = f(0); // OK or error? Depends on context.
}

mixin T; // OK here

void main()
{
    mixin T; // error here
}
---


Note:
This issue is created as a result of Issue 7492 discussion.

P.S.
My general position is to not complicate the language without valuable profit
in real projects even in cases of much smaller and non-exceptional rules.

--


More information about the Digitalmars-d-bugs mailing list