Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2483419afc960a6deb89bf89e6d04f8989ab580b
Ticket: 1863645fffffffffffffffffffffffffffffffff
Rename method constructors in C-API to avoid confusion
User & Date: mpc_janssen on 2008-01-03 23:19:06
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Before starting I will define some terminology (which is similar to terminology in Smalltalk/Ruby/XOTcl and probably more)
    
    Object: everything is an object so classes and instances are also objects
    Class: A class can create instance objects and contains the behavior of the instances
    Instance: An instance is an object create by a class
    Instance method: A method that can be called on a instance of a class and which is defined in the class
    Object method: A method defined on a single object (either a class or an instance)
    Singleton/Self method: Equivalent to Object method
    Class/Static method: A method that is an object method of a class. This is a special case of the Object method if the object is also a class.
    
    Looking at the Tcl API, 
    object methods are defined using self.method
    instance methods are defined using method
    
    Looking at the C-API
    object methods are defined using Tcl_NewMethod.
    instance methods are defined using Tcl_NewClassMethod
    
    notice how the name of the instance method function causes confusion with the definition of Class/Static method as defined above. A Class/Static method would be defined using Tcl_NewMethod on the class object.
    
    To avoid this confusion I think it would be benificial to rename the two commands to:
    Tcl_NewMethod -> Tcl_NewObjectMethod/Tcl_NewSelfMethod
    Tcl_NewClassMethod -> Tcl_NewInstanceMethod
     
    
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "mpc_janssen"
  10. subsystem changed to: "35. TclOO Package"
  11. title changed to:
    Rename method constructors in C-API to avoid confusion
    
  12. type changed to: "RFE"