4 ms·
Thanks. I'm sure there's a way to promote a compile time seq into a constant runtime one. Might require some more macro trickery, though.
by beagle3 12y ago
Thanks. I'm sure there's a way to promote a compile time seq into a constant runtime one. Might require some more macro trickery, though.
- filwit 12y agoErr... what you said just reminded me of something, and I realized all the code I just showed you is really over-complicated and that Nim has much more straight forward options using `const`, like this: static: # define a compile-time list first var names = newSeq[string]() # add some values (at compile-time) names.add("foo") names.add("bar") # define the compiler vars as run-time const const runtimeNames = names # define some run-time variables var name1 = "foo" var name2 = "blah" # check runtime variables against const variable if runtimeNames.contains(name1): echo "Has Foo!" if runtimeNames.contains(name2): echo "Has Blah!" Sorry about the rather winded (and bad example) replys :| But thanks for the conversation, it reminded me of this and now I have some cleaning up of my own code to get too. Cheers!