Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 20, 2024, 12:40:06 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The Case for D, an article by Andrei Alexandrescu
Pages: [1] 2 3 ... 6
Print
Author Topic: The Case for D, an article by Andrei Alexandrescu  (Read 15447 times)
lansing
Level 2
**


View Profile
« on: June 16, 2009, 04:38:32 AM »

This might be of some interest to C++ programmers *G*

http://www.ddj.com/hpc-high-performance-computing/217801225 (click print to view all on one page)

Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #1 on: June 16, 2009, 04:59:47 AM »

It looks like someone reinvented most of Ada, again.
Logged



What would John Carmack do?
Glaiel-Gamer
Guest
« Reply #2 on: June 16, 2009, 05:02:01 AM »

fuck, if they were going for puns they wouldn't have called the second revision D2, they'd have gone with DoubleD

i stopped reading when they didn't
Logged
muku
Level 10
*****


View Profile
« Reply #3 on: June 16, 2009, 05:24:22 AM »

That's my language of choice for game programming now for one or two years. I love it.

In fact I read that article just before you posted it here; I think it's good, though understandably a bit superficial and preachy.
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #4 on: June 16, 2009, 05:35:42 AM »

Wasn't D2 the name of a Dreamcast game?  Whoever made that should sue Digital Mars into oblivion.
Logged



What would John Carmack do?
muku
Level 10
*****


View Profile
« Reply #5 on: June 16, 2009, 06:28:05 AM »

What's with the hostility?

Anyway, it's basically just D, Version 2. To be precise, the DMD compiler is at version 2.030 right now. I'm not sure you can sue over a version number.
Logged
raigan
Level 5
*****


View Profile
« Reply #6 on: June 16, 2009, 06:38:24 AM »

Wow, it looks like the official compiler supports mac now?! Woo!!
« Last Edit: June 16, 2009, 06:44:13 AM by raigan » Logged
muku
Level 10
*****


View Profile
« Reply #7 on: June 16, 2009, 07:04:26 AM »

It does, yes.
Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #8 on: June 16, 2009, 08:06:14 AM »

D is fine, but since it's not open source, in can disappear into oblivion any time.
Logged

subsystems   subsystems   subsystems
muku
Level 10
*****


View Profile
« Reply #9 on: June 16, 2009, 08:09:20 AM »

D is fine, but since it's not open source, in can disappear into oblivion any time.

Wrong. The spec is open, and there are at least two fully open-source implementations, gdc and ldc. For D1, ldc may actually already be more robust than the Digital Mars compiler.
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #10 on: June 16, 2009, 08:13:17 AM »

I lost interest when the article said that all objects are referred to by reference.  I do not understand why so many object models insist on doing things this way.  The only language I use that has an acceptable reason for doing that is Objective-C, since all objects are runtime typed in that language, and having concrete instances would break the model.

One of my favorite aspects of C++ is that it tries to give built-in and user defined types equal capabilities.  It mostly succeeds in this (C++09 does even better) and this is what gives C++ most of its power (and complexity, admittedly).  Ada actually achieves this ideal by simply not having any built-in types, but I guess that's sort of cheating.

I find languages like Java and C#, where there's a strict dichotomy between user defined and built-in types absolutely stifling.  D is a no-go for me on that point alone.
Logged



What would John Carmack do?
muku
Level 10
*****


View Profile
« Reply #11 on: June 16, 2009, 08:20:22 AM »

I lost interest when the article said that all objects are referred to by reference.

That very same sentence also mentioned that D has structs, which are value types. And had you read just one paragraph further, you would have seen that D2 allows you to subtype any type, even built-in ones.

Furthermore, the powerful generic programming in D (read the relevant page in the article) allows you to treat built-in and user-defined types in the same way in many instances. For example, you can define generic algorithms which work the same on built-in arrays and user-defined container types.

In any case, that's just a knee-jerk reaction. I think the features in a language above all have to be well integrated with each other; dismissing a language out of hand because it doesn't check one particular box on your list seems a bit short-sighted.
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #12 on: June 16, 2009, 08:38:02 AM »

That very same sentence also mentioned that D has structs, which are value types.

Why can't have I values for classes?  This was ridiculous when C# did it, and it's ridiculous now.

And had you read just one paragraph further

I read the whole thing.  Just because I lost interest in the language doesn't mean I lost interest in the article.

you would have seen that D2 allows you to subtype any type, even built-in ones.

So does Ada, and Pascal before that.  This is nothing special.

Furthermore, the powerful generic programming in D (read the relevant page in the article) allows you to treat built-in and user-defined types in the same way in many instances. For example, you can define generic algorithms which work the same on built-in arrays and user-defined container types.

C++ and Ada generics let me use user-defined and built-in types in the exact same way.  Why should I step down to D generics which only let me do it in "many instances?"

I think the features in a language above all have to be well integrated with each other; dismissing a language out of hand because it doesn't check one particular box on your list seems a bit short-sighted.

The fundamental object model is a big box on my list.  Object oriented capabilities tend to be the core of most programming languages these days, and most other features are built around that.  When the core object model is fraught with silly limitations, it bothers me.
Logged



What would John Carmack do?
Glaiel-Gamer
Guest
« Reply #13 on: June 16, 2009, 08:50:59 AM »

IMO trying to reinvent the wheel that C++ does so well is ridiculous.

I understand trying to "improve" the language, but the fact is c++ does everything so well and most "features" of other languages can be added to c++ through libraries... written in c++.
Logged
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #14 on: June 16, 2009, 09:00:49 AM »

I love D, been getting into it for a while now. It's so clean and easy, like the PHP of C++.

It doesn't have many features more than C++, it just implements them better. Especially the template syntax is horrible in C++.
Logged
Glaiel-Gamer
Guest
« Reply #15 on: June 16, 2009, 09:01:45 AM »

I love D, been getting into it for a while now. It's so clean and easy, like the PHP of C++.

php is nasty and ugly looking
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #16 on: June 16, 2009, 09:45:03 AM »

But easier to use than some alternatives, for non-big-skills people.


That's right, D might be the PhP of C++. That don't make C++ obsolete in any way, only less interesting for people that don't need all it's power.



In fact, we don't care what you all prefer, the point of the article is just to make D one of your potential tool if you need to make something "high level" (like a lot of indie games).
Logged

Overkill
Level 3
***


Andrew G. Crowell


View Profile WWW
« Reply #17 on: June 16, 2009, 10:29:35 AM »

Okay, PHP is a terrible language to compare to. And C++ isn't going away anytime soon.

I haven't used D, admittedly, but I have read over the language features quite a few times. So I'll list a few things that sound neat.

The main draw for me about D is the lack of a preprocessor, and being able to use conditionally-compiled or inlined template functions instead.

I also like the fact that there is builtin memory management, but you can choose not to use it if for some reason you see it as a performance hit to your software.

There is also a built-in associative array type as a language feature, which makes it very easy to map non-integral types to values. I have no idea if it's hashed, or if it's actually a tree search though. At any rate, sort of neat for the convenience.

There are still pointers in D, but the language tries to make it so you don't need them most of the time. Not that pointers are big problems to any experienced C/C++ programmer, but still useful. And when the language is garbage-collected, the use for pointers decreases anyways.

Arrays have a builtin length operator (although std datatypes in C++ pretty much all have a size() too, so I dunno). There's array slicing notation, which is nifty. I don't particularly like their foreach syntax, but it's still useful as a feature.

The ability to declare lambdas and anonymous functions is kind of cool. Also I like that varadic functions aren't horribly bad like they are in C/C++. No more va_list macro hell.

Other neat things: better switch statements, mixins, interfaces, builtin support for contract programming (making unit testing easier), unicode, class properties.

This has more info: http://www.digitalmars.com/d/2.0/comparison.html
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #18 on: June 16, 2009, 10:53:52 AM »

I've read the article now.

I must say that my language of choice for game programming is C++ (and other languages for tools).

D seems very good in that article. I would be less reluctant to make a demanding game with D than C#, but only if:

 - there was an IDE as powerful as Visual Studio (for helping coding speed and debugging);
 - there was a stable and complete implementation of all the features Andrei is speaking about;


Anyway I'll keep an eye on it and might try it at least once a complete implementation of D2 is available.
Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #19 on: June 16, 2009, 11:12:21 AM »

Other neat things: ... interfaces

Interfaces aren't so much a feature as they are a lack of a feature, being true multiple inheritance.

My biggest issue with interfaces in Java and C# is that you can't have optional overrides.  All methods in an interface must be overridden, whether you want them or not.  The idea for optional overrides in interfaces seems so obvious to me, and I was really hoping that D would have it.
Logged



What would John Carmack do?
Pages: [1] 2 3 ... 6
Print
Jump to:  

Theme orange-lt created by panic