stack overflow with-format vrml
Created by: reiniervandijk
(gdl::with-format (vrml \"/tmp/box.vrml\") (write-the-object (make-instance 'box :length 100 :width 100 :height 100) cad-output))
By genworks on 2013-03-09 17:45:24 UTC
This is user error but for sure we can give a better error message, so it can still be considered a bug.
The user error is that in Gendl, GDL objects need
make-object rather than the standard CLOS
make-instance in order to behave as expected.
Two ways of handling this - we might be able to customize the
make-instance behavior for class definitions with meta-class
gdl-class (this has been tried in the past and we ran into complications, but can look at it again) --- or at least we should give a clear error message when normal
make-instance is called on these definitions. So this Issue will remain open until resolved in one of these ways.
In the meantime a working version of the example would be:
(with-format (vrml "/tmp/box.vrml") (write-the-object (make-object 'box :length 100 :width 100 :height 100) cad-output))
The style notes from Issue #92 (closed) also apply. If you were to call this from a package not defined with gdl:define-package or gwl:define-package, the correct symbol package prefixes would look like this (note the exclusive use of single-colons):
(gdl:with-format (geom-base:vrml "/tmp/box.vrml") (gdl:write-the-object (gdl:make-object 'geom-base:box :length 100 :width 100 :height 100) cad-output))
Note that the output-function
cad-output behaves like any normal message name in Gendl, and does not need any package prefix because message names are immune to package. If you want to avoid "polluting" the current
*package* with the symbol
cad-output then you can use the keyword package, and write
:cad-output, with the same effect (this still "pollutes" the keyword package with the symbol "cad-output" but according to many folks, that's what the keyword package is there for in the first place).