possible to write a with-object prc/macro ?

From: Brian Denheyer <briand_at_deldotd.com>
Date: Mon, 12 Jul 1999 13:31:57 -0700 (PDT)

I find myself doing the following quite a lot :

(define-method foo
  ((self <obj>))
  (let ((x (x-of self)) ;; actually named slot 'x'
        (y (y-of self)) ;; actually named slot 'y'
        ...)
    calculations using x, y ...

It would be very convenient to have something like :

(with-object self
  calculation involving slot-x,slot-y and variables OTHER than x and y.

so I could write

(define-method foo
  ((self <obj>))
  (let ((z 22))
    (with-object self
      (+ z (* x y)))))

and it would do the right thing, i.e. take x and y from self.
Naturally if x and y are not slots, then it would throw and error for
unknown variable.

It's not obvious to me that something like this could be written as a
macro, i.e. would it require low-level modifications to the
implementation ?



Brian
Received on Mon Jul 12 1999 - 22:32:05 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST