Four things

Rainer Deyke rainerd at eldwood.com
Tue Mar 31 19:05:52 PDT 2009


bearophile wrote:
> C# has arrays of arrays as D, plus it has built-in multidimensional
> arrays too: 
> http://msdn.microsoft.com/en-us/library/aa288453(VS.71).aspx They
> have some advantages: - On them the compiler can use some extra
> optimizations, common in all Fortran compilers. D seems a language
> fit for matrix processing, etc. So this may be useful. - Such
> matrixes can be reshaped on the fly, they just keep their line length
> as an extra parameter. - Being made of a single block of memory, the
> memory allocator wastes less memory, sometimes much less. You can try
> this yourself with a single stc.gc.malloc compared to the newing of a
> 2D matrix made of arrays of arrays. I am ignorant about this topic,
> but maybe Lucarella may say something.

I use multi-dimensional arrays all the time.  Arrays of arrays are
totally inadequate as a substitute.  However, I'm not sure what
advantage a built-in type would provide over a library type.

> The GC used by dotnet C# is quite more efficient than the GC used by
> C# mono. This page is about the development of a future better mono
> GC: http://www.mono-project.com/Compacting_GC It also reminds me that
> a (single) good GC may manage two kinds of objects: "safe objects",
> that may be moved to allow heap compaction, and pinned objects,
> coming from or referenced by unsafe modules. If most modules in a D
> project are going to be safe, then most objects may be unpinned,
> allowing the GC to move them. This in theory may lead to a D GC that
> is often as efficient as ones like HotSpot ones.

Better GC is always nice, but I'd rather see the language stabilize
before worrying about such implementation details.

>  It says:
>> Data types and behaviors of objects are described by classes and
>> traits. Class abstractions are extended by subclassing and by a
>> flexible mixin-based composition mechanism to avoid the problems of
>> multiple inheritance.<
> So it seems they have partially refused how classes are managed in D.
> I'd like to know if this is actually (a bit) better than the way OOP
> is done in D. If such things are better, D2/D3 may eventually copy
> something.

Disclaimer: I haven't looked at Scala.

If mixins are such a good replacement for multiple inheritance, then
they are also a good replacement for single inheritance.  Having single
inheritance without multiple inheritance is /wrong/.  Based on the above
paragraph, it sounds like this criticism applies as much to Scala as it
does to D and Java.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list