When I try to run the following example with "nim test.nims":
import json
var j = parseJson("{\"foo\": \"bar\"}")
I get:
Error: undeclared identifier: 'copyMem'
I think we need to introduce a copyRange[T] helper in system.nim that is aware of things like:
1) The VM and JavaScript need copying with regular for loops
2) Some user-defined types need to use a user-defined = operator
3) The rest of the cases are optimized to copyMem
Few of the existing generic containers in the standard library are using copyMem, which is not appropriate in the long-term.
lexbase uses alloc, not copyMem so copyRange[T] wouldn't solve anything.
Does it have to, though? It manages a char buffer. Why coudn't it use a seq[char] instead?
@narimiran This has been fixed in #10746 .
I have the same problem
@unihernandez22 can you elaborate?
@unihernandez22 can you elaborate?
When I do import json in a NimScript file, I get the same error
/usr/lib/nim/pure/streams.nim(276, 9) Error: undeclared identifier: 'copyMem'
@unihernandez22 what's your Nim version?
@unihernandez22 what's your Nim version?
Nim Compiler Version 1.2.4 [Linux: amd64]
Compiled at 2020-07-16
Copyright (c) 2006-2020 by Andreas Rumpf
Most helpful comment
I think we need to introduce a
copyRange[T]helper insystem.nimthat is aware of things like:1) The VM and JavaScript need copying with regular for loops
2) Some user-defined types need to use a user-defined
=operator3) The rest of the cases are optimized to
copyMemFew of the existing generic containers in the standard library are using
copyMem, which is not appropriate in the long-term.