[html5] "internal slot"

Gomer Thomas gomer at gomert-consulting.com
Mon Apr 11 23:09:01 PDT 2016


       I searched a little further, and I found what purports to be a
definition of "internal slot" in the ECMAScript specification, but I'm still
not sure I understand what it means. The definition says:
              
              Internal slots correspond to internal state that is associated
with objects and used by various ECMAScript
              specification algorithms. Internal slots are not object
properties and they are not inherited. Depending upon the
              specific internal slot specification, such state may consist
of values of any ECMAScript language type or of
              specific ECMAScript specification type values. Unless
explicitly specified otherwise, internal slots are allocated
              as part of the process of creating an object and may not be
dynamically added to an object. Unless specified
              otherwise, the initial value of an internal slot is the value
undefined. Various algorithms within this specification
              create objects that have internal slots. However, the
ECMAScript language provides no direct way to associate
              internal slots with an object.
              
       As should be obvious by now, I am not very conversant with
ECMAScript, but I have worked with a number of other object environments.
What I have always seen in the past is that a Class is defined by specifying
the methods and the properties of the Objects in the Class. The methods have
arguments, each of which has a type associated with it. Methods can return a
value, which also has a type associated with it. The properties also have
types associated with them. The Class definition includes the semantics of
the methods and properties. If a Class is extended, the Objects in the
extension inherit the methods and properties of the original Class. I'm not
sure what to make of "slots".  It appears that they defined as part of the
Class definition, but they are not inherited by extensions. Thus, if one
Class is defined as an extension of another Class, any slots of the
extension need to be defined independently of the original Class. Is that
correct?
       
       In the Streams specification, I am particularly interested in the
ReadableStream class. As I understand it, Section 3.2.1 (Class Definition)
only provides a skeleton of the Class definition, and the rest of the
definition is contained in the remaining sub-sections of section 3.2. 
       I'm still pretty fuzzy about the "underlyingSource" object used in
the constructor. As far as I can tell, it must implement the methods
"start(controller)", "pull(controller)", "cancel(reason)", and it must have
the properties "type" and "autoAllocateChunkSize". It is not at all clear
what calls the "start(controller)" and "pull(controller)" methods, and where
the "controller" argument comes from. Are these supposed to be called by the
JavaScript code that created the ReadableStream object, or are they supposed
to be called by the ReadableStream object itself, or what?  Does the
"controller" argument come implicitly from the object in the
[[readableStreamController]] slot? As far as I can tell, this must be a
ReadableByteStreamController or a ReadableStreamDefaultController. The Class
definitions of these seem very vague. Is it true that these objects must be
implemented on an application-by-application basis, in order to provide the
desired functionality for the underlying source stream in the specific
application scenario? 
       
       Regards, Gomer Thomas
              
              --
              Gomer Thomas Consulting, LLC
              9810 132nd St NE
              Arlington, WA 98223
              Cell: 425-309-9933
              
              
              -----Original Message-----
       From: Help [mailto:help-bounces at lists.whatwg.org] On Behalf Of Gomer
Thomas
       Sent: Monday, April 11, 2016 9:30 PM
       To: 'Domenic Denicola' <d at domenic.me>; help at lists.whatwg.org
       Subject: Re: [html5] "internal slot"
              
                     Thanks for the response.
                      I found the statement "We use the notation x@[[y]] to
refer to internal slots of an object", but I could not find a definition of
what an "internal slot" is. What am I missing?
                     Regards, Gomer Thomas
                     --
                     Gomer Thomas Consulting, LLC
                     9810 132nd St NE
                     Arlington, WA 98223
                     Cell: 425-309-9933
                     
                     -----Original Message-----
              From: Domenic Denicola [mailto:d at domenic.me]
              Sent: Monday, April 11, 2016 3:25 PM
              To: Gomer Thomas <gomer at gomert-consulting.com>;
help at lists.whatwg.org
              Subject: RE: [html5] "internal slot"
                     
                     It is defined in
https://streams.spec.whatwg.org/#conventions.
                      
              
              _______________________________________________
              whatwg at whatwg.org
              https://whatwg.org/mailing-list#specs



More information about the Help mailing list