-
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
Proposal: rename 'unsubscribe' to stop, or provide an alias #187
Comments
|
One or both of them would be useful alias or replacement names for |
You’re not really starting and stopping it though. You are for cold observables but you’re not for hot observables, they will keep publishing if you are subscribed or not. It’s shorter but not really semantically correct. |
open/close could be a good analogy too. |
@aboyton It's a question of starting and stopping what. While I think unclear language needs to be avoided, I was also did not immediately know what cold or hot observables are. I have come to this from writing my own evented code for a long time, then more recently have made it conform to what I see as a simple observable pattern. Rather than thinking about or using a large API, I have just had an object that raises events Wanting to make my code conform to appropriate standards, I went to look at what an observable officially is, and saw it's at the proposal stage here. I hope I am forgiven for my lack of knowledge of Observables, but as far as I sett it, it's yet to be settled what an Observable actually is anyway. Reading https://medium.com/@benlesh/hot-vs-cold-observables-f8094ed53339, I question whether a 'Producer' category of object is necessary, as it's just the flow of the code that results in Observable events being called. It reminds me of the 'Controller' part of 'MVC', where the overall structure of the code and of function calls is the Controller, without there needing to be any software component which actually has that name. Having looked into hot and cold observables, I disagree about With both 'hot' and 'cold' observables, would it be worth calling one of them a 'Subscription'? Is that term more appropriate to one than the other. I'm in favour of the TC39 committee thinking about what words that are more concise can be used to express as much information, and possibly more concise names that convey less information if they are still appropriate words. If the words are very observable-specific, it makes it harder to treat Observables as a generic class of objects that provides data in an ongoing way. I don't think TC39 has gone in for deliberately making shorter aliases of words or function names, but I suggest doing so in cases like this, where there could be a longer name like Possibly |
It sounds like your main argument is "I have to type 7 fewer characters when I manually unsubscribe," which is not a compelling one. The observable pattern is in the process of being standardized, but it's been implemented many times in userland (including in the massively popular RxJS). I'm not ipso facto against changing terminology, but I hope the barrier to do so is higher than "I don't like typing full words that are longer than 4 characters." |
RxJS breaks pretty often for making APIs more correct or when better ones are found so I don't think that's the case we should make. On the other hand I think the names we use are find and typing length isn't really an argument for a less-clear method name |
'Stop' is simpler language, and easier to type. It's got the information needed within the name, 4 letters rather than 11.
It would also raise possibilities of Subscription sharing more of an interface with other classes that have a simply named
.stop
method.The text was updated successfully, but these errors were encountered: