[racket] set! racket behaviour

From: jkaczorek at aol.pl (jkaczorek at aol.pl)
Date: Wed Nov 2 04:12:39 EDT 2011

 

 

 

-----Original Message-----
From: Dan Grossman <djg at cs.washington.edu>
To: David Vanderson <david.vanderson at gmail.com>
CC: jkaczorek <jkaczorek at aol.pl>; users <users at racket-lang.org>
Sent: Mon, 31 Oct 2011 21:25
Subject: Re: [racket] set! racket behaviour


I also found it counterintuitive that

#lang racket
(define x 0)
(set! x 1)

works, but moving the set! out of the module and into the REPL does
not.  But Dave has pointed to the exact line in the Guide that makes
this clear: A module-level definition is mutable only if there is a
set! for it in the module.  Once you know that "reasonable compromise"
[as I put it in my emerging lecture materials], everything works as
expected.


Thanks for all Your responses

Jerzy 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111102/ececef30/attachment.html>

Posted on the users mailing list.