Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Rayno

D Language?

This topic is 5361 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Has anyone seen this new (about a year old) D Language? I was wondering if anyone had any first impressions on it. At first glance I think it has some interesting features. For example, strong typecasting of typedefs. If you define a type SPEED to be a float, in D you can''t use a float in the place a SPEED variable. There are some things I think look appealing. What do you guys thing?

Share this post


Link to post
Share on other sites
Advertisement
I am also interested in that thing, but now im learning c++ again so its better to stay away from that.

D looks somewhat more python like :D there is even garbage collection included. But i wont read more of that site now

Share this post


Link to post
Share on other sites
i moved completely from c++ to d and there is no reason for me to ever wine about it. it was the best move i''ve ever made. i was never faster, more productive, more efficient, and bether in programming in general than now.

D is great.

of course, thats just my opinion..

but other things that are great about it: size: it fits completely onto a floppy, the whole minimum toolset is about 700kb big
compiler speed: the compiler is VERY fast, this mainly due to the slim, elegant language design
i can use D as scriptinglanguage and programminglanguage at the same time in the same app, hehe.. due to that size and speed features of the compiler..

i really love it..




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

Share this post


Link to post
Share on other sites
quote:
Original post by Rayno
Has anyone seen this new (about a year old) D Language? I was wondering if anyone had any first impressions on it.
The page says December 1999.

Actually, I find that plays in its favor... A language almost four years old may be worth checking out.

I''ve glanced over it a few times, but my conclusion is that until D becomes mainstream, I''ll continue to use C++ for performance-critical code, and some other high-level language for the rest.

Cédric

Share this post


Link to post
Share on other sites
quote:
Original post by Cedric
quote:
Original post by Rayno
Has anyone seen this new (about a year old) D Language? I was wondering if anyone had any first impressions on it.
The page says December 1999.

Actually, I find that plays in its favor... A language almost four years old may be worth checking out.

I've glanced over it a few times, but my conclusion is that until D becomes mainstream, I'll continue to use C++ for performance-critical code, and some other high-level language for the rest.

Cédric




i don't see the need or fascination for it to be "mainstream". D is C and C++ compatible and conforms to the current standards of both. so unless you proved that code you run on ur C++ compiler of your choice runs that much faster than a D compiler, i don't see the validity of your statement of your statement, well besides the subjective point.

the only issue that i see with it is that it doesn't do multiple inhertance. from what i hear. that's a good thing :D

edit: the later posters are correct. my apologizes. the current standards are not handled completely, as i had said prior. excuse the misreading.


[edited by - Alpha_ProgDes on October 13, 2003 10:33:04 PM]

[edited by - Alpha_ProgDes on October 13, 2003 11:32:57 PM]

Share this post


Link to post
Share on other sites
quote:

D is C and C++ compatible and conforms to the current standards of both.


quote:

the only issue that i see with it is that it doesn''t do multiple inhertance.


These two statements appear to contradict each other ...

Share this post


Link to post
Share on other sites
Wow, now THIS is nice.

From the Converting C++ to D page:

quote:

Comparing structs
The C++ Way
While C++ defines struct assignment in a simple, convenient manner:

struct A x, y;
...
x = y;


it does not for struct comparisons. Hence, to compare two struct instances for equality:

#include <string.h>

struct A x, y;

inline bool operator==(const A& x, const A& y)
{
return (memcmp(&x, &y, sizeof(struct A)) == 0);
}
...
if (x == y)
...


Note that the operator overload must be done for every struct needing to be compared, and the implementation of that overloaded operator is free of any language help with type checking. The C++ way has an additional problem in that just inspecting the (x == y) does not give a clue what is actually happening, you have to go and find the particular overloaded operator==() that applies to verify what it really does.

There''s a nasty bug lurking in the memcmp() implementation of operator==(). The layout of a struct, due to alignment, can have ''holes'' in it. C++ does not guarantee those holes are assigned any values, and so two different struct instances can have the same value for each member, but compare different because the holes contain different garbage.

To address this, the operator==() can be implemented to do a memberwise compare. Unfortunately, this is unreliable because (1) if a member is added to the struct definition one may forget to add it to operator==(), and (2) floating point nan values compare unequal even if their bit patterns match.

There just is no robust solution in C++.
The D Way
D does it the obvious, straightforward way:

A x, y;
...
if (x == y)
...



Beautiful!


daveandrews.org, soon to be home to a GAPI Sprite Engine.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!