[plt-scheme] inferred name of struct instances
I'm trying to assign a name to an applicable struct instance using
syntax-property, but it appears to be getting clobbered somehow by the
default struct naming mechanism:
(define-values (struct:fish make-anon-fish fish? fish-ref fish-set!)
(make-struct-type 'fish #f 2 0 #f null #f
(lambda (f n) (fish-set! f 0 (+ n (fish-ref f 0))))))
(define-syntax (make-fish stx)
(syntax-case stx ()
((_ . args)
(begin (printf "Defining a fish called ~a.~%" (syntax-local-name))
(syntax-property (syntax/loc stx (make-anon-fish . args))
'inferred-name (syntax-local-name))))))
(define wanda (make-fish 12 'red))
> (load "fish.scm")
Defining a fish called wanda.
> wanda
#<struct:fish>
> (object-name wanda)
fish
What am I doing wrong?
--dougo at ccs.neu.edu