Segfault when using SysTime
Jonathan M Davis
jmdavisProg at gmx.com
Fri Nov 4 10:27:58 PDT 2011
On Friday, November 04, 2011 06:07 bearophile wrote:
> Jonathan M Davis:
> > and since CTFE can't handle classes - let alone one which is
> > initialized at compile time and then used at runtime
>
> I think CTFE will handle classes in the next DMD version (and in the
> current GitHub one).
But it's not just a question of handling classes. It has to handle the case
where the class persists during runtime. From what Don has said in the past,
I'm pretty sure that supporting classes in CTFE is going to translate to being
able to use functions that use classes but that none of the classes created
will be able to be assigned to any variables which persist beyond compilation.
It needs to become possible to do something like
static immutable _localTime = new immutable(LocalTime)();
For SysTime.init to be valid, LocalTime's instance must be created at compile
time and persist beyond compilation, and then SysTime's _timezone member
variable needs to be initialized to it - which would also persist beyond
compilation.
If Don manages to make that work, that's fantastic, but there's a definite
difference between being able to use classes with CTFE and initialize member
and static variables with classes using CTFE, and it is my understanding that
that we're only getting to use classes in CTFE, not persist them. But maybe
we're lucky, and I'm wrong about that.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list