Re: Multi dimensional array question.

2010-07-16 Thread Tim Verweij
On 16 July 2010 20:11, Mafi wrote: > Am 16.07.2010 11:12, schrieb Heywood Floyd: > > Lars T. Kyllingstad Wrote: >> >> I do agree that, if possible, the language should match how most people >>> think. But in this case, it is impossible, because of templates. How >>> would the following exampl

Re: Multi dimensional array question.

2010-07-16 Thread Tim Verweij
On 16 July 2010 11:12, Heywood Floyd wrote: > Lars T. Kyllingstad Wrote: > (...) > > When we introduce templates, this should still work: > > struct MyArray(T){ > array[3] T a; > } > > // Let's try > T == array[11] int > > array[3] T a; > array[3] (array[11] int) a; > array[3] array[11] a; > ar

Re: const and immutable

2010-07-06 Thread Tim Verweij
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > I'm not positive, but I think the second const applies to the second > function, I think you meant: > const Bar& GetBar() const { return mBar; } Uh, yes, of course. Pff, I feel bad for making such an embarrasing mistake. > And ye

Re: const and immutable

2010-07-06 Thread Tim Verweij
Not sure if I'm double posting now. Sorry if I am, but I didn't see my own post appear this time. Anyway, thanks for your replies, that was very helpful. I had one more question about inout. If I understand correctly it cannot be used to get rid of the double GetBar function in the following C++

Re: const and immutable

2010-07-06 Thread Tim Verweij
Thanks for all replies, that was very helpful. I have one more question about inout. If I understand correctly, it is always coupled to the use of a parameter and cannot be used to get rid of the double GetBar in the following C++ example: class Foo { public: const Bar& GetBar() { return bar; }

const and immutable

2010-07-06 Thread Tim Verweij
Hey all, I'm having some trouble understanding the whole const and immutable of D2, especially since it seems documentation is not consistent (Or I'm missing some things). I write quite a lot of C++ code btw, so I'm familiar with that. --- http://www.digitalmars.com/d/2.0/htomodule.html says: D