View mode: basic / threaded / horizontal-split · Log in · Help
August 13, 2008
Re: Multiple Inheritance of Classes
On Wed, 13 Aug 2008 20:52:24 +0400, Steven Schveighoffer  
<schveiguy@yahoo.com> wrote:

> "Denis Koroskin" wrote
>> On Wed, 13 Aug 2008 19:46:51 +0400, Steven Schveighoffer
>> <schveiguy@yahoo.com> wrote:
>>
>>> "superdan" wrote
>>>> Steven Schveighoffer Wrote:
>>>>
>>>>> "superdan" wrote
>>>>> > Lars Ivar Igesund Wrote:
>>>>> >
>>>>> >> Chris R. Miller wrote:
>>>>> >>
>>>>> >> > Understand, I'm NOT demanding ANYTHING.
>>>>> >> >
>>>>> >> > What is the current state of thought about Multiple Inheritance
>>>>> for
>>>>> >> > classes in D?  I'd like to have that feature, since it'd make  
>>>>> some
>>>>> >> > stuff
>>>>> >> > I want to do a bit easier.  Is it not there because it's not  
>>>>> worth
>>>>> >> > the
>>>>> >> > effort to implement?  Because it's evil and needs to die (I  
>>>>> don't
>>>>> >> > know,
>>>>> >> > some people could possibly be adamantly anti-MI)?
>>>>> >>
>>>>> >> This is actually the reason, not the adamantly anti-MI part, just
>>>>> that
>>>>> >> MI
>>>>> >> is
>>>>> >> evil and that is well acknowledged almost everywhere. You will  
>>>>> find
>>>>> >> good
>>>>> >> argumentation against it if you look, too.
>>>>> >
>>>>> > appeal to authority. appeal to ridicule. appeal to the majority.  
>>>>> all
>>>>> in
>>>>> > one sentence. wow. at least could you space out your fallacies a  
>>>>> bit
>>>>> > more.
>>>>> >
>>>>> > the man has kindly asked a sensible question. he deserves a good
>>>>> > answer.
>>>>> > if u can't give one just don't reply. this is just ignorance.
>>>>>
>>>>> This kind of bullying bullshit does nothing to further communication,
>>>>> or
>>>>> help anyone in the least.  You've managed to call many of the  
>>>>> brightest
>>>>> developers for D idiots, usually based on useless crap like this  
>>>>> (which
>>>>> has
>>>>> no bearing on anything).  So shut the fuck up.
>>>>
>>>> or what, u gonna kick my ass. relax. you can always block me. (but  
>>>> hold
>>>> onto that a bit more. dee's plea is just too cool.) my post did  
>>>> further
>>>> communication. it exposed the hackneyed "mi is evil" shit... i mean
>>>> poop.
>>>> (damn.) it may have helped someone. you know what i like about walter.
>>>> when he doesn't know something he is open in admitting it. for that
>>>> alone
>>>> i'd wash his feet. i didn't call the poster any name. but that
>>>> particular
>>>> post was bull... i mean crap and i just said it. the fact that the  
>>>> post
>>>> sucked bears nothing on the fact that he's good or anything. even  
>>>> worse,
>>>> if he's good then why would he use his goodwill to get away with
>>>> statements like that. they only reveal ignorance and attempt at
>>>> continuing
>>>> ignorance because it puts a stigma on anyone investigating mi. it's
>>>> silly
>>>> we need to still talk about it. now shall we just move on to something
>>>> technical.
>>>
>>> I don't want to block you.  You have some good things to say (although
>>> colorful).  Just can it with the "what you said is stupid, so don't  
>>> post
>>> here"  It makes tentative posters not want to post for fear of being
>>> ridiculed (not me BTW :) )  Some of them might have interesting things  
>>> to
>>> say.  If you want to argue against someone's point, argue the point
>>> (which
>>> you did later, and I found it interesting, although my personal
>>> experience
>>> with MI (on C++) is that it sucks, and should never be used).
>>>
>>> What Lars said basically is that many people don't like MI, and you can
>>> find
>>> proof of that (people don't like it) if you search online.  This is the
>>> reason Walter doesn't implement it, because he's in that camp.  I think
>>> that
>>> is a reasonable answer to the question given.
>>>
>>> It's sort of like most the reasons Walter gives for everything new he
>>> comes
>>> out with: "X is fundamentally broken in C++".  Substitute fundamentally
>>> broken with evil, substitute threading, const, etc. for X.  Can't say I
>>> always disagree, but his proof is certainly lacking ;)
>>>
>>>>> > interface Customer
>>>>> > {
>>>>> >    string ssn();
>>>>> >    string name();
>>>>> >    string uniqueName() { return name ~ "(ssn: " ~ ssn ~ ")"; }
>>>>> > }
>>>>> >
>>>>> > so uniqueName formats a specific way. a descendant can choose to
>>>>> change
>>>>> > that or just use the default. no idea why walt chose to disallow
>>>>> that.
>>>>> > walt?
>>>>>
>>>>> What do you pass as the 'this' pointer?  When you call a function on  
>>>>> an
>>>>> interface, the compiler uses the offset of an interface to the 'this'
>>>>> pointer to get to the object, but in this case, there is no object,  
>>>>> so
>>>>> what
>>>>> does the compiler do to call the ssn() and name() functions while
>>>>> implementing this function?
>>>>
>>>> i'm unclear about this so maybe it ain't as easy as i thought.
>>>> but i'm thinking the same problem goes for the global string
>>>> uniqueName(Customer c) { return c.name ~ "(ssn: " ~ c.ssn ~ ")"; }
>>>
>>> Not the same as the above problem, because the vtable layout for
>>> Customer is
>>> always the same.  The name() function expects a pointer to the object,
>>> and
>>> the implementation knows everything about the object including the
>>> vtable.
>>> The problem with putting the implementation in the interface is that a
>>> member function gets a pointer to the *object* not the *interface*.  In
>>> your
>>> new example, the 'c' parameter is a pointer to the interface, so that
>>> problem doesn't exist.
>>>
>>>> a pointer to this function should be put in the vtable if the object
>>>> does
>>>> not implement it.
>>>
>>> That is fine for calling the function, but not for what to do when
>>> compiling
>>> it.
>>>
>>>>
>>>>> If you pass the interface pointer as the 'this' pointer, then how do
>>>>> you
>>>>> override it in an Object that implements the interface?  The function
>>>>> in
>>>>> the
>>>>> concrete class can't be passed the interface pointer, so you can't
>>>>> really
>>>>> override it.
>>>>
>>>> that pretty much kills what i wrote above eh. but thunking will take
>>>> care
>>>> of it. if there's no impl in an object put a pointer to a thunk that
>>>> adjusts the pointer (from obj to interface) and calls the default impl
>>>> with the adjusted pointer. the latter is a direct call which makes it
>>>> fast.
>>>
>>> Hm... I think this would work actually, as I think this is a runtime
>>> lookup.
>>> This sounds like a reasonable tradeoff, and having the final modifier  
>>> if
>>> you
>>> want it to be quicker (I think the compiler can statically do the thunk
>>> if
>>> you know the concrete object type).  Actually, it would have to do a
>>> thunk
>>> for a derived interface, even if you put final on it, as it can't  
>>> always
>>> know the offset between 2 interfaces in a particular object (or can  
>>> it?).
>>>
>>> Perhaps someone with better knowledge of the way interfaces work could
>>> tell
>>> if it would be possible?
>>>
>>> -Steve
>>>
>>>
>>
>> I use MI often and have positive experience with it. One good pattern  
>> that
>> I use is the Intrusive container.
>> Suppose you have an item that you want to store in a list.  
>> Unfortunately,
>> putting stuff into the single- or double-linked list leads to a memory
>> allocation (unless some pool is used). Sometimes it is desirable to put
>> next and prev elements into the item itself, so that no memory  
>> allocation
>> is ever needed. Besides, now you can easily say whether an item is  
>> stored
>> in any container. This can be implemented via inheritance:
>>
>> class IntrusiveContainerNode(T)
>> {
>>     alias T ValueType;
>>     package T next;
>>     package T prev;
>> }
>>
>> class IntrusiveContainer(TNode)
>> {
>>     alias TNode.ValueType ValueType;
>>
>>     void add(ValueType value);
>>     void remove(ValueType value);
>> }
>>
>> class MyClass : public Node!(MyClass)
>> {
>>    // ...
>> }
>>
>> This imposes the restriction that an item can be stored in 1 container  
>> at
>> a time. However, you can subclass twise in order to be storable in
>> different containers:
>>
>> typedef EventOneListener IntrusiveContainerNode;
>> typedef EventTwoListener IntrusiveContainerNode;
>>
>> class MyClass : EventOneListener!(MyClass), EventTwoListener!(MyClass)
>> {
>>     // ...
>> }
>>
>> MyClass instance = new MyClass();
>> eventOneListeners.add(instance);
>> eventTwoListeners.add(instance);
>>
>> It is currently impossible to implement this approach using mixins (due  
>> to
>> a bug I'm yet to submit).
>
> I think you can do this without multiple inheritance:
>
> class MyClass
> {
>    IntrusiveContainerNode!(MyClass) eventOne, eventTwo;
> }
>
> If you make IntrusiveContainerNode a struct, then there is no extra  
> memory
> allocation necessary.
>
> What is wrong with a solution like that?
>
> -Steve
>
>

1) Functionality. You loose an opportunity to iterate over elements of the  
container.
It can be resolved by extending the IntrusiveContainerNode class to store  
a thisPtr as well (4 more bytes per instance):

// I don't want to have additional memory allocations so it is a struct now
struct IntrusiveContainerNode(T)
{
    alias T ValueType;
    package T next;
    package T prev;
    package T thisPtr;
}

and adding initialization code:

class MyClass
{
    this()
    {
        eventOne.thisPtr = this;
        eventTwo.thisPtr = this;
    }

    IntrusiveContainerNode!(MyClass) eventOne, eventTwo;
    // ...
}

2) Readability. In addition to the complexity above, you are now forced to  
write the following code instead:
eventOneListeners.add(&instance.eventOne);
eventTwoListeners.add(&instance.eventTwo);

3) Usability. You have to remember all the names like "eventOne",  
"eventTwo" or whatever name you give to the node. In some cases users are  
forced to stick with some predefined names, code becomes templated and  
losses virtuality. The following code shows the issues:

class UpdateDispatcher
{
    void addEventListener(T)(T listener) // a template. non-virtual.
    {
        updateContainer.add(listener.updateEvent); // updateEvent is a  
predefined name.
        //All the classes that want to recieve an Update should have a  
public "updateEvent" field in their body!
    }
}

4) Performance. Additional pointer dereference (node->thisPtr->data)  
introduced (minor one, but nevertheless).

All these issues make the idiom unusable.
August 13, 2008
Re: Multiple Inheritance of Classes
Steven Schveighoffer Wrote:

> "lurker" wrote
> >I hate to even think of it but on this one I am with Superdan. Don't get me 
> >wrong I think he is the worst scar this group has. I think he has a real 
> >problem with the way he treats people and I wouldn't want to be his 
> >coworker or neighbor. Most of his posts are so vile I feel like puking when 
> >I read them and I blocked him a long time ago. In this thread I saw his 
> >posts in quotes and I almost wish I didn't. But I have to say if he had 
> >minimal skills at writing he would of won this argument hands down.
> >
> > I for one was firmly in the "mi is evil" camp on unclear grounds of 
> > ambiguity. Lars feel-good post only inforced that. Now my understanding 
> > has changed. (Many thanks especially to Dee Girl.)
> >
> > Most disappointing is one thing. When Lars answered to Superdan in a 
> > civilized manner he had an excellent opportunity at showing his class. But 
> > he missed it by neither affirming nor denying he knew about the layout 
> > problem. That leaves us facing the uncomfortable possibility that he 
> > didn't know about it but he did not have the strength to admit it.
> 
> I think you completely misunderstood the original question along with Lars' 
> answer.  A simple question was asked.  Why does D not have Multiple 
> inheritance.  A simple answer was given.  Because many people don't like it, 
> including the author (and me incidentally).  What more explaining is 
> necessary from someone who has observed this?

Yes it has no bearing. But since you answer I could not resist :) The question asked was different. I will quote it below. It included a question about possible technical difficulties.

> It's like if I said to Lars "I don't like pizza" (which I actually love, but 
> that's beside the point).  And Chris asks a group of people, "why doesn't 
> Steve eat pizza?  Is it because he doesn't like it?", and Lars says "Yes, 
> because he doesn't like it.  Many people don't like it", and you cry foul 
> and tell him off and he should not answer questions unless he *knows* the 
> details.

The comparison is nonseqitur. He did not say anything about liking, he made an absolute statement. Let me partly quote the question and the answer. 

Q: "What is the current state of thought about Multiple Inheritance for classes in D?  I'd like to have that feature, since it'd make some stuff I want to do a bit easier.  Is it not there because it's not worth the effort to implement?  Because it's evil and needs to die (I don't know, some people could possibly be adamantly anti-MI)?"

A: "This is actually the reason, not the adamantly anti-MI part, just that MI is
evil and that is well acknowledged almost everywhere. You will find good argumentation against it if you look, too."

Translated to pizza. Actually make it eggs because eggs are controversial. I saw egg whites as healthy items on the menu. The waitress said only yolks are bad because they have cholesterol. Had no idea.

Q: "What is the current state of thought about eggs?  I'd like to eat eggs, since it'd make some cheese a bit easier to eat.  Are eggs not recommended because they are not not worth eating? Because they are evil and need to die (I don't know, some people could possibly be adamantly anti-eggs)?"

A: "This is actually the reason, not the adamantly anti-eggs part, just that eggs are
evil and that is well acknowledged almost everywhere. You will find good argumentation against it if you look, too."

Didn't even have to change much of the answer. That answer is terrible in programming or kitchen domain. Superdan barged in and through his usual verbal abuse and disgusting curses he almost by mistake leaked useful information on objective nutritional data on egg yolks and egg whites. BTW pardon me if I post as lurker because I don't want my name to fall in his mouth.
August 13, 2008
Re: Multiple Inheritance of Classes
"lurker" wrote
> Steven Schveighoffer Wrote:
>
>> "lurker" wrote
>> >I hate to even think of it but on this one I am with Superdan. Don't get 
>> >me
>> >wrong I think he is the worst scar this group has. I think he has a real
>> >problem with the way he treats people and I wouldn't want to be his
>> >coworker or neighbor. Most of his posts are so vile I feel like puking 
>> >when
>> >I read them and I blocked him a long time ago. In this thread I saw his
>> >posts in quotes and I almost wish I didn't. But I have to say if he had
>> >minimal skills at writing he would of won this argument hands down.
>> >
>> > I for one was firmly in the "mi is evil" camp on unclear grounds of
>> > ambiguity. Lars feel-good post only inforced that. Now my understanding
>> > has changed. (Many thanks especially to Dee Girl.)
>> >
>> > Most disappointing is one thing. When Lars answered to Superdan in a
>> > civilized manner he had an excellent opportunity at showing his class. 
>> > But
>> > he missed it by neither affirming nor denying he knew about the layout
>> > problem. That leaves us facing the uncomfortable possibility that he
>> > didn't know about it but he did not have the strength to admit it.
>>
>> I think you completely misunderstood the original question along with 
>> Lars'
>> answer.  A simple question was asked.  Why does D not have Multiple
>> inheritance.  A simple answer was given.  Because many people don't like 
>> it,
>> including the author (and me incidentally).  What more explaining is
>> necessary from someone who has observed this?
>
> Yes it has no bearing. But since you answer I could not resist :) The 
> question asked was different. I will quote it below. It included a 
> question about possible technical difficulties.
>
>> It's like if I said to Lars "I don't like pizza" (which I actually love, 
>> but
>> that's beside the point).  And Chris asks a group of people, "why doesn't
>> Steve eat pizza?  Is it because he doesn't like it?", and Lars says "Yes,
>> because he doesn't like it.  Many people don't like it", and you cry foul
>> and tell him off and he should not answer questions unless he *knows* the
>> details.
>
> The comparison is nonseqitur. He did not say anything about liking, he 
> made an absolute statement. Let me partly quote the question and the 
> answer.
>
> Q: "What is the current state of thought about Multiple Inheritance for 
> classes in D?  I'd like to have that feature, since it'd make some stuff I 
> want to do a bit easier.  Is it not there because it's not worth the 
> effort to implement?  Because it's evil and needs to die (I don't know, 
> some people could possibly be adamantly anti-MI)?"
>
> A: "This is actually the reason, not the adamantly anti-MI part, just that 
> MI is
> evil and that is well acknowledged almost everywhere. You will find good 
> argumentation against it if you look, too."
>
> Translated to pizza. Actually make it eggs because eggs are controversial. 
> I saw egg whites as healthy items on the menu. The waitress said only 
> yolks are bad because they have cholesterol. Had no idea.
>
> Q: "What is the current state of thought about eggs?  I'd like to eat 
> eggs, since it'd make some cheese a bit easier to eat.  Are eggs not 
> recommended because they are not not worth eating? Because they are evil 
> and need to die (I don't know, some people could possibly be adamantly 
> anti-eggs)?"
>
> A: "This is actually the reason, not the adamantly anti-eggs part, just 
> that eggs are
> evil and that is well acknowledged almost everywhere. You will find good 
> argumentation against it if you look, too."
>
> Didn't even have to change much of the answer. That answer is terrible in 
> programming or kitchen domain. Superdan barged in and through his usual 
> verbal abuse and disgusting curses he almost by mistake leaked useful 
> information on objective nutritional data on egg yolks and egg whites. BTW 
> pardon me if I post as lurker because I don't want my name to fall in his 
> mouth.

Except that in the case of MI, the reasoning actually *is* because the 
author doesn't like it (translate, views as evil), and there is probably 
reasoning behind that (namely, experience with MI).  The view that MI is 
evil does not come from just some random political cause, trying to 
eliminate MI from all programming languages.

My whole beef with superdan's post is not with anything technical he said. 
I think what he says makes a lot of sense and was very interesting.  The 
problem is the way he bashes the answerer, who is stating what he believes 
is the reason.  In the interests of keeping this a civil forum with people 
not afraid to ask questions or not afraid to speak their mind without 
getting a barrage of mean-spirited obscenities, I think superdan needs to 
tone down his posts.  It's not a healthy environment for productive 
discussion.

FWIW, I have no problem with obscenities (not that I'm encouraging that, 
generally it doesn't get you as far in life to swear all the time), but I do 
have a problem with bullying.

-Steve
August 13, 2008
Re: Multiple Inheritance of Classes
On Wed, 13 Aug 2008 22:02:14 +0400, Steven Schveighoffer  
<schveiguy@yahoo.com> wrote:

> "lurker" wrote
>> Steven Schveighoffer Wrote:
>>
>>> "lurker" wrote
>>> >I hate to even think of it but on this one I am with Superdan. Don't  
>>> get
>>> >me
>>> >wrong I think he is the worst scar this group has. I think he has a  
>>> real
>>> >problem with the way he treats people and I wouldn't want to be his
>>> >coworker or neighbor. Most of his posts are so vile I feel like puking
>>> >when
>>> >I read them and I blocked him a long time ago. In this thread I saw  
>>> his
>>> >posts in quotes and I almost wish I didn't. But I have to say if he  
>>> had
>>> >minimal skills at writing he would of won this argument hands down.
>>> >
>>> > I for one was firmly in the "mi is evil" camp on unclear grounds of
>>> > ambiguity. Lars feel-good post only inforced that. Now my  
>>> understanding
>>> > has changed. (Many thanks especially to Dee Girl.)
>>> >
>>> > Most disappointing is one thing. When Lars answered to Superdan in a
>>> > civilized manner he had an excellent opportunity at showing his  
>>> class.
>>> > But
>>> > he missed it by neither affirming nor denying he knew about the  
>>> layout
>>> > problem. That leaves us facing the uncomfortable possibility that he
>>> > didn't know about it but he did not have the strength to admit it.
>>>
>>> I think you completely misunderstood the original question along with
>>> Lars'
>>> answer.  A simple question was asked.  Why does D not have Multiple
>>> inheritance.  A simple answer was given.  Because many people don't  
>>> like
>>> it,
>>> including the author (and me incidentally).  What more explaining is
>>> necessary from someone who has observed this?
>>
>> Yes it has no bearing. But since you answer I could not resist :) The
>> question asked was different. I will quote it below. It included a
>> question about possible technical difficulties.
>>
>>> It's like if I said to Lars "I don't like pizza" (which I actually  
>>> love,
>>> but
>>> that's beside the point).  And Chris asks a group of people, "why  
>>> doesn't
>>> Steve eat pizza?  Is it because he doesn't like it?", and Lars says  
>>> "Yes,
>>> because he doesn't like it.  Many people don't like it", and you cry  
>>> foul
>>> and tell him off and he should not answer questions unless he *knows*  
>>> the
>>> details.
>>
>> The comparison is nonseqitur. He did not say anything about liking, he
>> made an absolute statement. Let me partly quote the question and the
>> answer.
>>
>> Q: "What is the current state of thought about Multiple Inheritance for
>> classes in D?  I'd like to have that feature, since it'd make some  
>> stuff I
>> want to do a bit easier.  Is it not there because it's not worth the
>> effort to implement?  Because it's evil and needs to die (I don't know,
>> some people could possibly be adamantly anti-MI)?"
>>
>> A: "This is actually the reason, not the adamantly anti-MI part, just  
>> that
>> MI is
>> evil and that is well acknowledged almost everywhere. You will find good
>> argumentation against it if you look, too."
>>
>> Translated to pizza. Actually make it eggs because eggs are  
>> controversial.
>> I saw egg whites as healthy items on the menu. The waitress said only
>> yolks are bad because they have cholesterol. Had no idea.
>>
>> Q: "What is the current state of thought about eggs?  I'd like to eat
>> eggs, since it'd make some cheese a bit easier to eat.  Are eggs not
>> recommended because they are not not worth eating? Because they are evil
>> and need to die (I don't know, some people could possibly be adamantly
>> anti-eggs)?"
>>
>> A: "This is actually the reason, not the adamantly anti-eggs part, just
>> that eggs are
>> evil and that is well acknowledged almost everywhere. You will find good
>> argumentation against it if you look, too."
>>
>> Didn't even have to change much of the answer. That answer is terrible  
>> in
>> programming or kitchen domain. Superdan barged in and through his usual
>> verbal abuse and disgusting curses he almost by mistake leaked useful
>> information on objective nutritional data on egg yolks and egg whites.  
>> BTW
>> pardon me if I post as lurker because I don't want my name to fall in  
>> his
>> mouth.
>
> Except that in the case of MI, the reasoning actually *is* because the
> author doesn't like it (translate, views as evil), and there is probably
> reasoning behind that (namely, experience with MI).  The view that MI is
> evil does not come from just some random political cause, trying to
> eliminate MI from all programming languages.
>
> My whole beef with superdan's post is not with anything technical he  
> said.
> I think what he says makes a lot of sense and was very interesting.  The
> problem is the way he bashes the answerer, who is stating what he  
> believes
> is the reason.  In the interests of keeping this a civil forum with  
> people
> not afraid to ask questions or not afraid to speak their mind without
> getting a barrage of mean-spirited obscenities, I think superdan needs to
> tone down his posts.  It's not a healthy environment for productive
> discussion.
>
> FWIW, I have no problem with obscenities (not that I'm encouraging that,
> generally it doesn't get you as far in life to swear all the time), but  
> I do
> have a problem with bullying.
>
> -Steve
>
>

Please, stop that!
August 13, 2008
Re: Multiple Inheritance of Classes
Dee Girl wrote:
> I do not know exact how he meant. But I tell how I think it can be.
> This is how I implement in my project (simplified because I have
> negative offset).

I think it would be most helpful if you could turn this posting into an 
article.
August 13, 2008
[OT] Re: Multiple Inheritance of Classes
Dee Girl a écrit :
...

I really like the way you write English, in short sentences which are 
very clear. Were you from Japan? I can't remember. Are you thinking in 
japanese and translating to English? Is japanese spoken like that? Or is 
it just you?

I would have sent this mail to you privately, but you don't show your 
email here.

(sorry, I like languages)
August 13, 2008
Re: Multiple Inheritance of Classes
Walter Bright Wrote:

> Dee Girl wrote:
> > I do not know exact how he meant. But I tell how I think it can be.
> > This is how I implement in my project (simplified because I have
> > negative offset).
> 
> I think it would be most helpful if you could turn this posting into an 
> article.

Hello Walter! Thank you very much for your attention. But my English is bad. And takes me a long time to write post. So an article should take a very long time! ^_^ But if you or some body want to write an article, I help. Thank you, Dee Girl
August 13, 2008
Re: [OT] Re: Multiple Inheritance of Classes
Ary Borenszweig Wrote:

> Dee Girl a écrit :
> ...
> 
> I really like the way you write English, in short sentences which are 
> very clear. Were you from Japan? I can't remember. Are you thinking in 
> japanese and translating to English? Is japanese spoken like that? Or is 
> it just you?
> 
> I would have sent this mail to you privately, but you don't show your 
> email here.
> 
> (sorry, I like languages)

Hello Ary! Thank you for asking. I was raised in Tokyo. Now I am a student in USA. Very different! Home teacher tells you what to do. Here teacher lets you very free. I can take what class I want. Some time I work on any project I want and get good grade to. In Japan I would be ashamed. America is very free country. Best for programmers I think ^_^

I write longer sentences in Japanese. I try to keep short in English and put one sense in a sentence. I never know where to put comma and articles are all in strange places. So I apply KISS ^_^ Thank you, Dee Girl
August 13, 2008
Re: Multiple Inheritance of Classes
Denis Koroskin wrote:
> I use MI often and have positive experience with it. One good pattern 
> that I use is the Intrusive container.
> Suppose you have an item that you want to store in a list. 
> Unfortunately, putting stuff into the single- or double-linked list 
> leads to a memory allocation (unless some pool is used). Sometimes it is 
> desirable to put next and prev elements into the item itself, so that no 
> memory allocation is ever needed. Besides, now you can easily say 
> whether an item is stored in any container. This can be implemented via 
> inheritance:
> 
> class IntrusiveContainerNode(T)
> {
>     alias T ValueType;
>     package T next;
>     package T prev;
> }
> 
> class IntrusiveContainer(TNode)
> {
>     alias TNode.ValueType ValueType;
> 
>     void add(ValueType value);
>     void remove(ValueType value);
> }
> 
> class MyClass : public Node!(MyClass)
> {
>    // ...
> }
> 
> This imposes the restriction that an item can be stored in 1 container 
> at a time. However, you can subclass twise in order to be storable in 
> different containers:
> 
> typedef EventOneListener IntrusiveContainerNode;
> typedef EventTwoListener IntrusiveContainerNode;
> 
> class MyClass : EventOneListener!(MyClass), EventTwoListener!(MyClass)
> {
>     // ...
> }
> 
> MyClass instance = new MyClass();
> eventOneListeners.add(instance);
> eventTwoListeners.add(instance);
> 
> It is currently impossible to implement this approach using mixins (due 
> to a bug I'm yet to submit).

Chris E. implemented something similar to that using mixins:

http://www.dprogramming.com/list.php

It works fairly well.  Your example of typdefing to support multiple 
lists is pretty cool though :^)
August 13, 2008
Re: Multiple Inheritance of Classes
lurker wrote:
> Steven Schveighoffer Wrote:
> 
>> "lurker" wrote
>>> I hate to even think of it but on this one I am with Superdan. Don't get me 
>>> wrong I think he is the worst scar this group has. I think he has a real 
>>> problem with the way he treats people and I wouldn't want to be his 
>>> coworker or neighbor. Most of his posts are so vile I feel like puking when 
>>> I read them and I blocked him a long time ago. In this thread I saw his 
>>> posts in quotes and I almost wish I didn't. But I have to say if he had 
>>> minimal skills at writing he would of won this argument hands down.
>>>
>>> I for one was firmly in the "mi is evil" camp on unclear grounds of 
>>> ambiguity. Lars feel-good post only inforced that. Now my understanding 
>>> has changed. (Many thanks especially to Dee Girl.)
>>>
>>> Most disappointing is one thing. When Lars answered to Superdan in a 
>>> civilized manner he had an excellent opportunity at showing his class. But 
>>> he missed it by neither affirming nor denying he knew about the layout 
>>> problem. That leaves us facing the uncomfortable possibility that he 
>>> didn't know about it but he did not have the strength to admit it.
>> I think you completely misunderstood the original question along with Lars' 
>> answer.  A simple question was asked.  Why does D not have Multiple 
>> inheritance.  A simple answer was given.  Because many people don't like it, 
>> including the author (and me incidentally).  What more explaining is 
>> necessary from someone who has observed this?
> 
> Yes it has no bearing. But since you answer I could not resist :) The question asked was different. I will quote it below. It included a question about possible technical difficulties.
> 
>> It's like if I said to Lars "I don't like pizza" (which I actually love, but 
>> that's beside the point).  And Chris asks a group of people, "why doesn't 
>> Steve eat pizza?  Is it because he doesn't like it?", and Lars says "Yes, 
>> because he doesn't like it.  Many people don't like it", and you cry foul 
>> and tell him off and he should not answer questions unless he *knows* the 
>> details.
> 
> The comparison is nonseqitur. He did not say anything about liking, he made an absolute statement. Let me partly quote the question and the answer. 
> 
> Q: "What is the current state of thought about Multiple Inheritance for classes in D?  I'd like to have that feature, since it'd make some stuff I want to do a bit easier.  Is it not there because it's not worth the effort to implement?  Because it's evil and needs to die (I don't know, some people could possibly be adamantly anti-MI)?"
> 
> A: "This is actually the reason, not the adamantly anti-MI part, just that MI is
> evil and that is well acknowledged almost everywhere. You will find good argumentation against it if you look, too."
> 
> Translated to pizza. Actually make it eggs because eggs are controversial. I saw egg whites as healthy items on the menu. The waitress said only yolks are bad because they have cholesterol. Had no idea.
> 
> Q: "What is the current state of thought about eggs?  I'd like to eat eggs, since it'd make some cheese a bit easier to eat.  Are eggs not recommended because they are not not worth eating? Because they are evil and need to die (I don't know, some people could possibly be adamantly anti-eggs)?"
> 
> A: "This is actually the reason, not the adamantly anti-eggs part, just that eggs are
> evil and that is well acknowledged almost everywhere. You will find good argumentation against it if you look, too."
> 
> Didn't even have to change much of the answer. That answer is terrible in programming or kitchen domain. Superdan barged in and through his usual verbal abuse and disgusting curses he almost by mistake leaked useful information on objective nutritional data on egg yolks and egg whites. BTW pardon me if I post as lurker because I don't want my name to fall in his mouth.

Did I already voice a fear about a zillion-post-long study of the 
potential for ambiguity in written English?  Or was that something I was 
going to post and decided against it?
1 2 3 4 5 6 7
Top | Discussion index | About this forum | D home