-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscription interface: closed method #142
Comments
It's a getter, not a method. |
In that case, can it be a method, not a getter? Getters are slow, and |
get closed() : Boolean; A Boolean should always equal an equivalent Boolean, so I don't think your concerns about "Getters are slow" sounds like premature optimization, especially without a citation. Can you imagine a realistic situation where the difference in speed between a method and a getter would be meaningful with regard to |
@appsforartists Sorry my bad, but the question still stand, don't you think would be more clear using isClosed instead of closed? |
It might be good to look at other JS/DOM APIs to see if |
Cluster module: Buffer module Path module: Array: I can go ahead if you prefer, prefixing |
Are there any plain old JS or DOM APIs that also match this? The reason I bring that up is that Observables aren't made to integrate with the node ecosystem per-se, but for JavaScript as a whole. And the APIs in browsers are a big part of that.
The cases in the cluster module are compelling since these are getters that return the state of an object. It'd be cool if someone also had counter examples for getters returning the boolean state of an object. |
I mostly find myself using isSomethingCurrent or hasSomethingDone style of names. Reading this issue made to think that
Well English is not my first language, please correct me if following knowledge is not correct. I think we could consider Noun, Adjective, and Verb to decide. has[Past Verb], [Past Verb], is[Noun], is[Adjective], [Adjective] is suitable for boolean return.
|
@appsforartists wrote:
@appsforartists, you may be surprised to see what gets logged to the console by the following code:
The If the current API proposal is left unchanged, it means users will have to workaround the following rather surprising behavior:
See also #184. |
@mattflix that seems like a typo, honestly. |
Hi All
reviewing the proposal I'd suggest changing the
closed
method name toisClosed
that would suggest immediately that the method will return a boolean value.The text was updated successfully, but these errors were encountered: