Sign in to follow this  
Dolf

The D programming language

Recommended Posts

Hello, I've been using C++ for quite some time now and I thought it might be handy to have some cross-language experience. Both for growing as a programmer and using that experience in C++ and for not turning into a dinosaur stuck with an old language. So I've been looking into D and it sounds really interesting, but I haven't been able to find any advanced tutorials. What are your thoughts on the future? Will D or C# be interesting for games? I haven't found a lot of middle ware that works with D, only something called "Derelict", but I guess that can change if it gains popularity by being really good. Andrei Alexandrescu, who is a C++ guru, shared some thoughts on the topic: http://www.ddj.com/hpc-high-performance-computing/217801225 He also wrote a book about it, I might buy it if I can't find any proper tutorials. Do you guys have any experience with D? How do you think D can relate to games? From what I read, it's like C++ but better designed, and therefore more productive. But you can still get your hands all dirty with pointer magic and disable the memory manager if you see an opportunity where you can outperform the garbage collector. PS. Yes, I would enjoy an interesting discussion on the pro's and con's of the languages.

Share this post


Link to post
Share on other sites
Oooo it's time for our regular D thread.

D has been around for ages now, pre-.Net it might have had a point, now I feel less so.

Your comment about the libs is a telling one; "if it can become popular". So far it's failed to.

It's like the year of the linux desktop; every year someone will claim that this! this is the year!

And yet each time the world spins on and it doesn't happen...

Share this post


Link to post
Share on other sites
Quote:
Original post by Dolf
I've been using C++ for quite some time now and I thought it might be handy to have some cross-language experience.

May I suggest learning Haskell or Clojure then? D might be too similar to C++.

Quote:
Original post by Dolf
[Andrei Alexandrescu] also wrote a book about it, I might buy it if I can't find any proper tutorials.

I am definitely going to buy it. I'm just into languages in general. Always nice to try new toys:

int[] arr = [ 1, 3, 4, 2 ];
sort!("a > b")(arr); // <--- SEXY AS HELL
foreach (i; arr) writeln(i);

Share this post


Link to post
Share on other sites
Quote:
Original post by Dolf

cross-language experience.
Quote:
Both for growing as a programmer
Quote:
not turning into a dinosaur stuck with an old language.


D is a dialect. So is C#, Java, C, .... They are all a family of C languages and all follow the imperative paradigm. If you know one, you know all.

All of these are basically dinosaur languages.

Today, functional languages are the brave new world and the future (Lisp people sigh deeply).

Also, javascript and Ruby.

Quote:
and therefore more productive.

Productivity comes primarily from middleware or standard library (Java-like, everything and kitchen sink), community and adoption. Language itself has surprisingly little to do with it.

Share this post


Link to post
Share on other sites
Maybe I'm a bit C++ biased but honestly I think C++ is underutilized. I'd rather see better written functions and more readable C++ code then argue over semantic tricks or benifits of 80% C++ language with 30% different quirks. For instance wouldn't it be nice to see more Unicode used. I found for instance if you use a unicode input tool such as unicodeinput.exe you can substitute π instead of D3DX_PI in your coding definations with a quick define header. So code like area=πr2 becomes really easy to understand which is really the goal of high level languages anyways.

Also when I see a sort in haskal when sort definitions have already been written I ask why reinvent the wheel(as I'm guilty of that myself).

As for .net you can mix the clr in C++ which is also nice and get the benefits of both traditional C++ and .NET.






Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Quote:
and therefore more productive.

Productivity comes primarily from middleware or standard library (Java-like, everything and kitchen sink), community and adoption. Language itself has surprisingly little to do with it.

And from good tool support (although maybe you grouped that under middleware). IMHO that's always been D's greatest failing - easy interop with C and C++ meant there were plenty of libraries usable from D, but there were never any good IDEs that I saw.

Share this post


Link to post
Share on other sites
Quote:
Original post by ptroen
As for .net you can mix the clr in C++ which is also nice and get the benefits of both traditional C++ and .NET.
I have seventy thousand lines of C++/CLI code sitting in front of me, forming a production library. The only thing "nice" about it is the sheer incredible achievement that it works at all. Useful yes; nice, not a chance.

Share this post


Link to post
Share on other sites
Quote:
Original post by DevFred
Quote:
Original post by Dolf
I've been using C++ for quite some time now and I thought it might be handy to have some cross-language experience.

May I suggest learning Haskell or Clojure then? D might be too similar to C++.


I second both of those suggestions. Also consider picking up any of the other Lisp dialects, Smalltalk, Prolog, Forth, or APL - all of which will be quite mind-expanding for someone used to C++.

Quote:
Original post by ptroen
Also when I see a sort in haskal when sort definitions have already been written I ask why reinvent the wheel(as I'm guilty of that myself).


You were probably looking at a code sample meant to showcase the language, and that's what a code sample is; a short snippet showing how to accomplish a common task. The rationale behind showing people these samples is, if the language can replace 20 lines of C code with 2, think of what it could do to a codebase with hundreds of thousands of lines.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
And from good tool support (although maybe you grouped that under middleware).


IMHO, tool support isn't strictly needed. javascript, Python and Ruby on Rails are all example of it. javascript hasn't had a decent debugger for years, Python got hold in academia, where IDEs are considered blasphemy. These days, many of new languages get quick support on JVM in either NetBeans or Eclipse, so this barrier has been lowered considerably, or completely eliminated (repository and general project management).

IDEs are important for very UI centric applications. Delphi and its legacy in .Net are great examples of that, Visual FoxPro is another. This is where VS and NetBeans made a huge difference. They tend to be relevant for business development, since they prove suitable for non-programmers, or at very least for non-dedicated programmers.

Conversely, as far as web apps go, UI tools have historically proven to be a dead end, and even the infrastructure has often been very rudimentary. Again, Eclipse helps to bridge the gap here for relatively low cost, with the myriad of other tools.

And then there's still the whole Emacs and vi crowd when it comes to C and C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Quote:
Original post by OrangyTang
And from good tool support (although maybe you grouped that under middleware).


IMHO, tool support isn't strictly needed. javascript, Python and Ruby on Rails are all example of it. javascript hasn't had a decent debugger for years, Python got hold in academia, where IDEs are considered blasphemy.

True, you can get away without "big" tools like Eclipse and VS for languages which are looser with their types. But for strong, statically typed languages (which IMHO D falls under) you need a good IDE to be productive. Otherwise you waste huge amounts of time everytime you want to make even a trivial refactoring.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Quote:
Original post by OrangyTang
And from good tool support (although maybe you grouped that under middleware).


IMHO, tool support isn't strictly needed. javascript, Python and Ruby on Rails are all example of it. javascript hasn't had a decent debugger for years, Python got hold in academia, where IDEs are considered blasphemy. These days, many of new languages get quick support on JVM in either NetBeans or Eclipse, so this barrier has been lowered considerably, or completely eliminated (repository and general project management).
...


Actually, Python has great tools. When it comes to IDEs, you've got Wingware's WingIDE, and ActiveState's Komodo IDE. There are undoubtedly others, but for the sake of argument, I'll stick to the familiar. They're extremely usable, and I believe python wouldn't be nearly as widespread without them.

However, if you look at something like IronPython, there's a distinct lack of a stable useful IDE, and it really hurts the adoption of the dialect. Sure, technically it isn't needed, but not everyone is a masochist who goes out of their way to make life harder by not using productive tools where available.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
D is a dialect. So is C#, Java, C, .... They are all a family of C languages and all follow the imperative paradigm. If you know one, you know all.

All of these are basically dinosaur languages.

Today, functional languages are the brave new world and the future (Lisp people sigh deeply).
C# is a multi-paradigm language, allowing you to use some functional programming features if you so desire. [wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by OminousZounds

However, if you look at something like IronPython, there's a distinct lack of a stable useful IDE, and it really hurts the adoption of the dialect. Sure, technically it isn't needed, but not everyone is a masochist who goes out of their way to make life harder by not using productive tools where available.


I wouldn't call this a notable reason.

Python has historically been heavily supported by open source community. Obviously it will not care or advertise a version that runs the The Devil's CLR. Look what happened to recent mono inclusion in Linux distribution.

And .Net crowd is built from MSCPs, which adore the .Net, but get confused when they see Python source. It's not VB, it's not C# - what is it? And since there is no certificate in Curiosity, nobody cares to take a second look.

These two communities are incompatible. The value of .Net comes from .Net itself, not the language its used in. MS does not need Python, it needs to support too many languages as it is.

And on the other side, Python developers have long ago solved the problem of frameworks, so they have no need for .Net, let alone the licensing complications which come with it. Nor do they want it.

Two different worlds, with little need or interested to connect.

Right tool for right job. To work in MS-centric ecosystem, use the appropriate tools. Python is IMHO just not one of them, at least not for the .Net-centric development.

Quote:
C# is a multi-paradigm language, allowing you to use some functional programming features if you so desire.


So is C++. So is objective C. So is Java.

Here's an idea - post this on a Lisp or Haskell board. Keep the engine running though...

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Quote:
C# is a multi-paradigm language, allowing you to use some functional programming features if you so desire.


So is C++. So is objective C. So is Java.

Here's an idea - post this on a Lisp or Haskell board. Keep the engine running though...


C++, C and Java definitely do not cater to functional programming to the state that C# or even D do. They all do not have full inbuilt support for first class functions, closures nor a library of simple higher order standard functions. C neither has support for forall polymorphism.

As for Lisp, assuming you mean Common Lisp it actually feels more natural to do functional programming in C# than that Lisp. CLisp tends to not be used for functional programming. Scheme is more famous for that. A new dialect mentioned in this thread that is really functional is Clojure.

Monadic programming using Linq is a really powerful feature of C#.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
Quote:
Original post by Antheus
Quote:
Original post by OrangyTang
And from good tool support (although maybe you grouped that under middleware).


IMHO, tool support isn't strictly needed. javascript, Python and Ruby on Rails are all example of it. javascript hasn't had a decent debugger for years, Python got hold in academia, where IDEs are considered blasphemy.

True, you can get away without "big" tools like Eclipse and VS for languages which are looser with their types. But for strong, statically typed languages (which IMHO D falls under) you need a good IDE to be productive. Otherwise you waste huge amounts of time everytime you want to make even a trivial refactoring.


Haskell and OCaml have much stronger type systems than C# and Java, but programmers regularly use those languages without specialized IDEs.

Share this post


Link to post
Share on other sites
Quote:
Original post by Captain_Thunder
Quote:
Original post by OrangyTang
True, you can get away without "big" tools like Eclipse and VS for languages which are looser with their types. But for strong, statically typed languages (which IMHO D falls under) you need a good IDE to be productive. Otherwise you waste huge amounts of time everytime you want to make even a trivial refactoring.


Haskell and OCaml have much stronger type systems than C# and Java, but programmers regularly use those languages without specialized IDEs.


I suspect he was missing an "explicit" somewhere in there. Having to work with explicitly defined types (and the whole related clutter in languages like Java) is painful without an IDE.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
And since there is no certificate in Curiosity, nobody cares to take a second look.

Wow. That is one powerful, oh so true, statement. (Plus it made me literally laugh out loud.) In one sentence, Antheus has summed up ten million (?) usenet flame wars.

I have been places (newsgroups, message boards) where legitimate knowledge, techniques, whatever are presented for discussion and the participants not only have NO curiosity, they have an outright contempt for any information that hasn't been sanctified by their "tribal leaders."

I remember when being a software engineer was ALL about curiosity. "Hey let's try this and see what happens!" It's all become so corporate and bland now. Hmm, just like MS. ;-) And all the engineers are perfect little corporate drones running around with a certificate.

Can anyone still sing all the versus of the Lumberjack song? <Wink wink, nudge, nudge>.

"Asking programmers to do something without giving a reason is treating them like small children - they ought to be offended by that." - Bjarne Stroustrup

Share this post


Link to post
Share on other sites
Quote:
Original post by JustBoo
Quote:
Original post by Antheus
And since there is no certificate in Curiosity, nobody cares to take a second look.

Wow. That is one powerful, oh so true, statement. (Plus it made me literally laugh out loud.) In one sentence, Antheus has summed up ten million (?) usenet flame wars.

I have been places (newsgroups, message boards) where legitimate knowledge, techniques, whatever are presented for discussion and the participants not only have NO curiosity, they have an outright contempt for any information that hasn't been sanctified by their "tribal leaders."

I remember when being a software engineer was ALL about curiosity. "Hey let's try this and see what happens!" It's all become so corporate and bland now. Hmm, just like MS. ;-) And all the engineers are perfect little corporate drones running around with a certificate.

Can anyone still sing all the versus of the Lumberjack song? <Wink wink, nudge, nudge>.

"Asking programmers to do something without giving a reason is treating them like small children - they ought to be offended by that." - Bjarne Stroustrup


When you are young and just starting out having curiosity and giving lots of things a try is a good thing. But the corporate world is quite a bit different now then 20 years ago. You can't have programmers going off on treks with random languages to spend millions of dollars to find out it doesn't work. You stick with the bland, tried and true methods you know will work. Everybody knows that C++ works, everybody is seeing that .NET gets more traction everyday and supports a lot of cool things. When you want to contiue to eat you use what works.

Share this post


Link to post
Share on other sites
Quote:
Original post by jtagge75
But the corporate world is quite a bit different now then 20 years ago. You can't have programmers going off on treks with random languages to spend millions of dollars to find out it doesn't work. You stick with the bland, tried and true methods you know will work. Everybody knows that C++ works, everybody is seeing that .NET gets more traction everyday and supports a lot of cool things. When you want to contiue to eat you use what works.
Except it doesn't actually work that way. Look at all the companies out there using/developing/supporting 'hip' languages: Yahoo and LISP, Google and Python, Microsoft and F#. Now admittedly, all of those are big companies, and can well afford to futz around with strange languages, but at least in the cases of Google and Yahoo, they used these languages to build a huge chunk of their infrastructure.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
at least in the cases of [..] Yahoo, they used these languages to build a huge chunk of their infrastructure.

Um yeah, and then they rebuild it in C++. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Python has historically been heavily supported by open source community. Obviously it will not care or advertise a version that runs the The Devil's CLR. Look what happened to recent mono inclusion in Linux distribution.

It's not quite that simple.

The Python community has an overlap with the open source community, but is by no means a subset. The viability of not one but two closed source, commercial IDEs - one of them even built on Mozilla's XUL technologies, yet still closed source! - is a clear indication of the pragmatism of the Python community. The reason IronPython falters is not because it isn't open source (in fact, it is), nor is it because of the lack of Visual Studio integration (for which there are several approximations), but because IronPython diverges from CPython.

CPython is the de facto language definition, as no real formal language specification exists. IronPython, therefore, is in effect a separate, derivative language - somewhat akin to Boo. You will note that other Python variants are limited in application scope and adoption - RPython and PyPy, Stackless Python, Jython, etc. In other words, IronPython isn't Python. As Python programmers, we can't use Python libraries with IronPython, nor can we run IronPython code with the CPython interpreter. It simply doesn't work for us.

Share this post


Link to post
Share on other sites
Quote:
Original post by WanMaster
Quote:
Original post by swiftcoder
at least in the cases of [..] Yahoo, they used these languages to build a huge chunk of their infrastructure.
Um yeah, and then they rebuild it in C++. [smile]
And do you recall the reasons for that? The company didn't think it could find enough LISP programmers, so they turned down the ones who applied, and hired C++ programmers instead. Then they rewrote the (massive) code-base into C++, which took over 2 years, and forced them to drop a slew of features. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by WanMaster
Quote:
Original post by swiftcoder
at least in the cases of [..] Yahoo, they used these languages to build a huge chunk of their infrastructure.
Um yeah, and then they rebuild it in C++. [smile]
And do you recall the reasons for that? The company didn't think it could find enough LISP programmers, so they turned down the ones who applied, and hired C++ programmers instead. Then they rewrote the (massive) code-base into C++, which took over 2 years, and forced them to drop a slew of features. [smile]

Pretty much spot on. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by jtagge75
But the corporate world is quite a bit different now then 20 years ago. You can't have programmers going off on treks with random languages to spend millions of dollars to find out it doesn't work. You stick with the bland, tried and true methods you know will work. Everybody knows that C++ works, everybody is seeing that .NET gets more traction everyday and supports a lot of cool things. When you want to contiue to eat you use what works.
Except it doesn't actually work that way. Look at all the companies out there using/developing/supporting 'hip' languages: Yahoo and LISP, Google and Python, Microsoft and F#. Now admittedly, all of those are big companies, and can well afford to futz around with strange languages, but at least in the cases of Google and Yahoo, they used these languages to build a huge chunk of their infrastructure.


As you basically said, if you are worth billions then dropping a few million here and there to see what happens is nothing. But most businesses aren't worth billions.

Share this post


Link to post
Share on other sites
Even little companies can't afford to be 'those assholes still using Cobol' either. Business requires some semblance of adaptability to survive.

That said, D is not the answer. Many of the people who were looking for something better than C++ have already found it. D doesn't really do anything significantly better than those to justify adopting in the face of its downsides.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this