Can anyone describe what *suppress-read* does? There's no doc in Clojure itself or on ClojureDocs, and I can't find much on the interwebs about it. It looks like it just drops the next read form, from looking at the implementation? I'm interested because of https://github.com/cursive-ide/cursive/issues/2979 where a user is getting a Record construction syntax can only be used when *read-eval* == true error. I see @tonsky had a similar issue (https://github.com/tonsky/clj-reload/issues/7), and his fix is here: https://github.com/tonsky/clj-reload/commit/fda9fcc47d22807ff9d98f91e0092ebaaa3174d9#diff-cdfc87b305797c63dfcac7960c34142a12df600dca825e95828099dfafab8bb2R35. However if my understanding is correct, that actually just drops the read form? That can't be right, and I'd like to understand this better.
Actually, no - the form dropping happens when parsing EDN. When parsing using read et al, it converts constructor forms into tagged literals. That is... interesting.
I think suppress-read is used for reader conditionals for dropping forms after a host branch is detected?
There's some code that suggests that that might be the case:
// When we already have a result, or when the feature didn't match, discard the next form in the reader
try {
Var.pushThreadBindings(RT.map(RT.SUPPRESS_READ, RT.T));
form = read(...);But I can't see anywhere that that flag is actually read in the Lisp reader, except here:
if(isPreserveReadCond(opts) || RT.suppressRead()) {
return TaggedLiteral.create(sym, form);
} else {
return sym.getName().contains(".") ? readRecord(form, sym, opts, pendingForms) : readTagged(form, sym, opts, pendingForms);
}
Which is inside CtorReader. That is actually the behaviour that I was interested in for my bug, but it is weird. And it's also weird that the flag seems to do different things when reading EDN.I'm not sure why it's exposed in clojure.core though