<div dir="ltr"><br><div class="gmail_quote">eduard;<br><br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">What do you think?<br>
</blockquote><div><br>I tried a few things but I&#39;m a bit stuck here as well. Right now, unless I&#39;m very mistaken, this looks to me like it&#39;s indeed wrong and another expression of something being wrong in the type-system where arrays are concerned. <br>
</div></div><br>Here in particular array types don&#39;t seem respect extending of classes, type-wise. I Hacked up your class structure for a bit, having Point1D extend Point and Point2D extend Point1D, etc but that didn&#39;t help.<br>
<br>I ended up writing a small trivial test case. I feel this should work, it should print a series of 3 zeros.... yet it doesn&#39;t;<br><br>//==================-8&lt;======================-<br>class bar<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; int value;<br>
&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>class baz extends bar<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; }<br><br>baz foo[3];<br><br>fun void print( bar p[])<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; for(0 =&gt; int n; n&lt;p.cap(); n++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;&lt;&lt;p[n].value&gt;&gt;&gt;;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>print(foo);<br>//==========================<br><br>To prove my case, consider this trivial case;<br>//========================<br>class bar<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; int value;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>class baz extends bar<br>
&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; }<br><br>baz foo;<br><br>fun void print( bar p)&nbsp;&nbsp;&nbsp; &lt;&lt;&lt;p.value&gt;&gt;&gt;;<br>&nbsp;&nbsp;&nbsp; <br>print(foo);<br>//===================<br><br>...which does fly; foo is a &quot;baz&quot; which is in turn a &quot;bar&quot;. Elements of arrays of this type should be the same.<br>
<br>I suspect this is a clearer example of a case I ran into some months ago but it wasn&#39;t clear to me back then what aspect caused the issue (reported back then straight to Ge for reasons I can&#39;t quite recall). I&#39;d say the issue isn&#39;t passing arrays as arguments as such (this is fine) but the type of array elements that are instances of classes of that extend another class. Their type will only become a real issue when they are passed to functions as variables of the mother type, hence your issue here.<br>
<br>I&#39;m a bit surprised this doesn&#39;t seg-fault, I think mine did back then.<br><br>Anyway; I say it&#39;s a type-system bug in arrays.<br><br>Nice catch, I&#39;m fairly sure this one has been in there for a while but was hard to pinpoint. It seems to be a good season for hunting!<br>
<br>Yours,<br>Kas.<br></div>