Open traversaro opened 9 years ago
Good point. It makes sense to implement this method only to ensure that an error is being thrown.
@jgillis ?
we currently have this https://github.com/KrisThielemans/swig/blob/cecdea3f44837ce95bdf1fef809312f2e786c08b/Source/Modules/matlab.cxx#L2748-L2751 This gives however
warning: Serializing SWIG objects not supported.
warning: called from
saveobj at line 16 column 7
error: saveobj: not defined for class "char"
error: called from
saveobj at line 51 column 3
saveobj at line 17 column 11
which isn't great either. I think better to call error
directly
I got some feedback from confused users of my SWIG-wrapped library that saved (with "save") and loaded back (with "load") their workspace containing SWIG Classes.
Clearly the "save" and "load" are not supported out-of-the-box by the SWIG Classes. The main source of confusion is that the class are saved and loaded without any warning, and then they fail with an error message when the user interacts with the loaded classes.
To have a clearer error message, I tried to implement a saveobj method in
SwigRef
that just print a warning as soon as the user try to save a SWIG class, but I don't know if it could make sense to have this in the SwigRef.m generated by SWIG.