| Store | Cart

Re: [TCLCORE] Itcl method resolution help needed

From: Griffin, Brian <bria...@mentor.com>
Fri, 16 Jan 2015 23:45:22 +0000
On Jan 16, 2015, at 10:01 AM, Donald G Porter <dona...@nist.gov> wrote:

> > Over at our pastebin, I've posted an example to illustrate what appears> to me to be an inconsistency if not outright brokenness in Itcl method> resolution.  If this is not in fact broken, I need someone familiar> with Itcl coding expectations to explain things to me, or point me to> whatever tutorial already exists that explains it.> > http://paste.tclers.tk/3400> > The unfortunate follow on for me is that the Itcl test suite checks> for this behavior that appears utterly broken to me.> > This broken behavior is also difficult to replicate on top of a TclOO> base, so the attempts to keep the test suite passing these tests in> Itcl 4 have created a fairly messy situation that also creates its own> new bugs, like the one that led me down this rabbit hole in the first> place.> > http://core.tcl.tk/itcl/tktview/a956a5d397> > Without some guidance to any actual wisdom here, I'm strongly inclined> to leave Itcl 3 as it is, but to cut off this expectation in Itcl 4,> and give it sane method resolution rules and revised tests that match> them.> > Anyone who sees trouble in that plan, I'd really appreciate some> assistance here.  This is the last bug I'm attempting to stomp before> getting Itcl 4.0.3 out the door.

I believe the behavior is correct.  The reason being that [info] is not a method but rather an intrinsic command.  Some subcommands provide information specific to the particular method or class, not the object.  How else can the code determine that this "do" method is Base's method and not some other derived implementation?

>From the man page, I've highlighted the relevant wording with **:
(http://docs.activestate.com/activetcl/8.5/itcl/class.n.html)

/objName/ info option ?args...?

  Returns information related to 

->    a *particular object* named /objName/, 
->    or to its *class definition*. 

  The option parameter includes the following things, as well as the options 
  recognized by the usual Tcl "info" command:

  /objName/ info class
    Returns the name of the *most-specific class for object /objName/*.

  /objName/ info inherit
    Returns the list of base classes as they were defined in the "inherit" 
    command, or an empty string if *this class* has no base classes.

  /objName/ info heritage

    Returns the *current class name* and the entire list of base classes in 
    the order that they are traversed for member lookup and object destruction.



------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

Recent Messages in this Thread
Donald G Porter Jan 16, 2015 06:01 pm
Arnulf Wiedemann Jan 16, 2015 09:27 pm
Griffin, Brian Jan 16, 2015 11:45 pm
Don Porter Jan 17, 2015 12:07 am
Messages in this thread