ChucK often seems inspired by Java, and I suspect that&#39;s the case here.  Static functions and variables in Java works just like you describe for ChucK - the class is here basically just a kind of namespace that wraps the methods and variables, since they live outside the object oriented world of instances.<div>
<br></div><div>In Java, static items are always specified using that namespace, e.g.:</div><div><br></div><div>class A {</div><div> static int v;</div><div>}</div><div><br></div><div>int b = A.v;</div><div><br></div><div>
Inside classes, you can omit the class name, which is implied:</div><div><br></div><div>class A {</div><div>  static int v;</div><div><br></div><div>  int f() {</div><div>    int b = v;</div><div>  }</div><div>}</div><div>
<br></div><div>You can reuse a static name in a subclass. However, this is not the same as overloading, since you always specify the class containing the static member, and if you don&#39;t specify it it is implied that it is in the same class:</div>
<div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055">public<span style="color: #000000"> </span>class<span style="color: #000000"> A {</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>static<span style="color: #000000"> </span>int<span style="color: #000000"> f() {</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>return<span style="color: #000000"> 1;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">        </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #7f0055">static</span> <span style="color: #7f0055">int</span> test() {</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">return</span> f();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">}</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055">
public<span style="color: #000000"> </span>class<span style="color: #000000"> B </span>extends<span style="color: #000000"> A {</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>static<span style="color: #000000"> </span>int<span style="color: #000000"> f() {</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #7f0055"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>return<span style="color: #000000"> 2;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">        </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #7f0055">static</span> <span style="color: #7f0055">int</span> test() {</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">return</span> f();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">}</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">A.test() will return 1 and B.test() will return 2. This code would work exactly the same if we removed the extends - static code bypasses the object stuff.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">Maybe the ChucK people thought this behaviour might make for hard-to-read code, and simply banned reuse of static method names? There is no other reason I can see why this isn&#39;t allowed. I&#39;m personally a bit confused abut the static concept in ChucK, since we can put stuff on &quot;the ground&quot; outside class space, but maybe it&#39;s useful for the include file trick.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">/Stefan</p><p></p></div><div><br></div><div><br><div class="gmail_quote">On Tue, Sep 8, 2009 at 6:06 PM, Kassen <span dir="ltr">&lt;<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Stefan;<br>
<div class="im">&gt; I forget - what separates static functions from other kinds of functions?<br>
<br>
</div>They can only reference other static members and variables. That may<br>
sound like a downside but it also means they can be called without a<br>
object instance.<br>
<br>
This becomes useful in the case of functors (see the recent forum<br>
discussion), for example. Right now if we want overloading we also<br>
must create object instances of all extended classes. Right now this<br>
isn&#39;t much of a issue aside from me finding those extra lines ugly<br>
because they don&#39;t actually do anything useful (well, aside from<br>
making it work at all), but I anticipate problems if/when the much<br>
desired include functionality would get here.<br>
<br>
I would like to be able to extend classes without needing a object<br>
instance when instances don&#39;t actually do anything meaningful in the<br>
case that I might have.<br>
<br>
To me this seems like a solid case but it wouldn&#39;t be the first time<br>
that the nice people with &quot;.cs.&quot; in their email address would expose<br>
me for the hack that I am ;-). The error message implies that the<br>
matter has been given some thought but I don&#39;t get what the reasoning<br>
is.<br>
<div><div></div><div class="h5"><br>
Kas.<br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!<br>
</div>