Old problem with performance

Yigal Chripun yigal100 at gmail.com
Sun Feb 22 01:45:56 PST 2009


Bill Baxter wrote:
> On Sun, Feb 22, 2009 at 5:10 AM, Denis Koroskin<2korden at gmail.com>  wrote:
>> On Sat, 21 Feb 2009 21:49:46 +0300, Bill Baxter<wbaxter at gmail.com>  wrote:
>>
>>> On Sun, Feb 22, 2009 at 1:02 AM, Weed<resume755 at mail.ru>  wrote:
>>>> Bill Baxter пишет:
>>>>> 2009/2/21 Weed<resume755 at mail.ru>:
>>>>>> Weed пишет:
>>>>>>> Bill Baxter пишет:
>>>>>>>
>>>>>>>> Why don't you just show us the class in the way you would like to
>>>>>>>> write it in C++, and we'll show you how to write it in D, or finally
>>>>>>>> agree with you that it's not possible.   But as long as you continue
>>>>>>>> to be hand-wavy about "common base classes" we're at a bit of an
>>>>>>>> impasse.  So far everyone thinks D can do what you want it to do
>>>>>>>> based
>>>>>>>> on your vague descriptions.
>>>>>> As I said, you can write everything using "goto" and "if".
>>>>>>
>>>>>> ...But why you do not like the original example of this thread?
>>>>> Please post again.  I don't seem to recall any detailed example.
>>>>>
>>>>> --bb
>>>>
>>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=83506
>>> You should use a struct there!   Your code does not show you doing
>>> anything that would even remotely suggest using a class is worthwhile.
>>>   You're doing value operations on value types.  That's what structs
>>> are for.
>>>
>>> --bb
>> That's what *everyone* tells him!
>
> I am vaguely open to the possibility that he has a point.  FLENS uses
> inheritance, for instance.  But I don't recall what the intent of that
> inheritance was in FLENS, exactly.  I more or less ported it to D
> without that, though, so I guess I didn't find it to be essential.
> See this:
>    http://flens.cvs.sourceforge.net/viewvc/flens/FLENS/matvec/densevector.h?revision=1.36&view=markup
> Versus this:
>    http://www.dsource.org/projects/multiarray/browser/trunk/multiarray/dflat/DenseVector.d
>
> Weed, if you want to make a real argument, that would be a good place
> to start.  Investigate why and how FLENS uses inheritance.
>
> --bb

 From a quick look at the flens DenseVector class:
it inherits from a Vector Interface which only declares the destructor 
as virtual.
My educated guess is that this interface has a similar purpose to the 
"struct interfaces" feature discussed here before - similar to C++ concepts.
I don't see any polymorphism here - the functions aren't virtual.



More information about the Digitalmars-d mailing list