<div class="gmail_quote">On 16 July 2010 20:11, Mafi <span dir="ltr">&lt;<a href="mailto:mafi@example.org">mafi@example.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Am 16.07.2010 11:12, schrieb Heywood Floyd:<div class="im"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Lars T. Kyllingstad Wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I do agree that, if possible, the language should match how most people<br>
think.  But in this case, it is impossible, because of templates.  How<br>
would the following example work with T = int[3], if arrays worked the<br>
way you want?<br>
<br>
   struct MyArray(T)<br>
   {<br>
       T[] a;<br>
   }<br>
<br>
C doesn&#39;t have this issue, because it doesn&#39;t have templates.  And I&#39;ll<br>
have my templates over C-style array declarations any time, thank you. :)<br>
<br>
-Lars<br>
</blockquote>
<br>
<br>
Well, I suppose the obvious way is to introduce array as a proper type, and not<br>
just as syntactical sugar. For instance, consider:<br>
<br>
array[11] int myArr;<br>
</blockquote></div>
...<br>
<br>
I don&#39;t really like it. Of course the order of indices feels better but it breaks the rule of reading types from right to left. It also introduces more parenthesis and a new keyword into types (amongst const, immutable and delegate etc). Consider:<br>

  shared array[3](const( array[5] immuttable((SList!(int)*)[]) ))<br>
WTF, that doesn&#39;t look good. I would be a real type if your answer was accepted.<br>
<br>
It was<br>
  shared const( immutable(Slist!(int)*[])[5] )[3]<br>
which reads perfectly from right to left.<br>
<br></blockquote><div><br>So why all the extra parenthesis? Do you think they are required? Instead of:<br>shared array[3](const( array[5] immutable((SList!(int)*)[]) ))<br>consider this:<br>shared array[3] const array[5] immutable array (SList!(int)*)<br>
(or array[] instead of just array)<br><br></div><div>Actually, tbh I think they all look horrible. :-P I hope I never encounter such an impractical beast.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

What about this:<br>
  // int[width,height] as sugar for int[height][width]<br>
  int[width,height] arr = ...;<br>
  // arr[x,y] as sugar for arr[x][y]<br>
  int element = arr[x,y];<br>
  // then this works as expected<br>
  int[height] column = arr[x];<br>
</blockquote></div><br>That doesn&#39;t look too bad.<br><br>Groet,<br>Tim<br>