[racket] syntax, differently

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Sun Aug 1 17:11:40 EDT 2010

On Sun, Aug 01, 2010 at 03:11:43PM -0400, Todd O'Bryan wrote:
> There are a couple of things we could do to help with the underlying
> cause. I've been looking at OCaml recently, and the construct they
> have for copying and updating a record is something that maybe Racket
> could use. Something like (update my-struct (<- a-field new-val) ...)
> might make things less nasty to write. (Of course, since structs don't
> maintain a list of their field names, this would be a pain to code
> up.)


This form doesn't appear to be in the teaching languages, and I haven't
thought about the pedagaogical consequences of adding it.  But there
doesn't appear to be any technical reason why it couldn't be added.

And you're right -- it is _awfully_ useful, although it occasionally
hiccups when confronted with structure types that involve inheritance; I'm
pretty sure I've filed some PRs on that point.

Speaking of PRs -- Todd, if you were looking through the documentation
trying to find this feature and couldn't, you might think about filing a
ticket about this that includes the search terms you tried.


Posted on the users mailing list.