[plt-dev] feature request
A lot of libraries read in file content as lists (or S-expressions) of list-based structures (see csv on planet for one example, which I am currently incorporating to a small degree into 2htdp/batch-io). If I had this structure -- including in teaching languages -- I could easily 'view' these S-expressions/lists as structs, making for much more readable code.
-- Matthias
On Apr 14, 2010, at 4:59 PM, Robby Findler wrote:
> To help me understand the proposal: what do you get out of that, that
> you don't get from prefabs? (The only difference that jumps out at me
> is the the concrete syntax when these are marshalled; prefabs have a
> "#s(" prefix instead of just a "(" prefix; otherwise that is the
> same.)
>
> Robby
>
> On Wed, Apr 14, 2010 at 3:43 PM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
>>
>> 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.
>>
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-dev
>>