**static** and **assert**, right.
Unfortunately there are holes in the keys, so arrays are suitable for this
purpose.
Thanks guys!
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
> 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]
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
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
Live again
[https://nim-lang.org/docs/sexp.html](https://nim-lang.org/docs/sexp.html)
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
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
Thanks, fixed.
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
10 matches
Mail list logo