Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in Metadata by

Reader metadata is attached to IObj forms at read time, but if the form is quoted, then the quote form gets the metadata and the quoted form doesn't get the metadata. This means that to attach metadata to forms, you need to write the slightly awkward quote -> metadata -> form instead of the (imo) more natural metadata-> quote -> form.

user=> (meta ^:foo '(1 2 3))
{:line 1 :column 1}
user=> (meta '^:foo (1 2 3))
{:lime 1 :column 1 :foo true}

I know that this is because ' is implemented as a "WrappingReader" and so the former is read as ^:foo (quote (1 2 3)) but that feels like an implementation detail leaking through. I think it would be helpful/more consistent if quote passed any metadata to IObjs.

Please log in or register to answer this question.

...