Re: Compile time table keys checking?

2017-10-16 Thread matkuki
**static** and **assert**, right. Unfortunately there are holes in the keys, so arrays are suitable for this purpose. Thanks guys!

Re: Compile time table keys checking?

2017-10-16 Thread Stefan_Salewski
Of course, when your keys are integers without holes you can and should use a plain array or seq. For the check at compile time, maybe something like static: assert(myTable(33)) != nil # or assert(myTable.hasKey(33)) Or maybe compileTime pragma -- can not remember the

Re: Compile time table keys checking?

2017-10-16 Thread Libman
> Is it possible to get an compile-time error in the last line? If that line is executed at compile-time, like in a static block: import tables const myTable = { 1: 14.cint, 2: 23.cint, 3: 4.cint }.toTable() static: echo myTable[33]

Re: Compile time table keys checking?

2017-10-16 Thread jester
If you write the following you'll get a compile-time error: const a = myTable[33] echo a This isn't terribly convenient. Marginally more so is: template try_const(expression:typed):auto = ## Evaluate an expression at compile-time if possible. when

Compile time table keys checking?

2017-10-16 Thread matkuki
Hi guys, I have a const table which I want to know if all of the values, referenced in the code exist at compile time. Example: const myTable = { 1: 14.cint, 2: 23.cint 3: 4.cint, }.toTable() echo myTable[33] # <-- Can I get a compile time error

Re: What happened to sexp?

2017-10-16 Thread Arrrrrrrrr
Live again [https://nim-lang.org/docs/sexp.html](https://nim-lang.org/docs/sexp.html)

Re:

2017-10-16 Thread Krux02
Vulkan introduced the _Standard Portable Immediate Representation_ (SPIR-V). You can imagine this as some sort of assembler instructions that will be compiled and optimized to the final GPU instructions from the GPU vendor driver. SPIR-V is through extensions and the latest core version also

Re: Nim "concepts": confusing?

2017-10-16 Thread Araq
As far as I can tell this is a bad error message but `MyGraph.Node` is not valid. The tests contain import math type Node* = concept n `==`(n, n) is bool Graph1* = concept g type N = Node distance(g, N, N) is float

Re: The "sexp" link in the Nim Standard Library returns a "404"

2017-10-16 Thread Araq
Thanks, fixed.

Re: "the upcoming OpenCL target"

2017-10-16 Thread mratsim
Actually in the top comment of that article it says that the article author had a misundertanding. What will potentially be merged is the intermediate representation SPIR-V, not the languages on top. I did find something called ["Vulkan