Semistatic by itself doesn't work at all. I tried to use this technique but that failed with "Error: type expected". What I'd like to do is create a function that, if given a string literal, can parse it at compile time to ensure that it's in the proper form, and if given a variable of type string will parse it at runtime and throw the error then. Is there another way to do this, perhaps with macros/templates?
The code that caused the "type expected" error:
proc semver(s: static[string]{lit}): SemanticVersion = # error on this line, col 15
if s.isSematic():
discard "yada yada"
else:
error("String " & s & " could not be parsed to a semantic version")