[racket-dev] shared no longer works on cons?!?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Oct 20 23:32:50 EDT 2011


  In case you didn't follow the implication of Ryan's message, you can
the diff below to your tree and your program below will run (I tested
by applying the diff to the latest git version, but I think it will
still work for 5.1.3.)

If you wish, you can make a .plt file that you can distribute to your
students via a web page (they would have to use File|Install .plt file
to install it), that will also apply this diff to their installations
of 5.1.3 (I suggest you also put something into the .plt file that
changes the version number to avoid possible confusion).

I hope this helps.


[robby at yanpu] ~/git/plt/collects/deinprogramm$ git diff
diff --git a/collects/deinprogramm/signature/signature-unit.rkt
index 2059bb7..c608317 100644
--- a/collects/deinprogramm/signature/signature-unit.rkt
+++ b/collects/deinprogramm/signature/signature-unit.rkt
@@ -5,7 +5,7 @@

 (require scheme/promise
-         (only-in racket/list first rest)
+         (only-in mzlib/list first rest)
         (for-syntax scheme/base)
         (for-syntax stepper/private/shared))

[robby at yanpu] ~/git/plt/collects/deinprogramm$

On Thu, Oct 20, 2011 at 9:38 PM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> According to my class notes from last year, the following examples
> worked just fine in ASL:
> (define web-colors
>  (shared ([W (cons "white" G)]
>           [G (cons "grey" W)])
>    W))
> ; Will fail with error:
> ; (length web-colors)
> (check-expect (equal? web-colors (rest web-colors)) false)
> (check-expect (equal? web-colors (rest (rest web-colors))) true)
> (check-expect (first web-colors) "white")
> (check-expect (first (rest web-colors)) "grey")
> (check-expect (first (rest (rest web-colors))) "white")
> (check-expect (first (rest (rest (rest web-colors)))) "grey")
> (check-expect (first (rest (rest (rest (rest web-colors))))) "white")
> (check-expect (first (rest (rest (rest (rest (rest web-colors)))))) "grey")
> Yet none of these work any longer:
>> (first web-colors)
> first: expects a non-empty list; given (shared ((-0- (cons "white"
> (cons "grey" -0-)))) -0-)
>> (rest web-colors)
> rest: expects a non-empty list; given (shared ((-0- (cons "white"
> (cons "grey" -0-)))) -0-)
> When did this change occur?  And more importantly, what is the use of
> letting cons to be written inside shared if you can't extract it?  How
> else is one supposed to extract from cons if not using first/rest?
> (Oddly, list-ref seems to work for extraction even though first and
> rest do not.  I can anticipate numerous questions -- to which I don't
> know the answer -- as to why this is the case.)
> Several of my next few lectures depend on this working, so I'm a
> little dismayed by this.
> Shriram
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.