[racket] syntax, differently

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Sun Aug 1 18:11:18 EDT 2010

Thanks for reminding me about that function. I'd forgotten about it.
It's kind of annoying that you have to tell it what kind of structure
you're copying (Shouldn't the struct know what kind of struct it is?),
but it does exactly what I was looking for.

Anyone know why this couldn't be put in the student languages?

Todd

On Sun, Aug 1, 2010 at 5:11 PM, Richard Cobbe <cobbe at ccs.neu.edu> wrote:
> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.