Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

stack overflow with-format vrml #93

Open
reiniervandijk opened this issue Mar 9, 2013 · 1 comment
Open

stack overflow with-format vrml #93

reiniervandijk opened this issue Mar 9, 2013 · 1 comment

Comments

@reiniervandijk
Copy link

(gdl::with-format (vrml \"/tmp/box.vrml\") 
        (write-the-object (make-instance 'box :length 100 :width 100 :height 100) cad-output))
@genworks
Copy link
Owner

genworks commented Mar 9, 2013

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 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).

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

No branches or pull requests

2 participants