On Tuesday, 6 October 2015 at 05:54:44 UTC, Jonathan M Davis
wrote:
It is by design, albeit undesirable. When SysTime was
originally written, it was impossible to have a default value
for a class reference other than null. So, unless SysTime was
going to take the performance hit of constantly checking
whether its TimeZone was null, SysTime.init was going to
segfault if you did anything with it that required its
TimeZone. And I wasn't about to have it constantly checking for
null. In the vast majority of cases, the value of a SysTime
comes from Clock.currTime() or from parsing a string, and if
code is trying to do anything but assign to a SysTime which is
SysTime.init, then that means that it failed to initialize it
like it should have.
Thanks for thorough explanation.
I found the problem using vibe and REST API with SysTime argument
with default value (which didn't work due to the bug there) when
I tried to print out the passed value and ended up with the
segfault. So I guess it doesn't bite devs often as it is mostly
used as you wrote.