I'd like to create a new exception type, 'exn:fail:insufficient-space',
something like this:

(struct exn:fail:insufficient-space exn:fail (requested available source))

I would like to do two things:

1) Make the exn-message field be standardized so that the person throwing
the exception doesn't need to (or, ideally, cannot) set it.

2) Apply a contract so that only valid arguments can be supplied.

I could do both of these with a 'guard' statement and an external function
definition:

(define/contract (zot msg ccm req avail src type)
  (values "Insufficient space" ccm req avail src))
(struct exn:fail:insufficient-space exn:fail (requested available source)
    #:guard zot)

...but this gives me a top-level definition that I don't want and need to
remember to not export. I've been through the sections on contracts and
local bindings and I don't see a way to apply one to a raw lamdba -- is
there one?

I also don't see a way to make it so that the fields inherited from the
superclass will default and not need to be specified by the caller.  There
is the 'struct-defaults' package but that is lacking documentation and I'm
not sure it works for defaulting the fields of a superclass.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to