From: teles4
Subject: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131326935.121365.151870@g43g2000cwa.googlegroups.com>
OK, what I'm trying to do is have a function instantiate some
package-level variables.  I'm missing something rather fundamental
because the following does what i expect but the numbered lines below
fail. Both google & the hyperSpec have been unhelpful so far.

ASSEMBLER-AMD64> (defvar x)
X
ASSEMBLER-AMD64> (defvar y)
Y
ASSEMBLER-AMD64> (setq y 'x)
X
ASSEMBLER-AMD64> (defparameter x (make-instance 'byte-register
:encoding 123))
X
ASSEMBLER-AMD64> (symbol-name y)
"X"

      9 (defclass register ()
     10     ((size
     11         :documentation "Width of the register in bits"
     12         :initarg  :size
     13         :initform (error "Must supply a register size")
     14         :reader   :size)
     15      (encoding
     16         :documentation "Value that is used when generating
instructions"
     17         :initarg  :encoding
     18         :initform (error "Must supply a register encoding")
     19         :reader   :encoding)))
     20
     21 (defclass byte-register (register)
     22     (size
     23         :documentation "Width is always 8 bits"
     24         :initarg  :size
     25         :initform 8
     26         :reader   :size))
     27
     28 (let ((enc 0))
     29     (dolist (reg '(al cl dl bl ah ch dh bh))
     30         (defparameter reg
     31             (make-instance 'byte-register :encoding enc))
     32         (intern (symbol-name reg) 'assembler-amd64)
;;;<<<<<<<<Problem! <<<<<
     33         (incf enc)))

The error for this incarnation is:
The value #<BYTE-REGISTER {10007BB4D1}> is not of type SYMBOL.
   [Condition of type TYPE-ERROR]

i've tried many other versions too. Is this a binding problem? A macro
expansion problem? I know i can easily work around this but not
understanding what the issue is is annoying me more that the extra
typing. And the only reason for doing this project is to learn lisp.

Would some one please clue this newbie in?

Thanks
T4

From: teles4
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131332637.704364.13680@g44g2000cwa.googlegroups.com>
Thank you & sorry, I copied into the forum incorrectly (Ouch, I tried
to pretty things up too much.) the subclass was written with the needed
parens. So yes, that's a definite problem but that's not the problem
i'm experiencing. This is a raw cut & paste from slime:

ASSEMBLER-AMD64> (defclass register ()
    ((size
        :documentation "Width of the register in bits"
        :initarg  :size
        :initform (error "Must supply a register size")
        :reader   :size)
     (encoding
        :documentation "Value that is used when generating
instructions"
        :initarg  :encoding
        :initform (error "Must supply a register encoding")
        :reader   :encoding)))
#<STANDARD-CLASS REGISTER>
ASSEMBLER-AMD64> (defclass byte-register (register)
	   ((size
	     :initarg  :size
	     :initform 8
	     :reader   :size)))
#<STANDARD-CLASS BYTE-REGISTER>
ASSEMBLER-AMD64> (let ((enc 0))
	   (dolist (reg '(al cl dl bl ah ch dh bh))
	     (defparameter reg
	       (make-instance 'byte-register :encoding enc))
	     (intern (symbol-name reg) 'assembler-amd64)
	     (incf enc)))

The value #<BYTE-REGISTER {10001AE5F1}> is not of type SYMBOL.
   [Condition of type TYPE-ERROR]

Problem seems to be with the call to symbol-name:
Thanks again
t4
From: teles4
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131335156.165910.43410@g47g2000cwa.googlegroups.com>
OKaaay the following works.... grrr.
CL-USER> (defclass demo-class ()
	   ((value
	    :documentation "Just for show"
	    :initarg :value)))
#<STANDARD-CLASS DEMO-CLASS>
CL-USER> (let ((i 0))
	   (dolist (name '(value0 value1 value2))
	     (defparameter name
	       (make-instance 'demo-class :value i))
	     (print (symbol-name name))
	     (incf i)))


"VALUE0"
"VALUE1"
"VALUE2"
NIL



But this doesn't. So it's likely to be an issue with how i'm calling
intern. Hmm

CL-USER> (let ((i 0))
	   (dolist (name '(value0 value1 value2))
	     (defparameter name
	       (make-instance 'demo-class :value i))
	     (intern (symbol-name name) 'cl-user)
	     (incf i)))

The value #<DEMO-CLASS {1000443171}> is not of type SYMBOL.
   [Condition of type TYPE-ERROR]

A newbie mistake for sure but what?
From: Thomas A. Russ
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <ymir79sqddk.fsf@sevak.isi.edu>
"teles4" <···········@gmail.com> writes:

> 
> OKaaay the following works.... grrr.
> CL-USER> (defclass demo-class ()
> 	   ((value
> 	    :documentation "Just for show"
> 	    :initarg :value)))
> #<STANDARD-CLASS DEMO-CLASS>
> CL-USER> (let ((i 0))
> 	   (dolist (name '(value0 value1 value2))
> 	     (defparameter name
> 	       (make-instance 'demo-class :value i))
> 	     (print (symbol-name name))
> 	     (incf i)))
> 
> 
> "VALUE0"
> "VALUE1"
> "VALUE2"
> NIL
> 
> 
> But this doesn't. So it's likely to be an issue with how i'm calling
> intern. Hmm

Nope.  The problem is that this is the second form.  I'll bet if you try
the version that "works" twice in a row, it will fail the second time as
well.

> CL-USER> (let ((i 0))
> 	   (dolist (name '(value0 value1 value2))
> 	     (defparameter name
> 	       (make-instance 'demo-class :value i))
> 	     (intern (symbol-name name) 'cl-user)
> 	     (incf i)))
> 
> The value #<DEMO-CLASS {1000443171}> is not of type SYMBOL.
>    [Condition of type TYPE-ERROR]
>
> A newbie mistake for sure but what?

Well, it's more complicated than you think.  In this case, it has to do
with DEFPARAMETER, evaluation of arguments and special variables.

Special variables have dynamic bindings.  DEFPARAMETER, as one of its
side-effects globally proclaims the variable in question as being
special.  So, the first time you run the code, the variable "name" in
the DOLIST loop is a lexical variable.  But the body of the loop
executes the DEFPARAMETER, which makes the symbol NAME be globally
special.  So the second time you run a DOLIST that uses the stepping
variable NAME, it gets the dynamic (special) binding, which gets changed
by DEFPARAMETER.

That brings us to the other issue, namely that DEFPARAMETER does not
evaluate its first argument.  That is why you can create variables with
like         (DEFPARAMETER my-var 42)
instead of   (DEFPARAMETER 'my-var 42)

The upshot of that is that the form
   (defparameter name
	       (make-instance 'demo-class :value i))
inside the loop keeps redefining the value of the symbol NAME, instead
of the symbols VALUE0, VALUE1, VALUE2.  I suspect that you actually
intended to have the latter effect take place.  To have that happen, you
need to do the two parts of the DEFPARAMETER action, namely proclaiming
the symbol to denote a special variable and assigning the global value.
Barry Margolin's response has code which does just that.


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: telesphore
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131505141.265520.97530@g49g2000cwa.googlegroups.com>
> Nope.  The problem is that this is the second form.  I'll bet if you try
> the version that "works" twice in a row, it will fail the second time as
> well.
>

Yes I ran across this almost immediatly after the post.

> Well, it's more complicated than you think.  In this case, it has to do
> with DEFPARAMETER, evaluation of arguments and special variables.

> Special variables have dynamic bindings.  DEFPARAMETER, as one of its
> side-effects globally proclaims the variable in question as being
> special.  So, the first time you run the code, the variable "name" in
> the DOLIST loop is a lexical variable.  But the body of the loop
> executes the DEFPARAMETER, which makes the symbol NAME be globally
> special.  So the second time you run a DOLIST that uses the stepping
> variable NAME, it gets the dynamic (special) binding, which gets changed
> by DEFPARAMETER.
>
> That brings us to the other issue, namely that DEFPARAMETER does not
> evaluate its first argument.  That is why you can create variables with
> like         (DEFPARAMETER my-var 42)
> instead of   (DEFPARAMETER 'my-var 42)
>
> The upshot of that is that the form
>    (defparameter name
> 	       (make-instance 'demo-class :value i))
> inside the loop keeps redefining the value of the symbol NAME, instead
> of the symbols VALUE0, VALUE1, VALUE2.  I suspect that you actually
> intended to have the latter effect take place. To have that happen, you
> need to do the two parts of the DEFPARAMETER action, namely proclaiming
> the symbol to denote a special variable and assigning the global value.
> Barry Margolin's response has code which does just that.

Excellent explanation. You've also zeroed in on why i can't (yet)
change things from a special variable into a DEFCONSTANT.

> -- 
> Thomas A. Russ,  USC/Information Sciences Institute

Thank you.
From: Barry Margolin
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <barmar-C75DA5.22415906112005@comcast.dca.giganews.com>
In article <·······················@g44g2000cwa.googlegroups.com>,
 "teles4" <···········@gmail.com> wrote:

> ASSEMBLER-AMD64> (let ((enc 0))
> 	   (dolist (reg '(al cl dl bl ah ch dh bh))
> 	     (defparameter reg
> 	       (make-instance 'byte-register :encoding enc))
> 	     (intern (symbol-name reg) 'assembler-amd64)
> 	     (incf enc)))
> 
> The value #<BYTE-REGISTER {10001AE5F1}> is not of type SYMBOL.
>    [Condition of type TYPE-ERROR]
> 
> Problem seems to be with the call to symbol-name:
> Thanks again
> t4

DEFPARAMETER proclaims REG to be a special variable and then assigns the 
result of MAKE-INSTANCE to it.  So when you call SYMBOL-NAME, REG no 
longer contains a symbol from the list you're iterating through, it 
contains a BYTE-REGISTER object.

I suspect what you want is:

(do* ((enc 0 (1+ enc))
      (reg-list '(al cl dl bl ah ch dh bh) (cdr reg-list))
      (reg-symbol (intern (car reg-list) 'assembler-amd64)))
     ((null reg-list))
  (proclaim `(special ,reg-symbol))
  (setf (symbol-value reg-symbol)
        (make-instance 'byte-register :encoding enc)))

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: teles4
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131336934.594985.85860@o13g2000cwo.googlegroups.com>
A double assignment. Got it. I'll study your code.
Thank you.
From: teles4
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131378114.115870.254270@f14g2000cwb.googlegroups.com>
Using your code & some hyperspec i came up with the following.

ASSEMBLER-AMD64> (let ((enc 0))
		   (dolist (reg '(al cl dl bl ah ch dh bh))
		     (proclaim `(special ,reg))
		     (setf (symbol-value reg)
			   (make-instance 'byte-register :encoding enc))
		     (incf enc)))
NIL
ASSEMBLER-AMD64> bh
#<BYTE-REGISTER {1000999801}>


Because i'm paranoid about polluting namespaces, a simple check to make
sure the definitions are _not_ in cl-user

ASSEMBLER-AMD64> (in-package cl-user)
#<PACKAGE "COMMON-LISP-USER">
CL-USER> ch
; Evaluation aborted
CL-USER> bh
; Evaluation aborted
CL-USER>

A few hours into lisp & some things are staring to make sense. Nice.

It would have taken me days to find the proclaim function so thanks yet
again.
t4
From: Thomas A. Russ
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <ymilkzxr8g2.fsf@sevak.isi.edu>
"teles4" <···········@gmail.com> writes:

> 
> OK, what I'm trying to do is have a function instantiate some
> package-level variables.  I'm missing something rather fundamental
> because the following does what i expect but the numbered lines below
> fail. Both google & the hyperSpec have been unhelpful so far.

Well, I don't think you can do what you want with a function.  You want
to have a form that EXPANDS into CODE rather than EXECUTES code.  That
calls for the use of a macro.

> 
> ASSEMBLER-AMD64> (defvar x)
> X
> ASSEMBLER-AMD64> (defvar y)
> Y
> ASSEMBLER-AMD64> (setq y 'x)
> X

I doubt this does what you think (hope?) it does.
This just assigns the symbol X as the value of Y.  It doesn't link the
value cells of the two variables.

> ASSEMBLER-AMD64> (defparameter x (make-instance 'byte-register
> :encoding 123))
> X
> ASSEMBLER-AMD64> (symbol-name y)
> "X"

But if you evaluate Y you get the symbol X, not the BYTE-REGISTER object
that is now the value of X.

OK, in the following is where you really want a macro.

>      28 (let ((enc 0))
>      29     (dolist (reg '(al cl dl bl ah ch dh bh))
>      30         (defparameter reg
>      31             (make-instance 'byte-register :encoding enc))
>      32         (intern (symbol-name reg) 'assembler-amd64)

INTERN here isn't really doing anything useful for you.  It is just
creating symbols in the ASSEMBLER-AMD64 package.  Now since you are
apparently already in that package, the list of symbols that REG
iterates over are already interned there by the reader.

And if that weren't the case, [say, because you read this code in a
different package], REG would be iterating over different symbols than
the intern produces.

>      33         (incf enc)))

The way I approach most macro writing is to start with an example of the
code that I want to produce.  Then I set about writing a program to
produce that code.

Apparently what you want to produce is

 (let ((enc 0))
   (defparameter al (make-instance 'byte-register :encoding enc)))

So, to create something like that we can start with the following little
program, using BACKQUOTE.  Backquote makes macro writing very, very much
easier than having to create the program structure using LIST, CONS and
friends.  Not the least is because it makes it easy to turn an example
of the code you want to produce into a template for that code.  If you
want to write all but trivial macros you should learn how it works.

  (let ((reg 'al))
    `(let ((enc 0))
        (defparameter ,reg (make-instance ...))))

OK.  Now you really want to do this in a loop as in your original code.
So what we'll do is write a macro that does that:

(defmacro make-byte-registers (&rest register-names)
  (let ((register-code nil))
    (dolist (reg register-names)
       (push `(defparameter ,reg 
                            (make-instance 'byte-register :encoding enc))
             register-code))
    `(let ((enc 0))
        ,@register-code)))

Now, this macro still has a few problems with it, the major one being
that we introduce a bound variable ENC which would be a bad thing if one
ever had a register named ENC as well.  To avoid that, we will use a
newly created symbol made by GENSYM.  This symbol in not interned, so it
can't be accessed by name, which makes it safe to use.  As a general
principle, you should not use named variables that are not supplied by
the caller inside of macro expansions, because of the risk of variable
capture.  [There are obscure times when this is not true, but in general
it is not safe to do so.]

(defmacro make-byte-registers (&rest register-names)
  (let ((enc-var (gensym "ENC-"))
        (register-code nil))
    (dolist (reg register-names)
       (push `(defparameter ,reg 
                            (make-instance 'byte-register :encoding ,enc-var))
             register-code))
    `(let ((,enc-var 0))
        ,@register-code)))

You would use this in a source file like this:

   (make-byte-registers al cl dl bl ah ch dh bh)

To see what this produces you use MACROEXPAND on an example call:

(macroexpand '(make-byte-registers al cl dl bl ah ch dh bh))

=>

(LET ((#:ENC-147 0))
  (DEFPARAMETER BH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER DH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER CH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER AH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER BL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER DL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER CL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
  (DEFPARAMETER AL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147)))

The order of parameter definitions is reversed because of the push, but
since it doesn't really matter, I left it this way.  Actually, if I were
to write the macro myself, I would make it a bit more concise by using
LOOP and a collection clause, but I tried to stay close to what you
started with to show the process.

(defmacro make-byte-registers (&rest register-names)
  (let ((enc-var (gensym "ENC-")))
    `(let ((,enc-var 0))
        ,@(loop for reg in register-names
                collect `(defparameter ,reg 
                            (make-instance 'byte-register
                                            :encoding ,enc-var))))))

BTW, this shows off Lisp's nice benefit of being able to execute code as
part of the macro expansion.

Finally, you can make it more fancy by allowing options to be passed in
for things like what you want.

As a final note, it isn't necessarily clear why you want to create these
global variables for you design.  It may be that there is a better
overall design for your project that doesn't involve the use of global
variables but instead creates other structures or classes that hold the
information you want.  Perhaps something based on hash tables would be
more convenient.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: telesphore
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1131597540.590935.234580@g43g2000cwa.googlegroups.com>
Garh! firefox ate my last reply so please forgive my terseness.

Thomas A. Russ wrote:
> "teles4" <···········@gmail.com> writes:
>
> >
> > OK, what I'm trying to do is have a function instantiate some
> > package-level variables.  I'm missing something rather fundamental
> > because the following does what i expect but the numbered lines below
> > fail. Both google & the hyperSpec have been unhelpful so far.
>
> Well, I don't think you can do what you want with a function.  You want
> to have a form that EXPANDS into CODE rather than EXECUTES code.  That
> calls for the use of a macro.
>
> >
> > ASSEMBLER-AMD64> (defvar x)
> > X
> > ASSEMBLER-AMD64> (defvar y)
> > Y
> > ASSEMBLER-AMD64> (setq y 'x)
> > X
>
> I doubt this does what you think (hope?) it does.
> This just assigns the symbol X as the value of Y.  It doesn't link the
> value cells of the two variables.
>

What is was shooting for here is was a double indirect sort of thing. A
pointer to a pointer to a value.

> > ASSEMBLER-AMD64> (defparameter x (make-instance 'byte-register
> > :encoding 123))
> > X
> > ASSEMBLER-AMD64> (symbol-name y)
> > "X"
>
> But if you evaluate Y you get the symbol X, not the BYTE-REGISTER object
> that is now the value of X.
>
> OK, in the following is where you really want a macro.
>
> >      28 (let ((enc 0))
> >      29     (dolist (reg '(al cl dl bl ah ch dh bh))
> >      30         (defparameter reg
> >      31             (make-instance 'byte-register :encoding enc))
> >      32         (intern (symbol-name reg) 'assembler-amd64)
>
> INTERN here isn't really doing anything useful for you.  It is just
> creating symbols in the ASSEMBLER-AMD64 package.  Now since you are
> apparently already in that package, the list of symbols that REG
> iterates over are already interned there by the reader.
>
> And if that weren't the case, [say, because you read this code in a
> different package], REG would be iterating over different symbols than
> the intern produces.
>

Leaning heavily on Barry Margolin I came up with:

(defun declare-registers (reg-type reg-list)
  (let ((enc 0))
    (dolist (reg reg-list)
      (proclaim `(special ,reg))
      (setf (symbol-value reg)
            (make-instance reg-type :encoding enc))
      (incf enc))))

(declare-registers 'legacy-byte-register  '( al  cl  dl  bl  ah  ch  dh
 bh))
(declare-registers 'word-register         '( ax  cx  dx  bx  sp  bp  si
 di))

> >      33         (incf enc)))
>
> The way I approach most macro writing is to start with an example of the
> code that I want to produce.  Then I set about writing a program to
> produce that code.
>
> Apparently what you want to produce is
>
>  (let ((enc 0))
>    (defparameter al (make-instance 'byte-register :encoding enc)))
>

defconstant actually but yes.

> So, to create something like that we can start with the following little
> program, using BACKQUOTE.  Backquote makes macro writing very, very much
> easier than having to create the program structure using LIST, CONS and
> friends.  Not the least is because it makes it easy to turn an example
> of the code you want to produce into a template for that code.  If you
> want to write all but trivial macros you should learn how it works.
>
>   (let ((reg 'al))
>     `(let ((enc 0))
>         (defparameter ,reg (make-instance ...))))
>
> OK.  Now you really want to do this in a loop as in your original code.
> So what we'll do is write a macro that does that:
>
> (defmacro make-byte-registers (&rest register-names)
>   (let ((register-code nil))
>     (dolist (reg register-names)
>        (push `(defparameter ,reg
>                             (make-instance 'byte-register :encoding enc))
>              register-code))
>     `(let ((enc 0))
>         ,@register-code)))
>

Ah "push", OK.

> Now, this macro still has a few problems with it, the major one being
> that we introduce a bound variable ENC which would be a bad thing if one
> ever had a register named ENC as well.  To avoid that, we will use a
> newly created symbol made by GENSYM.  This symbol in not interned, so it
> can't be accessed by name, which makes it safe to use.  As a general
> principle, you should not use named variables that are not supplied by
> the caller inside of macro expansions, because of the risk of variable
> capture.  [There are obscure times when this is not true, but in general
> it is not safe to do so.]
>
> (defmacro make-byte-registers (&rest register-names)
>   (let ((enc-var (gensym "ENC-"))
>         (register-code nil))
>     (dolist (reg register-names)
>        (push `(defparameter ,reg
>                             (make-instance 'byte-register :encoding ,enc-var))
>              register-code))
>     `(let ((,enc-var 0))
>         ,@register-code)))
>
> You would use this in a source file like this:
>
>    (make-byte-registers al cl dl bl ah ch dh bh)
>
> To see what this produces you use MACROEXPAND on an example call:
>
> (macroexpand '(make-byte-registers al cl dl bl ah ch dh bh))
>
> =>
>
> (LET ((#:ENC-147 0))
>   (DEFPARAMETER BH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER DH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER CH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER AH (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER BL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER DL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER CL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147))
>   (DEFPARAMETER AL (MAKE-INSTANCE 'BYTE-REGISTER :ENCODING #:ENC-147)))
>
> The order of parameter definitions is reversed because of the push, but
> since it doesn't really matter, I left it this way.  Actually, if I were
> to write the macro myself, I would make it a bit more concise by using
> LOOP and a collection clause, but I tried to stay close to what you
> started with to show the process.
>
> (defmacro make-byte-registers (&rest register-names)
>   (let ((enc-var (gensym "ENC-")))
>     `(let ((,enc-var 0))
>         ,@(loop for reg in register-names
>                 collect `(defparameter ,reg
>                             (make-instance 'byte-register
>                                             :encoding ,enc-var))))))
>
> BTW, this shows off Lisp's nice benefit of being able to execute code as
> part of the macro expansion.

Bingo! You've hit on exactly why I'm exploring paren-city. I'm trying
to get with the whole programs writing other progams progam. I sick of
using Perl or Python to generate C++ modules. I want the ability to
just do it all in the same (preferably interactive) environment.

Execute macro code as it's expanded... yes... yes. This may be the
language for me.

> Finally, you can make it more fancy by allowing options to be passed in
> for things like what you want.
>
> As a final note, it isn't necessarily clear why you want to create these
> global variables for you design.  It may be that there is a better
> overall design for your project that doesn't involve the use of global
> variables but instead creates other structures or classes that hold the
> information you want.  Perhaps something based on hash tables would be
> more convenient.

Well ostensibly ( word-a-day :) i'm writing a simple assembler but the
real purpose is to check out this language.

But considering that design options may be available that i never
considered before here's the rough outline so far:

Prefix notation looks a lot like assembly notation so i were to hand a
list of things like

(xor rax rbx)
(adc r8 r9)

to my lisp program then I could get back not only the generated bytes
but also some simple analyses on how well the instructions pack into
the piplines etc.

Yes, I'll bet that others have already done this better than I can but
bits & bytes and assembly is all comfortable to me. So I'm using the
known to help explore the unknown. Anyway...

> --
> Thomas A. Russ,  USC/Information Sciences Institute

Thank you again. This was most enlightening
Teles4
From: telesphore
Subject: Re: Getting a parameter's name when it's a class instance
Date: 
Message-ID: <1132014732.696179.75040@g14g2000cwa.googlegroups.com>
Dr. Russ,

I finally had a chance to get back to lisp and apply your code. It all
works like a charm (of course) and I your explainations were crystal
clear too.

thank you again
telesphore