I'm sorry if it's a dumb question but I couldn't find an answer.
import times
const current_year= $now().year
echo current_year
c:\nim\nim-2.2.4\lib\system\fatal.nim(53, 5) Error: unhandled exception: implemented in the vm [AssertionDefect]
I need to get the year during compilation for my project. Here's my current workaround:
when defined(windows):
const current_year = staticExec("powershell -command \"Get-Date -Format yyyy\"")
else:
const current_year = "2025"
But it doesn't look pretty. Also regular expressions don't seem to work during compile time. Is there something I can do about it? Maybe a compiler flag or something...
const current_year = CompileDate[0..3]
Thanks! It solves my problem.
I guess Nim's VM has its limitations.