These seems like a nice solution to the cyclic type problem, but I've been running into lots of weird errors.
Here's a simple one that causes a gcc error:
main.nim:
type
plotest.MyObj = object
import defs
proc foo() =
discard MyRef()
defs.nim:
type
MyObj {.package.} = object of RootObj
MyRef* = ref MyObj
The error goes away if MyObj doesn't inherit from RootObj.
And if I try to inherit from a package-level object, that doesn't work either:
type
MyObj {.package inheritable.} = object
MyRef* = ref MyObj
MyChildRef = ref object of MyObj
It says inheritance only works with non-final objects.
And when I try to use it without inheritance, I often get request for RTTI generation for incomplete object errors on things that should work. I'm still working on putting together a reproducible test case for this. It only seems to happen on my larger codebase.
Has anyone successfully used these on something non-trivial? Am I doing something wrong here?
Has anyone successfully used these on something non-trivial?
No. :-) I couldn't get people to test this feature, sorry.
I often get request for RTTI generation for incomplete object errors on things that should work
Well, the compiler begs to differ. Not sure how much these can be mitigated as the RTTI is generally requested when it really needs to be.
No. I couldn't get people to test this feature, sorry.
You should have advertised it more. I didn't even know this feature existed...