Domain: digitalmars.com
Stories and comments across the archive that link to digitalmars.com.
Comments · 230
-
Re:Not a lot of selection for Linux compilers, eh?
Compilers for Windows: Microsoft's, Borland's, icc, gcc-mingw
For Windows there are also
Digital Mars - used to be Symantec C++
LCC
Open Watcom
I think there are more for Linux also, like Visual Age
etc.
-
Resistence is futile?Well, probably like lots of other folks here, I develop projects and program for a living. Although I've programmed in Java and recognize the tremendous ease with which one develops some complex stuff, I can't help feeling some resistence in applying it to new projects. A few considerations and reflection about it is probably in order.
The argument that it's portable fails to meet the fact that many of the times you do NOT want to care about installing the latest JRE on the destination computers. I'd be happier with compilation to native format. I know GJC and the likes, but they don't work 100%, although they're progressing a lot.
On clients, I find some resistence to Java due to the way it's marketed. "Isn't that for cellphones" - they ask. Stupid? Not really... that's the message the media hands out for Java nowadays (at least around here). We've had clients that knew where PHP, C and even Delphi fit in in their solutions, but failed to recognize Java. Maybe this is just something local to this country though. :)
At times, the verbosity of Java really gets on my nerves. I'm a lot more productive using a combination of VI and Screen than in most IDEs, so regardless of auto-completion, I resent having to type stuff like:
X509CertificateSimpleChainVerifier x = new X509CertificateSimpleChainVerifier();
I mean, wouldn't it be possible to ommit the type again from the new operator? I'm sure the parser could infer the default type from the variable it's being assigned to. :p
Please, this is just an example. When you develop for a long time in something like Perl, PHP or Python you end up resenting writing too much. Sure those are typeless or just have yupe hints but still... I'm sure others will have different complains. What I sometimes feel is that compared to a pet language like D http://www.digitalmars.com/d/ it feels a tad old!
*ducks at the flames* -
Re:The language does matter1) Java has bounds checking for arrays, C++ doesn't. This is specified in the language. This affects performance.
Definitely.
2) Java has garbage collection, C++ doesn't. This is specified in the language. This affects performance.
Hmm... this is probably true in a lot of cases, but read this. (The guy's written a C++ compiler, and the D compiler - D is garbage-collected).
Also, the specification of Java says that it should be compiled to byte code and executed in a JVM.
Really? IIRC, the language spec only defines the semantics of the language, and the VM spec talks about the format of programs, so GCJ could in theory be compliant with the language spec, but the VM spec would be irrelevant. Of course the language was designed to be interpreted, so there are probably performance penalties in both JITed and precompiled code there...
-
Lingo of tha Guh-nuuum
Personally, I'd love to see D being used instead of
.NET or Java. For one, I don't trust Microsoft to let Mono live when an important part of the Linux desktop is dependant on it. Second, as for Java, it leaves too big of a memory footprint, and it is still not available on all distros.
Besides that, I don't like VMs, but that's a personal thing. :)
So, why not D? Most people knows the advantages, or can otherwise check the website [http://www.digitalmars.com/d/index.html]. It's very clean, familiar, fast and gives most or more advantages than C#/Java. It has gotten far in development. The frontend is being integrated to GCC. So why not? -
Check out DThe D programming language includes language support for design-by-contract but, unlike SPARK, it's a sane language. (It's C++ without the suck and with some more modern features.) I'm still investigating it, and it's still under development , but I strongly recommend checking it out, C++ fan or not.
Here's a (necessarily trivial) example, taken from the website:long square_root(long x)
in
{
assert(x >= 0);
}
out (result)
{
assert((result * result) == x);
}
body
{
return math.sqrt(x);
} -
It's been done
and it's called the D Programming Language. It has Design by Contract and unit testing built in to a C++ like language.
-
The D Programming Language
already has, as part of the language, Design by Contract and unit testing. The D Programming Language. These provide the robustness capabilities, but while having the power of a C++ like language.
-
design by contract: D Programming Language
The D programming language has design by contract. It seems pretty similar to the SPARK idea...
Check this out.
It's part of a presentation that can be found here
-Reuben -
design by contract: D Programming Language
The D programming language has design by contract. It seems pretty similar to the SPARK idea...
Check this out.
It's part of a presentation that can be found here
-Reuben -
design by contract: D Programming Language
The D programming language has design by contract. It seems pretty similar to the SPARK idea...
Check this out.
It's part of a presentation that can be found here
-Reuben -
Some ideas
They might not be revolutionary, but the is a few ideas
which can be just to reduce the number of bugs in a program.
1) 100% unit test coverage of your programs.
2) Statistical Debugging
3) Valgrind
4) The D programing Language
with build in support for unit testing, contracts and class Invariants. -
Re:Creative null character?
Theoretically, it's because having a limited-size counter limits the sizes of your strings, such that one couldn't load into a Pascal string a text file with more than 65536 characters (256 in the example you provided, but no one would use a single byte for length count).
Conversely, zero-terminated strings are limited only by available memory. Still, there's a tendency for them to go away and be replaced, except for the kernel, because
.NET and JAVA aren't going to go in there for a long time yet: they just weren't made for it. D might, though. -
MOD PARENT UP!!
Good god, people, the creator of the language deserves better than a score of 1---especially when he's counter-attacking a piece of FUD that got way over-modded.
Further discussion on memory management as it relates to D can be found here.
A slick, responsive 3D fighter game written in D (and somehow unencumbered by the burden placed on it by the garbage collector) can be found here. Source included, so you can see how slick it is on the inside.
And Walter: Thank you. I've spent a lot of time reading and interpreting the ISO C++ standard, and it usually leaves my brain feeling itchy, flaky, and swollen. With that in mind, I'd just like to say that, after reading all the specs I could find, D (so far) seems to me like the Gold Bond Medicated Powder of programming languages. :-) -
Re:Success is ElusiveWhile the odds against D have been daunting, it is well on the exponential growth/adoption curve. The D newsgroup (news.digitalmars.com) has over 25,000 postings in it, and the downloads of the language increase substantially month by month. There's now a gnu version of the compiler, and a growing list of third party libraries and projects for it (see these, for example).
The real question is, when are you going to write a book on D?
:-) -
D does have templates
see templates
-
Re:plenty of mistakes
Uh, again, you seem to have misread the topic of this discussion
No, you have failed to see that I was responding to the comparison sheet that the author of the D language put together and that was linked to from the story. That comparison sheet contained numerous errors and misstatements about C, C++, C#, and Java.
"[The ability to integrate assembly code into the high-level code is] an implementation-dependent feature, not a language feature of C/C++."
Not really. To be useful, the language has to be flexible enough to let the asm code talk to stuff written in the higher-level language. How do you do that with Java/C# again?
As I was saying, none of the languages provide it: not C, not C++, not Java, not C#. Many C/C++ implementations happen to contain that extension, but it's not a feature of the language.
But I don't see any reason why it should be hard to add to C# or Java if anybody cared to; after all, Lisp had in-line assembly.
I have, with Java, and it is far from being trivial, and not all code can even be compiled in this way (typically because it depends on swing or similar libraries which make undocumented calls right into the VM).
I simply stated that the Java language can be compiled that way. Obviously, most Sun Java programs cannot because they rely on numerous proprietary libraries.
As for C#, I have yet to see a convincing native code compiler. No, pre-JITting is not the same thing, as you still need a ton of supporting framework (and often the original DLLs for the metadata).
Java and C# have native code compilers that work in non-batch mode. In the case of C#, it's a standard component of Microsoft's platform. No, it doesn't generate standalone code, but that wasn't the point made in the comparison.
What functionality is that then? D appears to have all the features I like from C# and Java (as a language) but without the obnoxious 30mb runtime download for the VM and associated tools. Why, pray tell, do I want a VM in the first place?
The ability to load code at runtime, the ability to write software components that work on different CPU architectures even if the main program runs natively, the ability to write portable code transformation tools, and the ability to sandbox untrusted code, among others.
Besides, you are living in a dreamworld if you think that C or C++ require less space for the same functionality. While I think that Sun's JRE is bloated in terms of how much functionality Sun throws into it, in terms of bang-per-megabyte, the JRE and other VM-based languages are far better than natively compiled languages.
That's wierd. I could have sworn that both Java and C# were getting generics/templates in their next versions.
No, C# and Java are not getting templates, but they are getting a parameterized type facility; the comparison table should have listed that but failed to. If D indeed has templates (meaning, the same kind of facility as C++), then that was a lousy design decision.
Altogether, I suspect that both he and you are simply confused about what templates and parameterized types actually are, although you seem to be confused in slightly different ways from each other. -
Nice Comparison
Heh.
Nice feature comparison, except for the fact that it's wrong. Perhaps the authors of D would do better if they actually learned C++ first? Designing a new language when you're clueless is the first sign of disaster. Look at Java.
Resizeable arrays: D Yes, C++ No
BZZT.
Arrays of bits: D Yes, C++ No
BZZT.
Built-in strings: D Yes, C++ No
BZZT.
Array slicing: D Yes, C++ No
BZZT.
Array bounds checking: D Yes, C++ No
BZZT.
Associative arrays: D Yes, C++ No
It's called a map.
Inner classes: D Yes, C++ No
BZZT (perhaps they meant specifically the automatic parent resolution?)
typeof: D Yes, C++ No
BZZT.
foreach: D Yes, C++ No
BZZT.
Complex and Imaginary: D Yes, C++ No
BZZT.
Struct member alignment control: D Yes, C++ No
Give me a break, every C++ compiler supports this. It's just implementation defined.
Now go look at D's page on Design By Contract in C++: here
Notice that any C++ programmer can come up with a far better implementation than theirs using child class destructors and inlining. In fact, Stroustrup even put one in his book in case you're having trouble getting the brain in gear.
The comparison list combines cluelessness and sophistry ("C++ doesn't have this feature! It's in the STL, not the language" - oh please) to try to promote their own half-baked language.
Conclusion:
Yet another half-baked useless language. -
Re:Preprocessor not archaic, and templates require
I don't get it, what is wrong with D's templates. Admittedly, I haven't used D, but it sounds like it has templates to me...
-
Re:Unneeded history
The article is wrong. D is not at all C compatible. See Programming in D for C Programmers
-
Re:Sounds like a good ideaWhat I found interesting was that they claim applications with garbage collection to be faster. I would never have expected this.
The D approach is pretty much taking the best from C++, Java and C#, and you can find a lot the stuff you were asking yourself "why is this not possible in [insert current language]" in it. For example what they call function deletates is really missing in C++.
However, some time will pass until a usable compiler will be available for *any* plattform.
-
Re:Sounds like a good ideaWhat I found interesting was that they claim applications with garbage collection to be faster. I would never have expected this.
The D approach is pretty much taking the best from C++, Java and C#, and you can find a lot the stuff you were asking yourself "why is this not possible in [insert current language]" in it. For example what they call function deletates is really missing in C++.
However, some time will pass until a usable compiler will be available for *any* plattform.
-
Design by Contract
I was oddly confused when I read that un-sourced term in the quickie part of the story...so, from this page:
Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. Digital Mars introduces the first C and C++ compiler to support contracts. Building contract support into the language makes for:
1. A consistent look and feel for the contracts
2. Tool support
3. It's possible the compiler can generate better code using information gathered from the contracts
4. Easier management and enforcement of contracts
5. Handling of contract inheritance
The idea of a contract is simple - it's just an expression that must evaluate to true. If it does not, the contract is broken, and by definition, the program has a bug in it. Contracts form part of the specification for a program, moving it from the documentation to the code itself. And as every programmer knows, documentation tends to be incomplete, out of date, wrong, or non-existent. Moving the contracts into the code makes them verifiable against the program.
-
The D Programming Language
fits the requirements just file. TDPL. There's even a gnu implementation of it now.
-
And no mention of D...The D language offers a nice blend of higher-level languages like C# and Java while keeping more to the notions of C/C++ (you only pay for what you use, generally). It is not suffering from hazy legal issues and doesn't believe it is saving the world. It is still in development but it looks like it is hard to beat for the sweet spot of compability (call C APIs just fine), performance, and dependencies. I dislike their generics syntax, but I can live with it.
This seems like a natural fit for developing desktop applications that don't feel like they're running under a VM, yet they are still garbage collected.
-
C isn't dead, but it should be
But it ain't happening any time soon. Nevertheless: D, anybody?
-
Re:I would take C++ over Java/C# anytime
I would like to see a language that preserves as many features of C++ as possible while adding garbage collection, memory safety, language-based security and guaranteed binary compatibility between platforms/OSes. I don't think managed C++ is "it". Why can't a VM support multiple inheritence? Any pointers?
It's been a while since I looked at it, but the D language seems to address many of your gripes (other than multiple inheritance).
-
Re: C's not dead because nothing better....
-
Re:C is Dying?
Maybe because the D programming language is set to replace it. As if we'd be so lucky.
-
Re:Uh oh
This is one of the big problems with C & C++. Several languages either catch these, or can catch them if the debug flag is set. But they need to know what's a pointer, so no integer casts are allowed.
Examples of languages that can handle this particular problem include Eiffel, Ada, and D. (Actually, as D is still in beta, I shouldn't have mentioned it. But it's my current favorite. Digital Mars D.)
Eiffel is another good choice, but many implementations are a bit slow. And Ada is complex compared to C (though not compared to C++) , but it has many other nice features...as well as a few clunky ones.
I'm sure that there are many other languages that can handle this problem, but those are the only one's that I know that are also suitable for systems programming (*two* constraints). -
Re:Why do big companies want pseudo-compiled langs
can't imagine a Java program full of casts
If you can't imagine it, you haven't seen it, either.
If you haven't seen a Java app with lots of casts, it means the app didn't use collections. Which means it was a trivial app.
it's not applicable to Java or other GC languages
D can do it.
But if you can write a C++ program without memory leaks you will have no problem closing every resource
I don't have to close anything. RAII takes care of that.
Because if there are less people trained to do a thing you have to search harder/pay more/train more before things get done
But if people aren't trained, how are they gonna learn ? it's a chicken and egg problem.
I don't understand what is your point here. You first seemed to support the idea that Java was to slow to do this, now the opossite. Or where just mentioning the article? I'm a little lost here
I never said that Java is slow in numerical computations. I said that the article(s) you posted had flaws in it(them)...these "flaws" are deliberate, in my opinion, from people that never gave a dime understanding C++ and how they can be productive with it. For example, they did not compare the top Java version 1.4.2 against a top C++ compiler such as the Intel one. It's unfair, it's biased.
I also said that Java is generally slower than C++, mostly because of the way collections/iterators work, no value objects and because of the GC.
I think that Java will always be slower (even a little) than C++.
Well, the difference will be so small, as to be negligible. Eventually, the language and the JVM will improve so much as to reach the state of a statically compiled language.
But I remember when most programs were made in assembler and C was the slow new language. C winned in the because it was easier (that subjetive concept) to write programs in, rather that because of it's speed.
Nope. The jump from assembly to C gave you a 10x boost in productivity, while the jump from C++ to Java gives you 0.1x boost. In reality, it gives you nothing, if the libraries you use are well written(Qt for example).
Have you worked with Qt ? it is the best library ever written. Don't let others fool you: it gives you the full power of C++ and Java!!! you don't even have to manage memory. It has a wonderful signals and slots mechanism, and plenty of classes for everything. And a program you write under Windows runs as-is in Linux/Mac/Solaris/Unix. No, I don't work for Trolltech, but I am so much impressed with it, I can't stop talking about it. Something made in Java is usually done faster and better in Qt.
Of course, Java has its own good points. But its not all that is cranked up to be. For example, you may have not to delete things, but you sure have to make pointers null. IF you don't, memory is not released. I have seen this numerous times, and it is the Java memory leak problem (leak, in the sense that it is never freed).
-
Re:Because pseudo-compiled languages are better..
You can get garbage collection and array bounds checking in fully compiled languages (such as D), too.
And you'd better still worry about such things to a certain extent, or else you'll be throwing exceptions on legitimate usage cases when your fixed-size buffer turned out to be too small, running out of memory because you didn't bother nuking references to old objects, etc.
-
C is forever
Nothing will ever get rid of C or C++. Java tried, C# tried, hell, D language tried. When's the last time you heard of D?
Oh, and if your next question is: why would we want to get rid of C... you're kidding, right?
-
The D Programming Language
The D Programming Language is the evolutionary successor to C++ and does have class invariants, preconditions, postconditions, and Design by Contract built in to the core language.
-
Look at D
The D programming language seems to be what you're looking for.
No runtime environment. Native string type. Garbage collector that you can suspend. And my favorite, object properties. -
Re:X++
No, the successor to C is D
-
Re:Whoa whoa whoa!
... also, make sure you don't miss the alpha download if you wish to try it out (Windows and Linux).
-
Re:Whoa whoa whoa!
There's a D?
D Programming Language Reference -
The Digital Mars C/C++ compiler
is a free download from Digital Mars and it can be used to develop commercial apps.
-
Re:Why is this worth anybody's attention?
I'm a slashdotter, and I find the article quite interesting. As a programmer, it helps to keep abreast of *all* options out there, politics/personal opinions aside. Yes, you're right, the article is there to expound the benefits of
.NET, but is that a bad thing? No, it's a valid platform for the development and deployment of software, and that's news to slashdot developers.
In fact, I'm somewhat disappointed at the severe *lack* of articles such as this one for the developers section. Developers section articles, indeed articles on programming and languages in general, are unfortunately rare on slashdot anymore.
Personally, I'd like to see more exposure of newer languages, like D, on slashdot. -
Re:operationI'd imagine there's a lot of "didn't check return value of such-and-such function call" as well.
Checking return values is something that a lot of people tend to leave out, and something that C doesn't have a way of doing that "feels" natural.
Perl's simplistic:dostuff($param) or die("Couldn't do stuff!");
...is nice, because it leaves the most important part at the beginning of the line, and it's immediately obvious what's important. I'm reminded of how Spanish (and many other languages, I'd wager) tends to put adjectives after nouns ("salsa verde" instead of "green salsa").
Exceptions would be nice, but even in C++ use of exceptions is quite expensive. I'm not a Java fan in general, but Java's you-MUST-handle-any-possible-exception is nice. It provides a way of handling important errors without cluttering up the code too much. It would be nice if the language explicitly complained if you didn't handle OutOfMemYouClod after calling malloc(), or YouCannotOpenThatFile after calling open().
Programmers are lazy, and as much as I'm for languages which stay out of your face, something which works to limit the extent to which coders can be lazy when it matters would be a big help.
Perhaps a compiler flag, such as -Wunhandled-exceptions would be an ideal solution (again, assuming an efficient exception mechanism were designed into the language) -- warn the condition, and let those who truly know better do their own thing.
Walter Bright's D language is looking more and more intriguing. It's designed from the perspective of an experienced compiler writer, and cuts out much of the vagueness of C++ while providing many of the features.
The front-end is released under the GPL. It should be possible to tie the front-end together with GCC's back-end, but nobody with the necessary time and skill to do so has yet done it. -
why use vc++ in the first place?
to be honest, i don't understand the motivation for using vc++ in a non-professional (read: outside of work) capacity in the first place. i realize the $99-$129 "professional version" price tag that i've seen, and the even cheaper academic pricing, are not too shabby compared with "enterprise" pricing... but they're still more expensive than $0! there are more than several freely available alternative compilers for win32 machines - cygwin gcc, borland (debugger also), djgpp, open watcom, lcc, MinGW, and Digital Mars (nb: haven't examined the license in detail) to name a few. can anyone else shed some light on why a developer might prefer vc++, or under which circumstances vc++ might be considered a clear-cut better choice than one of the alternatives listed above?
-
Re:how about listsUh. What about this syntax:
>>> hi = "hello"
Using 0 and -1 is much more consistent with the other list operators (like [1:] to get all but the first item).
>>> hi[-1] # Equivalent of 'tail'
'o'
>>> hi[0] # Equivalent of 'head'
'h'
I probably shouldn't comment on the garbage collection - but I thought that reference counting *was* a type of garbage collection? I agree with you on the analysis front - not knowing remotely what the interpreter thinks of your code before you run it is a bad thing.
My biggest complaint about Python (after not having a pre-processor) is that it's not strongly typed. I sometimes find myself writing sloppy code because the types of all my variables are obfuscated. In small programs, it's fine - but in larger programs, strong typing is a strength to aid tired programmers. And then I end up working around that by using Hungarian notation. If the language *enforced* types for me, I'd be happier. Sigh. Perhaps I need to try the D language. -
Re:why not...The B programming language stemmed from one called BCPL. Therefore, the logical successor is P, not D.
Besides, 'D' is already taken
-
Re:Just call it E.
Actually C++ is not D, D is another language which tries to be a bit less broken than C++. Unfortunately, while D looks like a nice language it also looks as though it may be impossible to write a compiler for it... (After over 3 years in development the compiler still doesn't implement the whole language)
-
Re:More on D
D exists and is implemented here.
-
The D Programming Language
The D Programming Language is the successor to C++.
-
Re:Why C didn't progress to D..
D is here
D Language
It's a cross of C++ with some Java-ish features and some design by contract thrown in. Fine language if you ask me. -
D already exists
I have yet to see this mentioned (which surprised me)
http://www.digitalmars.com/d/ -
Re:C++0x?
It's taken.
-
Re:C++0x?
Already done!
D Programming Language