[plt-scheme] Combining scheme/serialize, structures, and macros?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Sat Feb 16 20:16:34 EST 2008

> I ran across a problem in one of my projects.  I've distilled the 
> problem into a toy example, so hopefully someone can tell me what I'm 
> doing wrong.
> :)


I don't quite understand why, but the attached hack into 
scheme/serialize.ss makes things "work" for me.

The issue seems hinged upon the fact that the deserialize-id that's 
attached to my serializing value has an identifier-transformer-binding 
rather than an identifier-binding in my constructed scenario... but I 
don't know why!  There's some confusion on my end about the phases: I 
don't know the root cause of the problem.

What I changed is from:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     (let ([b (identifier-binding deserialize-id)]) ...)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to a looser:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     (let ([b (or (identifier-binding deserialize-id)
                  (identifier-transformer-binding deserialize-id))]) ...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I am pretty darn sure this is not the right fix, but maybe it will help 
someone more expert in figuring out what the ultimate cause of the issue 
is?  With this hack, my test-compiler.ss's test-1 runs fine.
-------------- next part --------------
diff --git a/collects/scheme/private/serialize.ss b/collects/scheme/private/serialize.ss
index fd9a412..ca25f27 100644
--- a/collects/scheme/private/serialize.ss
+++ b/collects/scheme/private/serialize.ss
@@ -61,23 +61,24 @@
 	 (let ([id
 		(let ([path+name
 		       (cond
-			[(identifier? deserialize-id)
-			 (let ([b (identifier-binding deserialize-id)])
-			   (cons
-			    (and (list? b)
-				 (if (symbol? (caddr b))
-				     (caddr b)
-				     (protect-path
-				      (collapse-module-path-index 
-				       (caddr b)
-				       (build-path (serialize-info-dir info)
-						   "here.ss")))))
-			    (syntax-e deserialize-id)))]
-			[(symbol? deserialize-id)
-			 (cons #f deserialize-id)]
-			[else
-			 (cons
-			  (if (symbol? (cdr deserialize-id))
+                         [(identifier? deserialize-id)
+                          (let ([b (or (identifier-binding deserialize-id)
+                                       (identifier-transformer-binding deserialize-id))])
+                            (cons
+                             (and (list? b)
+                                 (if (symbol? (caddr b))
+                                     (caddr b)
+                                     (protect-path
+                                      (collapse-module-path-index 
+                                       (caddr b)
+                                       (build-path (serialize-info-dir info)
+                                                   "here.ss")))))
+                            (syntax-e deserialize-id)))]
+                        [(symbol? deserialize-id)
+                         (cons #f deserialize-id)]
+                        [else
+                         (cons
+                          (if (symbol? (cdr deserialize-id))
 			      (cdr deserialize-id)
 			      (protect-path
 			       (collapse-module-path-index 

Posted on the users mailing list.