- From: youennf <notifications@github.com>
- Date: Wed, 01 Apr 2015 12:41:33 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/308/88606829@github.com>
These examples look all good as getters. I might be wrong but I think all of them do not change the state of the callee. You can call them multiple times, you will retrieve the same data, albeit different containers. Calling getReader changes the state of the stream in observal ways: calling getReader again will raise an exception. If getReader is called and the reference to the returned object is lost, you are screwed, there is no way you can get access to the data. I would not expect that from a getXX method. Acquire, take or any other similar name give a hint that you should take great care of the returned result. They also do not convey the idea that you are doing something safe. Oh well... maybe I am too much HTTP biased ;) 2015-04-01 15:12 GMT+02:00 Domenic Denicola <notifications@github.com>: > Indeed. Here are other methods that follow the getX() pattern and return a > new object every time: > > - From DOM: > - getElementsByTagName/getElementsByTagNameNS > - getElementsByClassName > - From HTML: > - PropertyNodeList.prototype.getValues > - Document.prototype.getElementsByName > - Document.prototype.getItems > - TextTrackCue.prototype.getCueAsHTML > - CanvasRenderingContext2D.prototype.getImageData/getImageDataHD > - CanvasDrawingStyles.prototype.getLineDash > - DataTransfer.prototype.getData > - DataTransferItem.prototype.getAsFile > > And that's just going through some IDL files... > > There are indeed a few instances where the same object could be returned, > e.g. getAttribute or getElementById. But there's definitely no consensus. > > Does this allay your concerns, @youennf <https://github.com/youennf>? > > — > Reply to this email directly or view it on GitHub > <https://github.com/whatwg/streams/issues/308#issuecomment-88474774>. > --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/308#issuecomment-88606829
Received on Wednesday, 1 April 2015 19:41:55 UTC