Hi Stephan,

Thanks for the feedback. 

The tradeoff with your suggestion is the error messages:

> (expr)
. expr: bad syntax;
 identifier for static struct-type information cannot be used as an expression 
in: (expr)

as opposed to:

> (expr)
. . cannot construct value of type expr: use one of the variants (num add sub)

I'm pretty sure my students would be more at ease with the latter version. (and 
to be honest, it took me more time to make sense of the former too)

Cheers,

-- Éric


On Jun 11, 2013, at 3:44 AM, Stephan Houben <stephan...@gmail.com> wrote:

> Hi Eric,
> 
> I like it!
> 
> One thing though: instead of adding a guard which forbids use of the 
> constructor,
> what about simply hiding the constructor , like this:
> 
> 
> (define-syntax-rule (define-type t (variant vfield ...) ...)
>   (begin
>     (struct t () #:transparent #:constructor-name ?dummy)


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to