POV-Ray : Newsgroups : povray.off-topic : And today, C# Server Time
11 Oct 2024 01:22:58 EDT (-0400)
  And today, C# (Message 11 to 20 of 82)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: Re: And today, C#
Date: 12 Feb 2008 11:52:07
Message: <47b1ceb7@news.povray.org>
Gail Shaw wrote:

>> Er, what?
> 
> Sorry. Misread. Thought he was talking about C#

Ah. OK. Well I guess this *is* a C# thread. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 12 Feb 2008 12:03:20
Message: <47b1d157@news.povray.org>
Mike Raiford <mra### [at] hotmailcom> wrote:
> Ever attempted to use multiple inheritance in C++?

  Yes, I have needed it a few times. It's very handy.

  For example, recently I have been programming in a system where there
are basically two widget managers, each with their own widget types.
Both widget types have data inside them (such as their geometry) as
well as member functions. These widgets *need* those data members in
order to function properly.

  Usually these managers and their widgets can be kept separate, but in
this one case I needed to be able to gave the same objects to both
managers.

  Without multiple inheritance this would have been simply impossible.
I can't think of any way to accomplish this if multiple inheritance was
not supported. With C++'s multiple inheritance it worked beautifully.
I could create objects which were of both widget types at the same time,
and which could be given to both widget managers without even the
slightest of problems.

  I just can't even begin to imagine how I could have done this eg. in
Java. (At least not without crippling the system really badly and making
it really cumbersome to use.)

> Things get really 
> interesting when you have more than one base class, and some members 
> overlap.

  Ambiguity problems may sometimes happen, but rarely, and when they do,
it's seldom a problem.
  If, for example, both base classes have a function with the same name
and you need to call it for a derived class, you simply specify which
one should be called. It's basically no different than if the functions
in the base classes were named differently.

  Besides, it's not like two Java/C# interfaces couldn't have functions
with same names... (Ok, I have to admit that I don't know if they can,
but I assume they do.) This is not a problem exclusive to C++.

> There are other issues, of course, such as which copy of the 
> base class is used when 2 classes share a common base class and are 
> inherited by a further derived class. (Looks like a diamond on an 
> inheritance diagram)

  Just avoid diamond inheritance if you are unsure. It's not that hard.

  Being able to inherit from two (completely distinct) classes is extremely
handy regardless.

> Use C# for a while, especially the newer version (3.0) It's actually 
> quite nice. I've sort of grown to like it since I've started actually 
> using it. C++ish syntax, some stuff borrowed from Java.

  I don't like languages which artificially limit what I can do just
because the creators feared diamond inheritance.

  (I have never understood, and never will understand why they disallow
multiple inheritance *completely* given that the only problem they fear
is *diamond inheritance*. Why not disallow diamond inheritance? That
would solve the problem.)

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 12 Feb 2008 12:06:40
Message: <47b1d220@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> "Multiple inheritance is not supported, although a class can implement 
> any number of interfaces."

  I have never understood this, and never will. My question is: Why?

  If the answer to this question contains the term "diamond inheritance",
then my counter to that is: "Then forbid diamond inheritance, not multiple
inheritance."
  Having Problem with diamond inheritance is not a valid excuse to forbid
multiple inheritance completely.

-- 
                                                          - Warp


Post a reply to this message

From: nemesis
Subject: Re: And today, C#
Date: 12 Feb 2008 12:22:10
Message: <47b1d5c2@news.povray.org>
Invisible wrote:
> Here's the part I can't figure out. M$ basically exists to steal other 
> people's ideas, pass them off as "new" and "original", and con people 
> out of huge sums of money for it. So... why is M$ even interested in 
> something geniunely advanced and revolutionary?

to take the glory too.

> Yeah, looking at the Wikipedia page for C# I see they've stolen a whole 
> crapload of good ideas from Haskell.

in fact, that Erik Meijer guy is overly provocative and even gone as far 
as saying functional programming for the masses is really Visual Basic!
http://lambda-the-ultimate.org/node/1406

> Oh, sure. It has compilation, strong typing, compile-time error 
> checking, pervasive optimisation techniques, and an elegant underlying 
> algebra. Definitely a scripting language. :-P

read the PDF I linked to.  It's called "Functional programming with 
bananas, lenses, envelopes and barbed wire".  Despite the title, it's 
genuinelly interesting...


Post a reply to this message

From: Mike Raiford
Subject: Re: And today, C#
Date: 12 Feb 2008 12:24:09
Message: <47b1d639$1@news.povray.org>
Warp wrote:
> 
>   Usually these managers and their widgets can be kept separate, but in
> this one case I needed to be able to gave the same objects to both
> managers.
> 
>   Without multiple inheritance this would have been simply impossible.
> I can't think of any way to accomplish this if multiple inheritance was
> not supported. With C++'s multiple inheritance it worked beautifully.
> I could create objects which were of both widget types at the same time,
> and which could be given to both widget managers without even the
> slightest of problems.
> 
>   I just can't even begin to imagine how I could have done this eg. in
> Java. (At least not without crippling the system really badly and making
> it really cumbersome to use.)

It has its uses. There's no clean way to handle this situation in C# or 
Java.


> 
>   Just avoid diamond inheritance if you are unsure. It's not that hard.
> 
>   Being able to inherit from two (completely distinct) classes is extremely
> handy regardless.
> 

Only one problem with that: in both C# and Java, all classes have a 
common base. So, with multiple inheritance, diamonds are a given. Rather 
than address this, they chose to not allow multiple inheritance. I'm 
guessing Java has interfaces, like C#.

> 
>   I don't like languages which artificially limit what I can do just
> because the creators feared diamond inheritance.
> 

Not completely artificial. They made a design decision with the 
language, which could potentially create problems later.


Post a reply to this message

From: nemesis
Subject: Re: And today, C#
Date: 12 Feb 2008 12:24:54
Message: <47b1d666$1@news.povray.org>
Gail Shaw wrote:
> You don't have to. There's a free IDE (more than sufficient for trying stuff
> out) and the underlying framework and compiler are freely downloadable.
> There's more than enough docs, tuts and info on the net that you won't have
> to read a book if you don't want to.

yes, in no time you'll be hooked and badly shaking when away from it...


Post a reply to this message

From: Orchid XP v7
Subject: Re: And today, C#
Date: 12 Feb 2008 14:25:17
Message: <47b1f29d$1@news.povray.org>
Warp wrote:
> Mike Raiford <mra### [at] hotmailcom> wrote:
>> Ever attempted to use multiple inheritance in C++?
> 
>   Yes, I have needed it a few times. It's very handy.

For example, perhaps you want to define a matrix class which is a 
collection but also a number. [Or at least, you can do arithmetic on it. 
Depends on how the number classes are structured.]

There are other important examples. It gets quite awkward without MI.

>   Besides, it's not like two Java/C# interfaces couldn't have functions
> with same names...

Ah yes, the real WTF: Java's MI-but-not-MI doesn't even actually fix the 
problem! ;-)

>   I don't like languages which artificially limit what I can do just
> because the creators feared diamond inheritance.

I can understand that...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v7
Subject: Re: And today, C#
Date: 12 Feb 2008 14:27:46
Message: <47b1f332$1@news.povray.org>
Warp wrote:

>> "Multiple inheritance is not supported, although a class can implement 
>> any number of interfaces."
> 
>   I have never understood this, and never will. My question is: Why?

So, you can't have MI. OK, well that's a bit silly, but... Oh, but you 
can have "interfaces", which is just like MI, but... not. WTF?

OOC, have you ever looked at C# yourself?

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: And today, C#
Date: 12 Feb 2008 14:48:54
Message: <47b1f826@news.povray.org>
Orchid XP v7 <voi### [at] devnull> wrote:
> OOC, have you ever looked at C# yourself?

  Not really. From what I understand, it's a kind of "C++ with the same
limitations as Java".

  Just the reason for its existence repulses me: Since Microsoft had to
abandon their own, standard-breaking version of Java because they lost
their battle against Sun about it (MS had to rename their version of the
language "J++"), they then developed a different language to compete with
Java. That language was C#.

  I don't even care if C# is a thousand times better than Java. I hate
it by principle and by extreme prejudice, and I'm not ashamed to admit it.

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v7
Subject: Re: And today, C#
Date: 12 Feb 2008 14:51:00
Message: <47b1f8a4@news.povray.org>
Warp wrote:

>   I don't even care if C# is a thousand times better than Java. I hate
> it by principle and by extreme prejudice, and I'm not ashamed to admit it.

Heh. OK. I had a feeling that's kind of the answer I might get. ;-)

If I ever had round to actually playing with it, I'll let you know what 
I think... [Don't hold your breath though.]

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.