Did you import from another file? I tested on three machines with the following settings, all showing `undeclared identifier: 'tables'`.
Here the codes, two files or clone `git clone https://github.com/jackhftang/lrucache.nim.git -b minimal_rightsize_test` # lrucache.nim import lists import tables type # no need to use ref, since DoublyLinkedNode is already a ref Node[K,T] = object key: K val: T LruCache*[K, T] = ref object capacity: int list: DoublyLinkedList[Node[K,T]] table: Table[K, DoublyLinkedNode[Node[K,T]]] template rightSize(cap): untyped {.dirty.} = when (NimMajor,NimMinor)<(1,4): tables.rightSize(cap) else: cap proc newLruCache*[K,T](capacity: int): LruCache[K,T] = ## Create a new Least-Recently-Used (LRU) cache that store the last `capacity`-accessed items. LruCache[K,T]( capacity: capacity, list: initDoublyLinkedList[Node[K,T]](), table: initTable[K, DoublyLinkedNode[Node[K,T]]]( rightSize(capacity) ) ) Run # test.nim import lrucache let c = newLruCache[int,int](10) Run run with `nim c -r test.nim` I do not know why tables is not defined, also I cannot see what wrong I did in the code. Let me know If you still cannot reproduce it. I don't think my nim setup has anything special. tested on * windows nim-1.2.0 installed from tarball * linux: choosnim 1.2.6 * linux: choosnim 1.2.4 * linux: choosnim 1.0.0 * osx: choosnim 1.2.6 * osx: choosnim 1.0.0
