[plt-scheme] Struct guard and auto fields

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Fri Apr 17 12:10:08 EDT 2009

HI all,

I have defined a guard for a struct which has an auto field. It makes
sense that the guard receives all the fields (including the auto ones)
but this doesn't seem to happen.
(define-struct foo
  (bar
   (foobar #:auto))
  #:guard
  (lambda (bar foobar type-name)
    (values bar foobar)))

make-struct-type: guard procedure does not accept 2 arguments (one
more than the number constructor arguments): #<procedure>

There is no reference to this in the docs except for:
The arguments to guard are the values provided for the structure’s
first n fields, followed by the name of the instantiated structure
type (which is name, unless a subtype is instantiated).

There is no ref. to possible auto fields not being includes in the
arguments to guard. I feel this might be a bug in the code, not the
docs because I might be interested to have my guard depend on auto
fields.

Cheers,
-- 
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm


Posted on the users mailing list.