Check-in [413ff82ed0]

Login
FlightAware bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clarify private method name interactions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:413ff82ed019813c2c7e4f80bf22fc94010eab4c0a4beaaefe22631e7c30b788
User & Date: dkf 2018-05-28 16:08:39
Context
2018-05-28
16:17
Updated the abstract check-in: b619dfd132 user: dkf tags: trunk
16:08
Clarify private method name interactions. check-in: 413ff82ed0 user: dkf tags: trunk
13:29
Fix 474 header formatting: add tabs check-in: 91cbaab07a user: dkf tags: trunk
Changes

Changes to tip/500.md.

   104    104   Once the call chain is created, the execution is handled as prior to this TIP;
   105    105   the implementation of the first element on the call chain is executed,
   106    106   whatever that is, and that can dispatch to later items on the call chain using
   107    107   **next** and **nextto**.
   108    108   
   109    109   A private method on a class (or object) may not have the same name as another
   110    110   method on that class; all methods of a class (or object) are part of a single
   111         -space of names. When resolving a method call of a subclass of the class that
          111  +space of names. Creating a public or unexported method with the same name in
          112  +the same declaration context will delete the private method, just as it would
          113  +delete any other visibility of method defined on the same scope; this is
          114  +assumed to be a minor issue for most code as the methods on a particular class
          115  +(as opposed to its superclasses, subclasses or instances) are assumed to be
          116  +strongly cooperative with each other.
          117  +When resolving a method call of a subclass of the class that
   112    118   has the private method, even if the method names match, the private method
   113    119   does not participate in the call chain; only an exact match from exactly the
   114    120   right context counts.
   115    121   Applying **export** or **unexport** to a private method will make that method
   116    122   cease to be private, but it must be used on the same context (class or
   117    123   instance) that defined the method; subclasses or instances cannot export or
   118    124   unexport a private method defined by their superclass/class (respectively).
   119    125   There is no mechanism for making an existing method private; that needs to be
   120    126   done at method creation time.
          127  +Method declarations on other declaration contexts (e.g., on subclasses) do not
          128  +affect private methods at all. Private methods cannot be used for filter
          129  +implementations; the caller's context is not considered when resolving filters
          130  +so private methods are ignored (though a filter implementation may of course
          131  +call a private method).
   121    132   
   122    133   In particular:
   123    134   
   124    135       oo::class create Top {
   125    136           method Foo {} {
   126    137               puts "This is Top::Foo for [self]"
   127    138           }