Thread overview
Can I run this at compile time?
Dec 20
Marc
Dec 20
Mengu
Dec 20
Marc
December 20
Give this function I'd like to run it at compile time:

	import std.concurrency : Generator, yield;
>	Generator!string getNonIntegralMembers() {
>		return new Generator!string({
>			enum allMembers = __traits(derivedMembers, C);
>			foreach(enum string member; allMembers) {
>				bool isInteg = __traits(isIntegral, >__traits(getMember, C, member));
>				if(!isInteg) {
>					yield(member);
>				}
>			}
>		});
>	}

but when I do:

> enum string[] members = getNonIntegralMembers();
> writeln(members);

I get the following erros:

C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\thread.d(4059): Error: static variable PAGESIZE cannot be read at compile time
C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(1548):   
     called from here: super.this(dg, PAGESIZE * 4u, PAGESIZE)
app.d(96):        called from here: getNonIntegralMembers()

December 20
On Wednesday, 20 December 2017 at 16:54:35 UTC, Marc wrote:
> Give this function I'd like to run it at compile time:
>
> 	import std.concurrency : Generator, yield;
>>[...]
>
> but when I do:
>
>> [...]
>
> I get the following erros:
>
> C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\thread.d(4059): Error: static variable PAGESIZE cannot be read at compile time
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(1548):
>      called from here: super.this(dg, PAGESIZE * 4u, PAGESIZE)
> app.d(96):        called from here: getNonIntegralMembers()

if PAGESIZE is not dynamic, it will not work at compile time. make it an enum or const and give it a try.
December 20
On Wednesday, 20 December 2017 at 17:16:50 UTC, Mengu wrote:
> On Wednesday, 20 December 2017 at 16:54:35 UTC, Marc wrote:
>> Give this function I'd like to run it at compile time:
>>
>> 	import std.concurrency : Generator, yield;
>>>[...]
>>
>> but when I do:
>>
>>> [...]
>>
>> I get the following erros:
>>
>> C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\thread.d(4059): Error: static variable PAGESIZE cannot be read at compile time
>> C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(1548):
>>      called from here: super.this(dg, PAGESIZE * 4u, PAGESIZE)
>> app.d(96):        called from here: getNonIntegralMembers()
>
> if PAGESIZE is not dynamic, it will not work at compile time. make it an enum or const and give it a try.

the problem is, PAGESIZE part of D's library so I can't change it. I'm looking for a way to make Generators work at runtime actually. Or a replacement for it.