[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
object-variable, local variable conflict
- To: info-macl@cambridge.apple.com
- Subject: object-variable, local variable conflict
- From: lynch@aristotle.ils.nwu.edu (Richard Lynch)
- Date: Wed, 6 Feb 91 15:03:15 CST
Is there any alternative way of getting the value of an object's
object-variable directly...Somehow in the macros a symbol is getting bound
(maybe by a let or as part of a function's lambda-list) to a value, and I
need to ignore this binding and get my object's binding of its
object-variable of the same name.
(objvar name) doesn't work.
I know I should trace this back to its source and rewrite the offending
macro or function to avoid the conflict, but the path is long and involves
compiled functions etc that can't be stepped through...
Why in the world do lexical bindings take precedence over object bindings
anyway?!!!!
Something like:
(defmacro find-or-create (macl-window-type new-node &rest keyword-args)
`(let ((existing-window (find ,new-node (windows ,macl-window-type t t)
:key #'(lambda (window) (ask window node))
;;;;This key function is expecting to get the object-variable binding of
node.
:test #'eq
)) )
(if *in-modal-dialog*
(modal-dialog
(if existing-window
(ask existing-window
(set-window-position (or (getf (list ,@keyword-args)
:window-position)
(window-position)
) )
(self)
)
(oneof ,macl-window-type :node ,new-node ,@keyword-args)
) )
(if existing-window
(ask existing-window
(set-window-position (or (getf (list ,@keyword-args)
:window-position)
(window-position)
) )
(window-select)
)
(oneof ,macl-window-type :node ,new-node ,@keyword-args)
) ) ) )
(defmacro i-display-icon-window (new-node &rest init-list)
`(find-or-create *i-icon-window* ,new-node ,@init-list)
)
:failure #'(lambda (dialog-item position)
(cond
((isa-p dialog-item *i-sequence-dialog-item*)
(dolist (node (selected-cell-contents))
;;;;But, I used node here as the dolist variable, which ideally should be
irrelevant.
(when (find-icon node)
(i-display-icon-window
node
:window-position position
)
(incf position #@(4 4))
)) )
(t
(when (find-icon node)
(i-display-icon-window
node
:window-position position
) ) ) ) )
PS, I know the macros are really bad form in terms of multiple evaluation
of arguments, but that's beside the point here.
"TANSTAAFL" Rich lynch@aristotle.ils.nwu.edu