Can I run this at compile time?

Marc jckj33 at gmail.com
Wed Dec 20 17:27:33 UTC 2017


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.


More information about the Digitalmars-d-learn mailing list