Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: f1cb51b4c1a4fc3792c931e947cb3abf996b0268
Ticket: 9d0cfbc51e3b6281aae4447c3603591dc0ec35d9
method [create] is handled very differently from other methods
User & Date: dkf 2014-01-27 12:01:47
Changes

  1. closedate changed to: "2456685.00124179"
  2. closer changed to: "dkf"
  3. icomment:
    Everything looks fine to me, and I've not done anything odd here for ages.
    <pre>
    % oo::class create creator {
        method moop {args} {
    	puts stderr "moop"
        }
        method create {args} {
    	puts stderr "create"
        }
        constructor {args} {
    	puts stderr "constructed"
        }
    }
    ::creator
    % creator ?
    unknown method "?": must be create, destroy or new
    % creator create fred
    constructed
    ::fred
    % fred ?
    unknown method "?": must be create, destroy or moop
    </pre>
    However, it should be noted that the <tt>create</tt> that you normally see is the one provided by the <i>class</i> object, not the instance object. It's actually a normal method that is implemented in C and defined on the <tt>oo::class</tt> class.
    <pre>
    % info class methods oo::class
    create new
    % info class methods oo::class -all
    create destroy new
    </pre>
    (The <tt>-all</tt> means use the superclass method implementations as well, so it picks it up from the <tt>oo::object</tt> class.)
    <p>
    Metaclasses are funky stuff.
    
  4. login: "dkf"
  5. mimetype: "text/html"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"
  8. subsystem changed to: "35. TclOO Package"
  9. username: "dkf"