Pairs certainly should be immutable. But I have to admit, I have run into a lot of trouble with the transition. <br><br>I've <a href="http://wavescope.csail.mit.edu/">got a DSL </a>implemented in Scheme that I run under Ikarus, Chez, and PLT. It's been ported to R6RS and thus uses mutable pairs. I've had lots of trouble with this R6 code subsequently
interacting (with various degrees of intentionality) with non-R6 Racket functionality. <br><br>I needed to have some modules in Racket-proper for super-R6 functionality. That's where I'd get into trouble. Macros and eval uses that crossed this boundary were painful. For example I would have an eval handler, that would get an environment sexp '(r6rs) that would violate its pair expectations. Or I would have mixups involving which version of syntax->datum was used. <br>
<br>It may not have been a problem if the code were new, as opposed to porting a legacy system. Anyway, Matthew Flatt patiently helped me through my brick-wall encounters.<br><br>By the way, is it on the horizon to have whole-program R6RS compiles that will verify that no mutable pairs are used and select the immutable ones? PLT seems to be the only R6 compiler in the position to do that...<br>
<br>Finally, mutable pairs are also cited as reason not to implement deforestation in Scheme compilers. I notice that <a href="http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_642">R6 is mindful</a> to ban both list mutation in map's (irrespective of pairs mutability) and leave evaluation order unspecified. Does that mean we get deforestation now?<br>
<br>Cheers,<br> -Ryan<br><br><br><br><br><div class="gmail_quote">On Sun, Jun 13, 2010 at 11:26 AM, Sam Tobin-Hochstadt <span dir="ltr"><<a href="mailto:samth@ccs.neu.edu">samth@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Sun, Jun 13, 2010 at 2:51 AM, Neil Van Dyke <<a href="mailto:neil@neilvandyke.org">neil@neilvandyke.org</a>> wrote:<br>
</div><div class="im">> 2. What was the rationale for not having "pair?", "car", "cdr", work on both<br>
> mutable pairs and immutable pairs? Was this to push everyone harder towards<br>
> immutable pairs, at the cost of having to convert legacy libraries and<br>
> breaking R5RS compatibility?<br>
<br>
</div>Having immutable and mutable pairs be distinct turns out to be very<br>
valuable for Typed Scheme/Racket. Mutable pairs support more<br>
operations, so in one sense they should be subtypes of pairs in<br>
general. But mutable pairs support fewer equations, and so cannot be<br>
used in places where immutable pairs are allowed, so cannot be treated<br>
as subtypes. This makes the story for hashtables, vectors and boxes<br>
much more complex, and I'm happy that it's not the case for pairs.<br>
<font color="#888888">--<br>
sam th<br>
<a href="mailto:samth@ccs.neu.edu">samth@ccs.neu.edu</a><br>
</font><div><div></div><div class="h5">_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
</div></div></blockquote></div><br>