chickadee » gromit » define-object-constructor

(define-object-constructor name type proc)syntax

Defines a constructor, `proc`, for an object type. `proc` takes a freshly made, but uninitialised, object as its first argument. Any subsequent arguments are user defined. `proc` then manipulates the provided object using the regular object accessors. When `proc` has finished executing, the constructed object is returned to the user. The return value of `proc` is ignored.

  (define-object-constructor make-email-address* email-address
    (lambda (e address use-for-notifications)
  
      (assert (string? address))
  
      (let ((addr (x-email-address address)))
        (assert addr (conc "mail-email-address*: Expected a valid eMail address. We got " address "!"))
        (email-address-domain-part            e (domain-part->string   addr))
        (email-address-local-part             e (local-part->string    addr))
        (email-address-local-part-ci          e (local-part->string-ci addr))
        (email-address-use-for-notifications  e use-for-notifications)
        (email-address-verified               e #f)
        (email-address-preferred-content-type e 'fancy-html))))