<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=windows-1252"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Jonathan and others,<br>
<br>
Existing C# code didn't works for subclass at the moment (Dictionary
with Type as key). And if it works for subclasses in Java, the priority
problem remains...<br>
<br>
My 2 cents ..  ;-)<br>
<br>
Thanks<br>
<br>
Vincent<br>
<br>
<br>
Jonathan Buhacoff wrote:
<blockquote cite="mid:523F403F-023E-42CD-AB84-9C4EB56824BF@buhacoff.net"
 type="cite">The existing ST code already works for subclasses.  My
implementation of the interface renderer also works for subclasses that
implement the same interface, but not because I did anything special -
we get this from the language itself and from the renderer
implementation, if it uses instanceof. 
  <div><br>
  </div>
  <div>I like the idea of using isInterface to automatically separate
the two kinds of renderers for later, but then the programmer can't
control which interface renderer will apply to a value that implements
more than one registered interface.</div>
  <div><br>
  </div>
  <div>If the code were changed to add to a list instead of a
map/dictionary, the programmer could control priority but then you have
the same performance problem that you mentioned, plus the programmer
will be forced to register interface-based handlers in order, which is
not consistent with the current registration interface.  </div>
  <div><br>
  </div>
  <div>If it's implemented with a map or dictionary I would warn users
not to use values that implement more than one registered interface
because the behavior will not be predictable. This may be the simplest
route.</div>
  <div><br>
  </div>
  <div>
  <div><br>
  <div apple-content-edited="true"> <span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="">
  <div>
  <div>--</div>
  <div>Jonathan Buhacoff</div>
  <div><a moz-do-not-send="true" href="mailto:jonathan@buhacoff.net">jonathan@buhacoff.net</a></div>
  <div>--</div>
  <div><br>
  </div>
  </div>
  </div>
  </span></div>
  </span><br class="Apple-interchange-newline">
  </div>
  <br>
  <div>
  <div>On Oct 23, 2009, at 6:52 PM, Sam Harwell wrote:</div>
  <br class="Apple-interchange-newline">
  <blockquote type="cite"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
    <div bgcolor="white" link="blue" vlink="purple" lang="EN-US">
    <div class="Section1">
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">This
semi-solves one problem, but doesn’t address another at all. What if
you want to add a renderer for “[non-interface] type X and all types
derived from X”? Also, it still doesn’t address the performance issue
of the feature itself. Below is one way it could be implemented without
changing the public interface.<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Covered:<o:p></o:p></span></div>
    <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Symbol; color: rgb(31, 73, 125);"><span>·<span
 style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">        <span
 class="Apple-converted-space"> </span></span></span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Performance
when the feature is not in use<o:p></o:p></span></p>
    <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Symbol; color: rgb(31, 73, 125);"><span>·<span
 style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">        <span
 class="Apple-converted-space"> </span></span></span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Registering
renderers for interface type<o:p></o:p></span></p>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Not
covered:<o:p></o:p></span></div>
    <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Symbol; color: rgb(31, 73, 125);"><span>·<span
 style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">        <span
 class="Apple-converted-space"> </span></span></span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Performance
implication when a renderer is registered for an interface type<o:p></o:p></span></p>
    <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Symbol; color: rgb(31, 73, 125);"><span>·<span
 style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">        <span
 class="Apple-converted-space"> </span></span></span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Registering
renderers for a base type and having it also apply to derived types<o:p></o:p></span></p>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">   <span
 class="Apple-converted-space"> </span><span style="color: blue;">public</span><span
 class="Apple-converted-space"> </span><span style="color: blue;">virtual</span><span
 class="Apple-converted-space"> </span><span style="color: blue;">void</span><span
 class="Apple-converted-space"> </span>RegisterRenderer(<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">Type</span><span
 class="Apple-converted-space"> </span>attributeClassType,<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span><span
 class="Apple-converted-space"> </span>renderer )<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">    {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">Dictionary</span>&lt;<span
 style="color: rgb(43, 145, 175);">Type</span>,<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span>&gt;
renderers;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: green;">//
renderers for interface types are kept separately due to their
performance implications<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>(!attributeClassType.IsInterface)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>(_attributeRenderers ==<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">               
_attributeRenderers =<span class="Apple-converted-space"> </span><span
 style="color: blue;">new</span><span class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">Dictionary</span>&lt;<span
 style="color: rgb(43, 145, 175);">Type</span>,<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span>&gt;();<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">            renderers =
_attributeRenderers;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">else<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>(_interfaceRenderers ==<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">               
_interfaceRenderers =<span class="Apple-converted-space"> </span><span
 style="color: blue;">new</span><span class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">Dictionary</span>&lt;<span
 style="color: rgb(43, 145, 175);">Type</span>,<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span>&gt;();<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">            renderers =
_interfaceRenderers;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       
renderers[attributeClassType] = renderer;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">    }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">   <span
 class="Apple-converted-space"> </span><span style="color: blue;">public</span><span
 class="Apple-converted-space"> </span><span style="color: blue;">virtual</span><span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span><span
 class="Apple-converted-space"> </span>GetAttributeRenderer(<span
 class="Apple-converted-space"> </span><span
 style="color: rgb(43, 145, 175);">Type</span><span
 class="Apple-converted-space"> </span>attributeClassType )<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">    {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        <span
 style="color: rgb(43, 145, 175);">IAttributeRenderer</span><span
 class="Apple-converted-space"> </span>renderer =<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span>;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>( _attributeRenderers !=<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span><span
 class="Apple-converted-space"> </span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>(
!_attributeRenderers.TryGetValue( attributeClassType,<span
 class="Apple-converted-space"> </span><span style="color: blue;">out</span><span
 class="Apple-converted-space"> </span>renderer ) )<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">               
renderer =<span class="Apple-converted-space"> </span><span
 style="color: blue;">null</span>;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: green;">//
Only need to perform the expensive interface checks if the user
registered a renderer for an interface type<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>(renderer ==<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span><span
 class="Apple-converted-space"> </span>&amp;&amp; _interfaceRenderers !=<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">            renderer =
_interfaceRenderers.FirstOrDefault(pair =&gt;
pair.Key.IsAssignableFrom(attributeClassType)).Value;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>( renderer !=<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span><span
 class="Apple-converted-space"> </span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: green;">//
found it!<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: blue;">return</span><span
 class="Apple-converted-space"> </span>renderer;<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: green;">//
we have no renderer overrides for the template or none for class arg<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: green;">//
check parent template if we are embedded<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">if</span><span
 class="Apple-converted-space"> </span>( _enclosingInstance !=<span
 class="Apple-converted-space"> </span><span style="color: blue;">null</span><span
 class="Apple-converted-space"> </span>)<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        {<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">           <span
 class="Apple-converted-space"> </span><span style="color: blue;">return</span><span
 class="Apple-converted-space"> </span>_enclosingInstance.GetAttributeRenderer(
attributeClassType );<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">        }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: green;">//
else check group<o:p></o:p></span></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">       <span
 class="Apple-converted-space"> </span><span style="color: blue;">return</span><span
 class="Apple-converted-space"> </span>_group.GetAttributeRenderer(
attributeClassType );<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 8pt; font-family: Consolas;">    }<o:p></o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><o:p> </o:p></span></div>
    <div>
    <div
 style="border-style: solid none none; border-top: 1pt solid rgb(181, 196, 223); padding: 3pt 0in 0in;">
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><b><span
 style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:</span></b><span
 style="font-size: 10pt; font-family: Tahoma,sans-serif;"><span
 class="Apple-converted-space"> </span><a moz-do-not-send="true"
 href="mailto:stringtemplate-interest-bounces@antlr.org"
 style="color: blue; text-decoration: underline;">stringtemplate-interest-bounces@antlr.org</a><span
 class="Apple-converted-space"> </span>[<a moz-do-not-send="true"
 href="mailto:stringtemplate-interest-bounces@antlr.org"
 style="color: blue; text-decoration: underline;">mailto:stringtemplate-interest-bounces@antlr.org</a>]<span
 class="Apple-converted-space"> </span><b>On Behalf Of<span
 class="Apple-converted-space"> </span></b>Jonathan Buhacoff<br>
    <b>Sent:</b><span class="Apple-converted-space"> </span>Friday,
October 23, 2009 6:55 PM<br>
    <b>To:</b><span class="Apple-converted-space"> </span>StringTemplate
Mailing List<br>
    <b>Subject:</b><span class="Apple-converted-space"> </span>Re:
[stringtemplate-interest] IAttributeRendererand Type Inheritancein C#<o:p></o:p></span></div>
    </div>
    </div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;">Hi
Sam,<o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;">My
last suggestion solves the performance and priority issues:<o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 class="apple-style-span">A separate method for setting a list of
interface renderers  </span><o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;">Something
like:  public void setRenderers(List&lt;AttributeRenderer&gt; renderers)<o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;">Then
in StringTemplate this list of renderers would be checked only if a
class renderer wasnt found.<o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;">Performance
issues would then only affect people using this feature.<o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"> <o:p></o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><o:p> </o:p></div>
    </div>
    <div>
    <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><br>
Sent from my iPhone<o:p></o:p></div>
    </div>
    <div>
    <p class="MsoNormal"
 style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><br>
On Oct 22, 2009, at 9:10 PM, "Sam Harwell" &lt;<a moz-do-not-send="true"
 href="mailto:sharwell@pixelminegames.com"
 style="color: blue; text-decoration: underline;">sharwell@pixelminegames.com</a>&gt;
wrote:<o:p></o:p></p>
    </div>
    <blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
      <div>
      <div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Hi
Vincent and Jonathan,</span><o:p></o:p></div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span><o:p></o:p></div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I
can’t tell who said what here due to the way your editors formatted the
text. I thought about a possible solution to the performance problems I
mentioned, but I don’t think it will be viable. I thought about always
caching the results of the lookup, so object interfaces would only need
to be checked the first time a type was used in a template.
Unfortunately, due to the way templates inherit attribute renderers,
several problems emerge:</span><o:p></o:p></div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span><o:p></o:p></div>
      <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">1.</span><span
 style="font-size: 7pt; color: rgb(31, 73, 125);">      <span
 class="Apple-converted-space"> </span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Caching
the renderers would result in a copy of all type-&gt;renderer maps in
every template, incurring both a space and time overhead.</span><o:p></o:p></p>
      <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">2.</span><span
 style="font-size: 7pt; color: rgb(31, 73, 125);">      <span
 class="Apple-converted-space"> </span></span><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Caching
the renderers would break the attribute renderer inheritance scheme.</span><o:p></o:p></p>
      <p class="MsoListParagraph"
 style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">3.</span><span
 style="font-size: 7pt; color: rgb(31, 73, 125);">      <span
 class="Apple-converted-space"> </span></span><i><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Not</span></i><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><span
 class="Apple-converted-space"> </span>caching the renderers would mean
checking all interface base types and interfaces while walking up the
template inheritance chain. This would be a more substantial hit than
GetAttribute, likely more than doubling the time required to render
templates. I’ll profile this to make sure, but if my analysis proves
correct the feature will have to be completely reengineered before we
could talk about incorporating it into the library.</span><o:p></o:p></p>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span><o:p></o:p></div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"><span
 style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Sam</span><o:p></o:p></div>
      <div
 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman',serif;"> <o:p></o:p></div>
      </div>
      </div>
    </blockquote>
    </div>
    </div>
    </span></blockquote>
  </div>
  <br>
  </div>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
stringtemplate-interest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:stringtemplate-interest@antlr.org">stringtemplate-interest@antlr.org</a>
<a class="moz-txt-link-freetext" href="http://www.antlr.org/mailman/listinfo/stringtemplate-interest">http://www.antlr.org/mailman/listinfo/stringtemplate-interest</a>
  </pre>
</blockquote>
<br>
</body>
</html>