July 23, 2009
Walter Bright wrote:
> Rainer Deyke wrote:
>> The reason I have stuck with C++ despite its (massive, obvious) flaws is that it has a couple of really nice and useful features that very few other languages have even attempted to match.  D is the only language I know that even tries, although it still falls short in many areas.
> 
> Fair enough. What are those two features?

1. C++'s object model, complete with polymorphic value types, deterministic destructors, arbitrary copy constructors, and optional lack of default constructor.  D's structs come close, but I think the class/struct split hurts D more than it helps.  And, yes, C++ has a lot of room for improvement here.

2. Templates.  And this is one area that D improves in a major way.  I love static if.


-- 
Rainer Deyke - rainerd@eldwood.com
July 23, 2009
On Wed, Jul 22, 2009 at 6:49 PM, Walter Bright<newshound1@digitalmars.com> wrote:
> Bill Baxter wrote:
>>
>> Yeh, it's like what's the big diff between a Lamborghini and a Chevy Nova anyway?  They both have four tires.  They both run on gas.  So what's all the fuss about the Lamborghini?
>
> It's like a car from the 60's vs a car today. It's hard to see what's really different, until you spend time driving one. There's just a boatload of little improvements in everything that add up to a lot.
>
> It's no surprise that most people who fix up those old cars also upgrade the systems with modern technology.

That's a better analogy.  Or like the guy who works on my bicycle was telling me just this week before he got started trying to fix the thing I was complaining about.  "In an ideal world every bike would be a $7000 bike."  That's because basically everything is built to higher tolerances on a $7000 bike and everything just works exactly like it's supposed to.

D is a lot like that $7000 bike -- except, thankfully, for the price tag.

--bb
July 23, 2009
Andrei Alexandrescu wrote:
> The issues are discussed in the book C++ Coding Standards and also in More Effective C++. Part of the problem is slicing, which you may want to google for. MEC++ discusses the problem of defining constructors and particularly copy constructors in hierarchies. Assignment and comparison are also problematic.

Yes, C++ has problems, but these problems can be fixed!  The struct/class split, on the other hand, introduces many more problems that are harder to fix.


-- 
Rainer Deyke - rainerd@eldwood.com
July 23, 2009
== Quote from Rainer Deyke (rainerd@eldwood.com)'s article
> Walter Bright wrote:
> > My experience with C++ people sticking with it is they are so used to the problems they no longer see them. To me it's like the mess in one's

My experience with D people sticking with it is ...

Not knowing that it can be done easier in another language is a bliss.

> > house. One doesn't notice it until going on a vacation (i.e. learning a another language), having one's hotel room cleaned every day, then coming home and suddenly seeing how untidy it is <g>.
> I want to throw these words back at you, because my first impression of D was "the bastard child of C++ and Java, with a random assortment of


Delphi
------

C# = Delphi + Java
D = (Java) + C++

Seems to me D only needs to learn from Delphi.


Delphi is the first RAD language designed to easily interact with
the IDE. Java wasn't, see the tonnes (non-metric unit of amount of code)
of code that the IDE produces. I believe now Java has all the necessary
features, it is just that swing just isn't the VCL. They could easily add
a D style "property/method" syntax but they just won't since they want to
stick to swing, which I think they need to drop.


Two important features from Delphi

1) properties: Easily distinguishable from normal methods in the reflection, just enough to know what to display in the object inspector and not to rely on the name of the method.

Object Inspector is a window displaying two columns, for normal properties and events.

Property Name1, Property Value1
Property Name2, Property Value2

What is the purpose of properties?

"The purpose of properties is to facilitate the interaction with the IDE"

2) published: Delphi has private, protected, public, published.
2.1) All published methods and properties are shown in the reflection, RTTI (sort
of a selective reflection {$M+}).
2.2) Everything passed to a published methods or property is serializable
 (in Delphi terminology derives from TPersistent or basic type like integer and stuff)
2.3) You can't have published fields only published properties, and methods
(Also note D people want properties to look like fields somehow)
(Delphi starts their fields with F in front FNumber).

Delphi might not have full reflection but the minimum it has is very powerful.

The VCL (state of the art library) is well designed, the components are AWARE of either running in the client application or running from within the IDE, hence can change their behaviour, to adapt to the changes, minimizing what the actual IDE has to do. Part of its design is a virtual constructor.


C++ + Another Language layered on top of C++
--------------------------------------------

1) Combining C++ with another language is "fairly" easy.

Okay D is a super enhanced C++. C# is a state-of-the-art language
for creating applications in a very simple manner. D is nowhere near C#.
C++ can easily be combined with Java and C# with the use of swig. D with
the introduction of the garbage collector, this becomes difficult.
(The "pied" guy might disagree)

I think for D to be successful it will not only have to be an enhanced C++ but will have to overtake C#.
July 23, 2009
Rainer Deyke wrote:
> Walter Bright wrote:
>> Rainer Deyke wrote:
>>> The reason I have stuck with C++ despite its (massive, obvious) flaws is
>>> that it has a couple of really nice and useful features that very few
>>> other languages have even attempted to match.  D is the only language I
>>> know that even tries, although it still falls short in many areas.
>> Fair enough. What are those two features?
> 
> 1. C++'s object model, complete with polymorphic value types,

What designs make good use of polymorphic value types?

> deterministic destructors,  arbitrary copy constructors, and optional
> lack of default constructor.

Struct have that except for default constructor. In D, currently default constructors cannot execute code. This is a limitation that we might need to address, although it has some advantages.

> D's structs come close, but I think the
> class/struct split hurts D more than it helps.  And, yes, C++ has a lot
> of room for improvement here.

How does the class/struct split? I think it's an enormous source of confusion for C++. C++ lore clarifies that you must decide in day one whether a class is meant to be polymorphic or monomorphic. Unfortunately that can't be expressed in the language, hence the weird cases with deriving from std::vector or getting polymorphic values unceremoniously sliced. Avoiding such mistakes are important things that C++ users must learn because there's nothing in the language stopping them from doing such nonsensical things; D very elegantly breaks that pattern by defining the language to only allow meaningful constructs.

Who says the class/struct situation is worse off in D than in C++ either doesn't know C++ or knows C++ too well.


Andrei
July 23, 2009
sclytrack wrote:
> == Quote from Rainer Deyke (rainerd@eldwood.com)'s article
>> Walter Bright wrote:
>>> My experience with C++ people sticking with it is they are so used to
>>> the problems they no longer see them. To me it's like the mess in one's
> 
> My experience with D people sticking with it is ...
> 
> Not knowing that it can be done easier in another language is a bliss.
> 
>>> house. One doesn't notice it until going on a vacation (i.e. learning a
>>> another language), having one's hotel room cleaned every day, then
>>> coming home and suddenly seeing how untidy it is <g>.
>> I want to throw these words back at you, because my first impression of
>> D was "the bastard child of C++ and Java, with a random assortment of
> 
> 
> Delphi
> ------
> 
> C# = Delphi + Java
> D = (Java) + C++
> 
> Seems to me D only needs to learn from Delphi.
> 
> 
> Delphi is the first RAD language designed to easily interact with
> the IDE. Java wasn't, see the tonnes (non-metric unit of amount of code)
> of code that the IDE produces. I believe now Java has all the necessary
> features, it is just that swing just isn't the VCL. They could easily add
> a D style "property/method" syntax but they just won't since they want to
> stick to swing, which I think they need to drop.
> 
> 
> Two important features from Delphi
> 
> 1) properties: Easily distinguishable from normal methods in the reflection,
> just enough to know what to display in the object inspector and not to rely on
> the name of the method.
> 
> Object Inspector is a window displaying two columns, for normal properties and events.
> 
> Property Name1, Property Value1
> Property Name2, Property Value2
> 
> What is the purpose of properties?
> 
> "The purpose of properties is to facilitate the interaction with the IDE"

Unfortunately the designers of D doesn't care at all about IDE support for their language, even though in any "why don't you use D" discussion it is mentioned.
July 23, 2009
Rainer Deyke wrote:
> Andrei Alexandrescu wrote:
>> The issues are discussed in the book C++ Coding Standards and also in
>> More Effective C++. Part of the problem is slicing, which you may want
>> to google for. MEC++ discusses the problem of defining constructors and
>> particularly copy constructors in hierarchies. Assignment and comparison
>> are also problematic.
> 
> Yes, C++ has problems, but these problems can be fixed!

How? Minding constantly a set of dangerous problems is not fixing it.

> The
> struct/class split, on the other hand, introduces many more problems
> that are harder to fix.

Again: what are those problems?


Andrei
July 23, 2009
Ary Borenszweig wrote:
> Unfortunately the designers of D doesn't care at all about IDE support for their language, even though in any "why don't you use D" discussion it is mentioned.

The problem is not not caring. For one, I'd love a D IDE as much as the next guy, but I don't have the resources to put into writing one. IDEs come with language acceptance and are seldom written by the creator of the language.

By the way, we must be doing something right. As of ten days ago there were 30,800 page views for The Case for D, and I just noticed that in the past week the presale rate for The D Programming Language has doubled.


Andrei
July 23, 2009
sclytrack wrote:
> I think for D to be successful it will not only have to be an enhanced C++
> but will have to overtake C#.

I think D should also visibly obviate some use of Python or Perl for prototyping.

Thank you for your insightful post, the points on reflection and Delphi were excellent.


Andrei
July 23, 2009
On Thu, Jul 23, 2009 at 12:11 PM, Rainer Deyke<rainerd@eldwood.com> wrote:

> Yes, C++ has problems, but these problems can be fixed!  The struct/class split, on the other hand, introduces many more problems that are harder to fix.

You know, this is like the first thing C++ users complain about on the IRC channel when they find D: "what if I want to turn a class into a struct, or vice versa?"

I've been using D for five years, and I have never.

EVER.

Needed or desired to do that.  Nor have I heard anyone but new C++ users complaining about it.

Classes and structs are fundamentally different concepts.  You design your code from the start to use one or the other, because only one makes sense.