Created
April 20, 2017 11:23
-
-
Save mratsim/6df3846b88346877d3f8fb60ecdd579b to your computer and use it in GitHub Desktop.
Type checking a "Context" with Nim compiler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Context*[T] = ref object | |
nodes: seq[T] | |
Variable*[T; C: static[Context[T]]] = object | |
tape: Context[T] | |
index: int | |
value: T | |
proc newContext*[T]: Context[T] {.noSideEffect.} = | |
new result | |
result.nodes = newSeq[T]() | |
let a = newContext[float32]() | |
let b = newContext[float32]() | |
echo a == b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment