[plt-scheme] mutation in typed scheme structs

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Apr 13 11:14:23 EDT 2010

On Tue, Apr 13, 2010 at 11:10 AM, keydana at gmx.de <keydana at gmx.de> wrote:
> Hi,
> one question regarding typed scheme: can I use mutation in typed scheme structs, like e.g.
> (define-struct: pt ([x : Real] [y : Real]))
> (define p (make-pt 1 2))
> (set-pt-x! p 22)
> I tried adding #:mutable to one of the fields with different syntaxes, but didn't get it to work - could someone give me a little hint please?

Typed Scheme only support mutability at the struct level, not the
individual field level:

#lang typed/scheme

(define-struct: pt ([x : Real] [y : Real]) #:mutable)
(define p (make-pt 1 2))
(set-pt-x! p 22)

Supporting individual mutable fields is on the to-do list.
sam th
samth at ccs.neu.edu

Posted on the users mailing list.