Description
There are a number of methods on REPLServer.prototype
that are clearly available in userland but are not documented. In at least a few cases, my impression is that these methods are attached to the prototype primarily in order to facilitate testing. I think this situation is non-ideal.
- Version: v6.2.2
- Platform: Darwin Lances-MacBook-Pro.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
- Subsystem: repl, doc
I have seen similar discussions as a part of various issues regarding "semi-private" properties that begin with an underscore on various other modules - though typically those conversations are tangential to the real issue.
This issue is similar - publicly accessible but undocumented properties. The pattern is not limited to REPLServer
, but since this is where I have spent most of my time in the code base, it's the one I'm most familiar with now, so for now, this conversation is limited to that module. However, I do think this should be discussed at a higher level and some guidance created for dealing with these "leaks".
As a rule, I would say that no methods should be attached to an object's prototype
that are undocumented. But it's not clear how to best deal with existing concerns.
Here is a list of the methods found on REPLServer.prototype
that are currently undocumented, but are fully accessible in userland.
REPLServer.prototype.close // inherited from readline.Interface
REPLServer.prototype.setPrompt // inherited from readline.Interface
REPLServer.prototype.createContext
REPLServer.prototype.resetContext
REPLServer.prototype.complete
REPLServer.prototype.parseREPLKeyword
REPLServer.prototype.memory
REPLServer.prototype.convertToContext
I can see why close
and setPrompt
may not be documented. Although, I think ideally some mention of them should be made in the REPL context since REPLServer
provides custom implementations of these methods. In my opinion, the others, however, should be refactored in such a way that they are not accessible in userland, or they should be documented.