[plt-dev] feature request

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 14 16:43:29 EDT 2010

I would like to request another form of structure and I am almost willing to argue that we got #:prefab not quite right. 

Proposed option: 

 #:list 

It's basically like #:prefab but: 

 (define-struct x (a b) #:list) 

introduces a constructor that creates a tagged list: (make-x 10 20) = (list 'x 10 20). The selectors check for the 'x tag and extract the values from the a and b fields as usual. (x-a (make-x 10 20)) = 10. If mutability is specified you get mcons instead of cons. 

I think this would be highly useful for turning reading and writing S-expressions and communicating via S-expression protocols. It's kind of like "XML lite". -- Matthias

p.s. With a bit more work, one could even get type guarantees in TS modules and use generative structures when they flow to untyped modules. 



Posted on the dev mailing list.