The online racing simulator
D
1
(32 posts, started )
D
Why does wheel4hummer have a thread titled "D" you may ask? If you have not heard of it already, it is a new programming language! i think its pretty cool, simply because it is new. But, besides that I don't know whether it is that good of a programming language.

http://www.digitalmars.com/d/


Discuss...
Aww, I just got into C++ now I got to get into D! Crap OT You use that 5000 yet :P
It's not that new.

It's a reasonable gap between something like c and python imho. You don't have to worry about memory as such, but you can do a number of interesting / cool things with it.
its just not as good in school.
#6 - Stuff
Ahh! You read /. and/or digg too eh?

While I'm still learning the intricacies of C++ so I can't really give an in depth comment. It does look promising with the OOP and memory management of Java yet the speed of C++. I will definitely be checking it out in my spare time. Always good to learn something new because if you get stuck in one area, all you do is sink..
looks like a good beginning for me, but:

I think the namespace-oriented style of C#.NET / C++.NET is better, because it's just more cleaned up. D will have the same problems as the old C++ 6.0 had: you simply have no overview about which class does what.
Granted, I'm a C# guy, but I think some of the Yes/No statements in the comparison table are simply wrong or at least out of date.
Spotted this yesterday and downloaded the spec.
I'm been going through it this evening trying out some stuff and I must say it is very cool.

Bearing in mind I'm a PHP programmer with a little exposure to pretty much every language going, it seems to introduce some language features that were up until now (that I'm aware of) only thought of as dynamic language features to compiled languages.

Run time type info is available and it takes care of some implicit (albeit simple) casts automatically. Add to that dynamic arrays, garbage collection, anon functions, binary compatibility with existing C libs, integrated unit testing and much less reliance on pointers than C and you have a pretty spanky new language. (edit: there are an assload more features I forgot)

My only concerns are what extra complications might be introduced when using libs from other languages (mainly C I guess, which shouldn't be too bad) and what complications will arise for other language users (again, C mainly) when trying to interface with libs written in D?
I guess both will have been thought of already, but whether the outcome is a tasteful one is a different matter.
Quote from wheel4hummer :Why does wheel4hummer have a thread titled "D" you may ask?

I'm not much of a programmer, but I have to say, that exact statement was almost blurted out loud when I saw the title! LOL
#11 - nilo
yet another {};-language...
Quote from nilo :yet another {};-language...

what's bad about that? it structures code very well!
Seems like a very nice concept. I was wondering many times why this kind of language doesn't exist yet. Something that is as productive as C#, fast as C (or even better hand-crafted asm) , and has all the standardized portable libraries you need (no such language yet or maybe java ?).
Quote from MonkOnHotTinRoof :no such language yet or maybe java ?

There's a massive problem with Java - it's generally not RSI friendly (for instance "system.out.print" just to print a message. Lovely.)
Quote from nilo :yet another {};-language...

Python makes more sense to me. For example, a function in python looks like:

def function(arg1,arg2):
print arg1
print arg2

And in C#\C++, how do you do that? Python is the best programming language ever. (Well, easiest for me).
Quote from wheel4hummer :

def function(arg1,arg2):
print arg1
print arg2

And in C#\C++, how do you do that? Python is the best programming language ever. (Well, easiest for me).

For C, assuming a character array as the arguments (You could do something interesting with argument lists (va_list) if you wanted it to be truely type neutral).
void functionname(const char *arg1, const char *arg2)
{
printf("%s\n%s", arg1, arg2);
}

C++, assuming character arrays again (although something could be done for each data type, or even using templates - which means any data type, as long as it has the streams operators defined)
void functionname(const char *arg1, const char *arg2)
{
cout << arg1 << "\n" << arg2;
}

And in D:


import std.stdio;

void func(char[] arg1,char[] arg2)
{
writef("%s\n%s",arg1,arg2);
}

void main()
{
func("123","4343");
}

which compiles to about 100K exe file
Code looks a lot like java
And in PHP

<?php 
function blah($var) {
   print 
$var;
}
?>

Yes, I know PHP is only a web programming language. (It can be used with Windows though, if you use one of the extensions)
And in C#
using System;

namespace TestConsoleApp
{
class Program
{
static void Main(string[] args)
{
Foo("Hello", "World");
}

static void Foo(string a, string b)
{
Console.Write(a + "\n" + b);
}
}
}

Or even better
using System;

namespace TestConsoleApp
{
class Program
{
static void Main(string[] args)
{
foreach (string a in args)
Console.WriteLine(a);
}
}
}

foo('a', 'b');

sub foo {
map { print "$_\n"; }@_;
}





Regards,

Ian
Quote from MonkOnHotTinRoof :which compiles to about 100K exe file
Code looks a lot like java

Hmmm, I just compiled the same program under linux (gdc) and got a 280k file!

O3 flag made no difference on size but for such a simple program there probably isn't much to be done.

The same program in C, compiled with gcc takes 7k!

I wonder what extra stuff D has to put in to support the new language features and how much of it is really necessary
Leifde, PHP is NOT just a web programming language. You can use it via command line, and it is also very powerful in that respect. You can use C# in a web server for server output if you really wanted to. You could also do the same for assembly code (and man, that would be a freaking fast web server.)

D seems like a nice programming language, It's got some very cool things going for it, BUT. 100K EXE file for hello world is stupid. I'd really like to know what all of the extra stuff is in there, and I can't really believe that a 100K EXE file is faster then a 7K EXE file for the same task. How ever, I will keep an open mind towards D. If some one wants to show me the numbers that it is faster then C++ then by all means do so. Untill then, I'll stick with C, and PHP.

P.S. To Each His Own. No need to start a 'My programming language is better then your programming language', I think we have all seen to many of those.
Quote from Anarchi-H :I wonder what extra stuff D has to put in to support the new language features and how much of it is really necessary

Probably the cause is static linking with phobos library. If you skip the imported write function, size drops to 64k. Uhm, which is still a lot for an empty main func . Sure, managed memory and such features take their toll, but still...

Of course, if you statically link C++ code with CRT, you will also end up in 100k or even 1M file size, depends on your CRT provider...
About speed: you can't expect that language with managed memory will be faster than C (which is medium-level lang), but well optimized code could get very close...
Quote from Dygear :P.S. To Each His Own. No need to start a 'My programming language is better then your programming language', I think we have all seen to many of those.

Like I said, Python is just easier for me.
I like PAWN myself ... no pun intended. Only wish it had struts ... well, SourcePawn should fix that .
1

D
(32 posts, started )
FGED GREDG RDFGDR GSFDG