[CM] metadata on vectors?

Gregg Reynolds dev at mobileink.com
Sun Jul 25 15:05:04 PDT 2021


Hi,

A Starlark "string list" looks like this:  ["a", "b", "c"]

I'm converting this into a Scheme vector of c-objects; the custom c-object
lets me keep track of position metadata (line,col), so my parser/emitter
can round-trip, emitting output that exactly matches the input.

The problem is that I need to keep track of the positions for the string
list brackets. Those are nodes in the AST, as are the commas in the list,
but I'm omitting them from the vector, it doesn't make much sense for a
string vector to include punctuation. I can add metadata for the commas to
the custom string nodes, but that leaves the bracket delimiters.

 The easy way to do that would be to add the info as metadata on the Scheme
vector. Is there a way to do that with s7?  I've been looking at the "let"
stuff but I don't see a way to do it.  I see that c-objects have an
"object-let", and (object->let  myvec) returns an inlet, but I don't see
how to elaborate the object-let of a Scheme vector.

(I'm trying to avoid writing custom c-type code for my lists.)

Thanks,

Gregg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20210725/1d077c76/attachment.html>


More information about the Cmdist mailing list