mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
21 lines
425 B
Nim
21 lines
425 B
Nim
|
|
type
|
|
TDict[TK, TV] = object
|
|
k: TK
|
|
v: TV
|
|
PDict[TK, TV] = ref TDict[TK, TV]
|
|
|
|
proc fakeNew[T](x: var ref T, destroy: proc (a: ref T) {.nimcall.}) =
|
|
nil
|
|
|
|
proc destroyDict[TK, TV](a: PDict[TK, TV]) =
|
|
return
|
|
proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
|
|
Fakenew(result, destroyDict[TK, TV])
|
|
|
|
# Problem: destroyDict is not instantiated when newDict is instantiated!
|
|
|
|
discard newDict("a", "b")
|
|
|
|
|