Naming convention: Visitors / event-handlers?
See original GitHub issueThis is not a bug report, just a discussion about documentation, or rather, naming. I was wondering what the name of the type of function associated with Identifier
in the following example is.
return {
"Identifier": function(node) {}
};
I know that Babel uses the term Visitor
, as related to the visitor pattern, but couldn’t find a definitive, or explicit answer in the documentation.
I’ve been reminded that the term visit
is used at some point in the docs, and events
in some other place.
I personally like the term visitor
, which is consistent with Babel (the use of visitors seems to have kind of the same purpose too). The term event handler
speaks less to me.
I’ve asked the question in the Gitter chat, and been asked to create an issue, so that an explicit name could maybe get chosen, and reflected in the documentation.
(cc @pedrottimark @platinumazure)
Note: for context, I wanted to create a project that simplifies writing rules for some cases I encounter, and was therefore looking for an appropriate name.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Right now, we only inferred “Visitor” because there is one word
visit
buried in the middle of the third paragraph of that section. I don’t think it would hurt to make it a bit more clear, but I have no concrete proposal at this time. Since documentation PRs don’t require an issue, I think we can let this stay closed since @jfmengels has received an answer to the question raised.Right. I meant more like clarifying the documentation. I’ll close this, someone can reopen it if needed.