At Sun, 5 Nov 2017 10:15:13 +0000, Tony Garnock-Jones wrote:
> Would it make sense to have a `let-immutable` form that was just like
> `let` but that forbade use of `set!` with introduced variables?
> I'm thinking it could be handy for authors of libraries that introduce a
> lot of bindings in DSLs where mutability has to be strictly controlled.
> I think it is probably possible to get the effect of `let-immutable`
> with careful use of identifier macros, but would there be advantages
> internal to the compiler/runtime of being able to up-front, primitively
> declare a set of bindings as immutable?

Being more explicit would not help the compiler, which can already see
whether any `set!`s are present for a local binding and produce better
code if not. The prohibition against `set!` on imported variables means
that the compiler can similarly optimize module bindings that have no
`set!` within the module.

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to