It there a way to get this to compile?
Ali Çehreli
acehreli at yahoo.com
Mon Sep 9 20:59:06 UTC 2019
On 09/09/2019 12:08 PM, WhatMeWorry wrote:
> Is this even possible?
No because there can't be expressions at module scope.
> static if(true)
> {
> int r = 2;
> int c = 40;
Those are fine.
> static foreach(i ; foundations)
> {
> immutable string brackets = "\033[" ~ to!string(r) ~ ";" ~
> to!string(c) ~ "H";
That's fine as well.
> c = c + 10; // line 155
That expression cannot appear at module scope. (In case it's not clear,
'static if' and 'static foreach' disappear after a stage of compilation
and their contents are left behind at module scope.)
Ali
More information about the Digitalmars-d-learn
mailing list