elcritch / cdecl

Nim helper for using C Macros
10 stars 0 forks source link

Problem with "shallowCopy" #7

Open Asc2011 opened 1 year ago

Asc2011 commented 1 year ago

Hi,

i'd like to use the nim-parser as a lib. I noticed that NimNode seems almost identical to PNode which is used in nims parser modules. Finally you mentioned macros2 as a solution to use the familiar procs from std/macros during runtime. My task is pretty easy : i want to extract type-sections, basically all symbol-definitions from a nim-module. It adds editor support for any editor that allows to define a binary to scan thru a buffer and deliver a list of symbols. I use choosenim devel and installed via nimble install nim and later tried with choosenim stable, too. I see a strange error-msg, originating in the nimble/compiler-package(1400,10): Error: undeclared identifier: 'shallowCopy' And system/shallowCopy should be avail ? How can i get around this ? Can i somehow make sure that the nim/compiler-lib that gets compiled is the same as the actual nim-compiler i'm using ? I'm on the discord-channel, too. greets Andreas

elcritch commented 1 year ago

i'd like to use the nim-parser as a lib. I noticed that NimNode seems almost identical to PNode which is used in nims parser modules. Finally you mentioned macros2 as a solution to use the familiar procs from std/macros during runtime.

Yep! It's still a bit hacky, but effectively wraps PNode to provide a NimNode similar to how Nim itself does.

Can i somehow make sure that the nim/compiler-lib that gets compiled is the same as the actual nim-compiler i'm using ?

Yes, you can add switch("path", "$nim") to your config.nims file. For example https://github.com/elcritch/ants/blob/main/config.nims

Error: undeclared identifier: 'shallowCopy'

I'm not sure, but I think shallowCopy should still be available? I believe that deepCopy is unavailable with ARC/ORC thought.