From: David Bakhash
Subject: print-object on hash-tables...
Date: 
Message-ID: <wk4spdlk10.fsf@mit.edu>
I'm using ACL, and when I print out a hash-table, I get things like:

#<EQL hash-table with 0 entries @ #x9c221a>

This question really isn't only for hash-tables, as what I want to know
is what the:

@ #x9c221a 

is for.  I suppose it's the address of the hash-table, but I thought
that that would be useless to a Lisp programmer, so why would they tell
you that?

dave

From: Lyman S. Taylor
Subject: Re: print-object on hash-tables...
Date: 
Message-ID: <78lpev$ehj@pravda.cc.gatech.edu>
In article <··············@mit.edu>, David Bakhash  <·····@mit.edu> wrote:
...
>This question really isn't only for hash-tables, as what I want to know
>is what the:
>
>@ #x9c221a 
>
>is for.  I suppose it's the address of the hash-table, but I thought
>that that would be useless to a Lisp programmer, so why would they tell
>you that?

   Perhaps  ROOM tells you where the generations' "address" and  size.
   From that you may be able to figure out which generation your
   "object" is in.   

   Secondly, you may be doing something funky with a FFI call or low
   level debugger. Which is related to the next point. 

   It is also that object's  "identity".  Whether that notion of 
   "identity" is useful ( EQ , EQL) in your case may vary.  It can
   solve the "which" hash table question. 
   [ A couple of days ago I think I posted the expression 
      (make-array 4  
                  :element-type 'class-a  
                  :initial-element (make-instance 'class-a))

     if the array prints in full then you can see it is an array of
     the same instance since they all have the same "identity".
     The fact that the "number" is the same is the relevant point. Not
     so much that it is an particular location in memory. ]

   In "day to day" usage when everything is functioning as planned, it 
   is probably superfluous. 



-- 
					
Lyman S. Taylor          "The Borg --  party poopers of the Galaxy. "
(·····@cc.gatech.edu)                 EMH Doctor  Star Trek Voyager. 
From: Erik Naggum
Subject: Re: print-object on hash-tables...
Date: 
Message-ID: <3126429088916319@naggum.no>
* ·····@cc.gatech.edu (Lyman S. Taylor)
| Perhaps ROOM tells you where the generations' "address" and size.  From
| that you may be able to figure out which generation your "object" is in.

  this is more accurately reported by POINTER-STORAGE-TYPE in Allegro CL.

#:Erik
-- 
  SIGTHTBABW: a signal sent from Unix to its programmers at random
  intervals to make them remember that There Has To Be A Better Way.
From: Erik Naggum
Subject: Re: print-object on hash-tables...
Date: 
Message-ID: <3126389253563451@naggum.no>
* David Bakhash <·····@mit.edu>
| This question really isn't only for hash-tables, as what I want to know
| is what the: @ #x9c221a is for.  I suppose it's the address of the
| hash-table, but I thought that that would be useless to a Lisp
| programmer, so why would they tell you that?

  it is indeed the machine address of the object.  this is what the
  :IDENTITY argument to PRINT-UNREADABLE-OBJECT gives you.

(print-unreadable-object (nil nil :type t :identity t))
-| #<null @ #x20000985>

  it is sometimes useful to know whether you have different somethings that
  otherwise look exactly the same.

(make-hash-table)
=> #<eql hash-table with 0 entries @ #x21433aca>
(make-hash-table)
=> #<eql hash-table with 0 entries @ #x21433fd2>

  the value is not necessarily useful across a garbage collection, so it
  does have fairly limited use, but there's always something to be said for
  visual inspection.

  if you don't like it, the following piece of advice will turn it off.

(advise excl::print-unreadable-object-1 :before no-identity nil
  (setf (fourth arglist) nil))

  you will now observe this behavior, instead:

(print-unreadable-object (nil nil :type t :identity t))
-| #<null>
  
#:Erik
-- 
  SIGTHTBABW: a signal sent from Unix to its programmers at random
  intervals to make them remember that There Has To Be A Better Way.