Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
September 09, 2020 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P1 CC| |ibuclaw@gdcproject.org --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> --- Bumping priority of this one. -- |
July 09, 2021 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl --- Comment #2 from Dennis <dkorpel@live.nl> --- > The compiler's evaluation seems to occur in the wrong order ("versions before static ifs" instead of "top to bottom") This 'evaluation order' is totally underspecified and super tricky. Simply going top to bottom doesn't work since a static if can have forward references: ``` static if (x == 0) { version = X1; } version(X1) { } enum x = 0; ``` Even trickier: ``` static if (x == 0) { version = X1; } version(X1) { version = X2; } version(X2) { enum x = 0; } ``` -- |
July 12, 2021 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 anonymous4 <dfj1esp02@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rejects-valid |spec Severity|major |enhancement --- Comment #3 from anonymous4 <dfj1esp02@sneakemail.com> --- It feels like version is a lightweight feature and is processed early as it doesn't depend much on semantics of the surrounding code, while static if tends to be processed on later stages as it needs module that passed most semantic checks. As a workaround the original example can simply use static if everywhere; static if can inspect versions too: see issue 7417 -- |
July 12, 2021 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 anonymous4 <dfj1esp02@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor -- |
April 11, 2022 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 KytoDragon <kytodragon@e.mail.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kytodragon@e.mail.de --- Comment #4 from KytoDragon <kytodragon@e.mail.de> --- (In reply to anonymous4 from comment #3) > It feels like version is a lightweight feature and is processed early as it > doesn't depend much on semantics of the surrounding code, while static if > tends to be processed on later stages as it needs module that passed most > semantic checks. > As a workaround the original example can simply use static if everywhere; > static if can inspect versions too: see issue 7417 There are few bugs related to static if (see https://issues.dlang.org/show_bug.cgi?id=20905), so replacing all versions with static if is not currently possible. -- |
April 11, 2022 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 --- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> --- Potentially very breaking, but declaring versions could be even more restrictive than it currently is. i.e: When setting a version in a function or user defined type, you expect a compile-time error. Error: version `Foo` declaration must be at module level This could be extended to `static if` as well so that we avoid all these nasty cases of will it, won't it work. Also noting that it's currently an error to declare a version inside a `static foreach`. --- static foreach (_; 0 .. 5) { version = Foo; // Error: version `Foo` declaration must be at module level } --- So why is `static if` different here? -- |
December 17, 2022 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 7386] Can't use a 'version' that was set inside 'static if' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7386 --- Comment #6 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18407 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation