Sorry to be picky: it isn't that it isn't available; it isn't allowed.
It is a _good_ thing that you cannot mutate an immutable set, just
like it is a good thing that (begin (set! 3 4) (+ 3 3)) doesn't
evaluate to 8.
What about trying to follow with a message like this one:
-> (hash-set! (hash) 'x 1)
; hash-set!: contract violation
; expected: (and/c hash? (not/c immutable?))
; given: '#hash()
; argument position: 1st
Robby
On Fri, May 1, 2015 at 3:48 PM, <
stc...@racket-lang.org> wrote:
> stchang has updated `master' from 606a946212 to aef101fd84.
>
http://git.racket-lang.org/plt/606a946212..aef101fd84
>
> =====[ One Commit ]=====================================================
> Directory summary:
> 100.0% racket/collects/racket/private/
>
> ~~~~~~~~~~
>
> aef101f Stephen Chang <
stc...@racket-lang.org> 2015-05-01 16:43
> :
> | hashset unavailable method err msg: don't say unimplemented
> :
> M racket/collects/racket/private/set-types.rkt | 8 ++++----
>
> =====[ Overall Diff ]===================================================
>
> racket/collects/racket/private/set-types.rkt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/racket/collects/racket/private/set-types.rkt
> +++ NEW/racket/collects/racket/private/set-types.rkt
> @@ -459,13 +459,13 @@
> (define custom-set-constant
> (equal-hash-code "hash code for a set based on a hash table"))
>
> -(define (((mk-not-impl struct-descrip) method-name) s . args)
> +(define (((mk-not-impl meth-descrip struct-descrip) method-name) s . args)
> (raise
> (exn:fail:support
> - (format "~a: method not implemented for ~a ~e" method-name struct-descrip s)
> + (format "~a: ~a operation not available for ~a: ~e" method-name meth-descrip struct-descrip s)
> (current-continuation-marks))))
> -(define mk-not-impl/immut (mk-not-impl "immutable set"))
> -(define mk-not-impl/mut (mk-not-impl "mutable set"))
> +(define mk-not-impl/immut (mk-not-impl "mutation" "immutable set"))
> +(define mk-not-impl/mut (mk-not-impl "non-mutation" "mutable set"))
>
> (serializable-struct immutable-custom-set custom-set []
> #:methods gen:stream