flyx / NimYAML

YAML implementation for Nim
https://nimyaml.org
Other
186 stars 36 forks source link

Your example code does not compile with recent Nim #97

Closed StefanSalewski closed 3 years ago

StefanSalewski commented 3 years ago
import yaml.serialization, streams
type Person = object
  name : string
  age  : int32

var personList = newSeq[Person]()
personList.add(Person(name: "Karl Koch", age: 23))
personList.add(Person(name: "Peter Pan", age: 12))

var s = newFileStream("out.yaml", fmWrite)
dump(personList, s)
s.close()
nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-04-13
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 8e6b87a917a5d09a70d1e29f0b06915c29fcac6b
active boot switches: -d:release

nim c --gc:arc t1.nim 
Hint: used config file '/home/salewski/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/salewski/Nim/config/config.nims' [Conf]
....
/home/salewski/yamltest/t1.nim(1, 12) Warning: using '.' instead of '/' in import paths is deprecated [Deprecated]
........................
/home/salewski/.nimble/pkgs/yaml-0.14.0/yaml/private/lex.nim(1177, 8) Error: cannot bind another ':anonymous' to: YamlLexerObj; previous declaration was here: /home/salewski/.nimble/pkgs/yaml-0.14.0/yaml/private/lex.nim(1154, 8)
salewski@nuc ~/yamltest $ nim c t1.nim 
Hint: used config file '/home/salewski/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/salewski/Nim/config/config.nims' [Conf]
....
/home/salewski/yamltest/t1.nim(1, 12) Warning: using '.' instead of '/' in import paths is deprecated [Deprecated]
............................
/home/salewski/.nimble/pkgs/yaml-0.14.0/yaml/serialization.nim(407, 18) Error: attempting to call undeclared routine: 'getGMTime'
flyx commented 3 years ago

Please try with recent head (nimble install yaml@#head), I have done a large rewrite since 0.14.0 that did not make it into a release yet.

StefanSalewski commented 3 years ago

Thank you very much for that hint. Indeed I considered that myself, but then looked at the open issues and the whole state of the project and got the feeling that there is not much activity any more, so unfortunately I did not really tried that.

flyx commented 3 years ago

Indeed the project is pretty stagnant. I did want to push a release after ensuring ARC/ORC work properly and hoped to get some feedback in the relevant issues, but since none came, I forgot about it.

Since the current release does not work with the current Nim version, this is now a far more severe problem and I'll try to do a release soon™.

flyx commented 3 years ago

I just released v0.15.0 which solves this problem.