The way I read it was the new function gets called instead of inner;<div><br></div><div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)">#lang racket</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"><br>
</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)">(define a%</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (class object%</span></font></div>
<div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (super-new)</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (define/pubment (hello)</span></font></div>
<div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (printf "Hello ")</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (inner 0)</span></font></div>
<div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (printf "!~n "))</span></font><span style="background-color:rgba(255,255,255,0);line-height:normal;font-size:small">))</span></div>
</div><div><br></div><div><br dir="ltr"></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)">(define b%</span></font><br></div><div><div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (class a%</span></font></div>
<div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (super-new)</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (define/augment (hello greg)</span></font></div>
<div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> ;Call super here?</span></font></div><div><font><span style="line-height:normal;background-color:rgba(255,255,255,0)"> (printf " ~a ~n" greg))))</span></font></div>
</div><div style><br></div>(send (new b%) hello "Bob")</div><div>-> Hello Bob!</div><div><br></div><div>Is this right?</div><div><br></div><div>Cheers, <span></span></div><div>Stephen</div><div><br><div><br><br>
On Monday, September 24, 2012, Gregory Woodhouse wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I am trying to understand how augmentable methods (as described in section 13.5 of The Guide) work.<div>
<br></div><div><span style="text-align:left;font-family:serif">Between the extremes of allowing arbitrary overriding and disallowing overriding entirely, the class system also supports Beta-style </span><span style="text-align:left;font-style:italic;font-family:serif">augmentable</span><span style="text-align:left;font-family:serif"> methods [</span><a style="text-align:left;font-family:serif">Goldberg04</a><span style="text-align:left;font-family:serif">]. A method declared with </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">pubment</a></span><span style="text-align:left;font-family:serif"> is like </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">public</a></span><span style="text-align:left;font-family:serif">, but the method cannot be overridden in subclasses; it can be augmented only. A </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">pubment</a></span><span style="text-align:left;font-family:serif"> method must explicitly invoke an augmentation (if any) using </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">inner</a></span><span style="text-align:left;font-family:serif">; a subclass augments the method using </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">augment</a></span><span style="text-align:left;font-family:serif">, instead of </span><span style="text-align:left;color:rgb(38,38,128);font-family:monospace"><a style="text-decoration:none;color:black">override</a></span><span style="text-align:left;font-family:serif">.</span><br>
<div><br></div><div><br></div><div>From this I conclude that if, for example, I have a class a% and a subclass b% and I want to augment a method of a% in b% I need to call inner in the definition of the method in a%, not b%. Something like this</div>
</div><div><br></div><div><div>#lang racket</div><div><br></div><div>(define a%</div><div> (class object%</div><div> (super-new)</div><div> (define/pubment (hello)</div><div> (printf "Hello~n")</div>
<div> (inner 0))))</div><div><br></div><div>(define b%</div><div> (class a%</div><div> (super-new)</div><div> (define/augment (hello)</div><div> ;Call super here?</div><div> (printf ", world!~n"))))</div>
</div><div><br></div><div><br></div><div>but this gives me an error (not really a surprise). My assumption is that super should be used in the subclass when overriding a method, but if a method is to be augmented any potential code in an augmenting class should be invoked from the superclass and super is not used in the subclass. Obviously, I'm missing something.</div>
</div></blockquote></div></div><br><br>-- <br><div> </div><div>--</div><div>Stephen De Gabrielle</div><div><a href="mailto:stephen.degabrielle@acm.org" target="_blank">stephen.degabrielle@acm.org</a></div><div>Telephone +44 (0)20 85670911</div>
<div>Mobile +44 (0)79 85189045</div><div><a href="http://www.degabrielle.name/stephen" target="_blank">http://www.degabrielle.name/stephen</a></div><div>----</div><div>Professor: Oh God! I clicked without reading! </div>
<div>Cubert: And I slightly modified something I own! </div><div>Professor: We're monsters!</div><br>