[plt-dev] struct match-expander a la struct-copy

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Wed Jun 3 10:05:51 EDT 2009

>  (define-struct foo (x y)
>    #:positional-constructor make-foo1
>    #:keyworded-cosntrutor make-foo2)


The #:positional-constructor option would be really useful for another  

I sometimes find myself creating custom constructors for structs and  
providing them under contracts. I currently have to do it in two  
modules to get the right names:


     #lang scheme
     (define-struct foo (...))
     (define (create-foo ...) ...)
      [struct foo ...]
      [create-foo ...]))


     #lang scheme
     (require "foo-internal.ss")
     (provide (except-out (struct-out foo) make-foo)
                   (rename-out [create-foo make-foo]))

This addition would allow me to define a struct with "make-foo/ 
internal" (or something) as its uncontracted constructor name and  
define make-foo directly without the renaming shenanigans.

-- Dave

Posted on the dev mailing list.