rewrite-clj icon indicating copy to clipboard operation
rewrite-clj copied to clipboard

Bring more clarity to `tag`

Open lread opened this issue 3 years ago • 2 comments

The user guide and docstrings are vague around valid values for tag.

Abbreviated from chat with @NoahTheDuke on Slack:

Noah:

can the docs list the node types and give examples of given input to create one? There’s the Reader Macro Chars list but that's about how sexpr renders it. For an example of the potential confusion, I would naively expect that true/false/nil aren't “token” types, but they are.

Me:

Do you mean the type returned by the node’s tag?

Noah:

Yes, the keyword returned by the function rewrite-clj.node. A list of possible tags (and some description and inputs) would be very helpful.

Me:

Yeah I agree, that is part of the public interface but maybe not documented very well and maybe only incidentally mentioned. So I’m thinking the user guide and docstrings need a little updating.

lread avatar May 23 '22 12:05 lread

Related: https://github.com/clj-commons/rewrite-clj/issues/114#issuecomment-766174325

borkdude avatar May 23 '22 12:05 borkdude

Ok, no wonder I didn't go into details for this in the user guide. It means describing something that is pretty awkward to use without custom helpers. I think tackling #114 first and then documenting makes more sense than documenting current type interrogators.

lread avatar May 27 '22 21:05 lread