[racket] syntax, differently
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.)
See
http://docs.racket-lang.org/reference/struct-copy.html?q=struct-copy#%28form._%28%28lib._racket/private/base..rkt%29._struct-copy%29%29
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.
Richard