The reason I want to intern is to have EQ-ness. The wrapper trick you suggest won't quite do it.
On Mon, May 10, 2010 at 2:11 PM, Matt Birkholz <[email protected]> wrote: >> From: Joe Marshall <[email protected]> >> Date: Fri, 7 May 2010 11:43:00 -0700 >> >> I want to intern some objects, but I want to be able to fasdump and >> fasload them, too. Is there any reasonable way (or unreasonable, >> for that matter), to hook into the fasloader to intern things when >> they are restored? > > A simple test can determine if your object was recently fasloaded, at > which point you can re-intern (on-demand). E.g. > > (define-structure thing tag unique) > > (define (thing.unique t) > (if (eq? unique-tag (thing-tag t)) > (thing-unique t) > (let ((new (re-intern-unique (thing-unique t)))) > (set-thing-unique! t new) > (set-thing-tag! t unique-tag) > new))) > > ;; This cannot match any fasloaded string, until some smart-*ss > ;; adds fancy constant string sharing yabber to my KISS runtime... :-} > (define unique-tag "constant string, shared or not") > > The real trick is cutting your objects off from their methods. These > insidious devils are (one?) reason why this happens: > > 1 ]=> (fasdump (make-thing unique-tag 'stand-in) "thing.bin") > > ;Dumping "thing.bin"... > ;Object cannot be dumped because it contains an environment: #[thing 19] > ;To continue, call RESTART with an option number: > > and why I have been heard to incant: > > (define-structure (alien-function > ;; To be fasdump/loadable. > (type vector) (named 'alien-function) > ...) > ...) > -- ~jrm _______________________________________________ MIT-Scheme-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
