Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: undeclared identifier: 'shallowCopy'`` on all examples #50

Open
general-rishkin opened this issue Jan 24, 2023 · 5 comments
Open

Comments

@general-rishkin
Copy link

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 .

@andreaferretti
Copy link
Owner

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

@NahuelUTNPigui
Copy link

NahuelUTNPigui commented May 17, 2024

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

@Vectornaut
Copy link

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.

@andreaferretti
Copy link
Owner

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.

@Vectornaut
Copy link

Vectornaut commented Jul 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants