<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://www.tcl.tk/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Sun Feb 12 12:13:59 GMT 2012 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='354'>
<header><title>Minor Production-Driven TclOO Revisions</title><author address="mailto:dkf@users.sf.net">Donal K. Fellows</author><status type='project' state='final' tclversion="8.6" vote='after'>$Revision: 1.4 $</status><history></history><created day='26' month='aug' year='2009' /></header>
<abstract>This TIP describes a few small changes required for solving issues that have been found when using TclOO in production.</abstract>
<body><section title="Description">
<para>TclOO (see <tipref type="text" tip="257"/>) has now had a substantial amount of use for relatively complex functionality (as well as production deployment) and it has turned out that there were a few small changes required.</para>
<enumerate><item.e index='1'><para>The scope of resolution for the target of a <emph style="bold">forward</emph>ed method is updated so that it is with respect to the object&apos;s namespace. This means that a class may create methods that forward to a command given by each instance, which makes creating megawidgets by wrapping real Tk widgets much easier, since the forwards do not have to be created at the instance level.</para></item.e><item.e index='2'><para>A subcommand was added to <emph style="bold">info object</emph> to allow the discovery of the namespace of an object by code outside that object. This makes it far easier for code that needs to &quot;break the abstraction&quot; to do so, which turns out to be necessary for things like serialization. This subcommand, <emph style="bold">namespace</emph>, takes an object name as its only argument and returns the name of the object&apos;s namespace.</para><para>To expand on the requirements for serialization, the serialization code needs to call a method on each object to create the serialization for that object. However, the method should not be part of the public API for the object as it cannot perform a complete serialization correctly, since the serialization depends on the rest of the object graph. (It also requires a number of global overheads that are best applied once, not repeatedly.)</para><para>Note that I plan to release the serialization code itself (originally developed as part of a solution for a Rosetta Code task) as a package via tcllib. This TIP does not propose its inclusion with Tcl.</para></item.e><item.e index='3'><para>A new C API function has been added to allow code at that level to <emph style="italic">efficiently</emph> discover the name of an object that it already has a handle to. This new function, <emph style="bold">Tcl_GetObjectName</emph>, returns a shared Tcl_Obj reference to the name that needs no special reference count management.</para></item.e></enumerate>
</section>
<section title="Copyright">
<para>This document has been placed in the public domain.</para>
</section>
</body></TIP>

