neo
neo copied to clipboard
Error: undeclared identifier: 'shallowCopy'`` on all examples
All the examples I try give the following error:
neo/dense.nim(90, 14) Error: undeclared identifier: 'shallowCopy'
I am using Nim Compiler Version 1.9.1 .
See this PR. The issue is: shallowCopy
was kind of needed to have matrices that share storage (think of taking a row, or the transpose of a matrix, without making copies). So I have not accepted the PR yet.
I can probably work arund this with the shallow pragma, but it would take a while... I am no actively using Nim right now, so this kind of language level change is rather disruptive. If you want to start from that PR and ensure that copies are actually shallow, I would be happy to accept it
As someone who has the same problem, an easy solucion is write --gc:refc as option, something like nim c --gc:refc -r main.nim PD: you can use this command nim c --mm:refc -r main.nim too
How feasible would it be for a Nim newcomer to implement the shallow
pragma workaround? I'm hoping to use Nim for a WebAssembly project, which doesn't seem compatible with --gc:refc
.
It would amount to marking data
as shallow in places like here and here, and similarly in cudadense
etc, then removing shallowCopy
where it appears, running tests and checking what breaks. When something breaks, it will be probably because there was an implicit copy of data
somewhere; in thit case, make the copy explicit.
Test coverage is good enough that I think if tests pass, everything is fine.
Thanks so much! That doesn't sound as difficult as I'd feared. If we end up considering Nim seriously enough to put some work into this issue, I'll let you know.