Dude, if you're resizing an array like this, you're using the wrong tool for the job. One word: ArrayList. Toot toot! Clue train departing! All aboard!
ArrayList is even worse because, instead of these ugly little repetitive idioms, you have casts everywhere. Not only are operations like a resize full of syntactic clutter, but every single read from the collection has this extra syntax that is completely useless to everybody and everything except the compiler.
I'm certainly not everybody, but I don't like Java because it isn't very expressive at all.
Looking at the SWT source code, for instance, there's all manner of boring, uninteresting cruft laying around because Java simply doesn't offer a more concise way to express some extremely common notion, nor does it offer any syntactic mechanisms for alleviating the problem.
The best example I can think of is resizing an array: Java arrays cannot be resized, which leads to the "newFoos = new Foo[oldFoos.length + x]; for (int i.....)" pattern duplicated everywhere, and it doesn't even mean anything. Several lines of cruft, and, unless it's commented as such, or you recognize the idiom, there isn't anything that even hints that all this looping and copying is an append operation.
(Java 5 allows generic containers, but they don't count yet: it's still beta, and a project like SWT is unlikely to adopt it for awhile anyway)
I like Python (and Ruby, Lisp, C++, D, and even sometimes Perl) because it is much easier for me to write code that says what I mean. The code is shorter, clearer, and infinitely easier to understand.
The article is a bit short on that one. D has full *link* compatibility with C. As in, you can link a C library, do a few extern (C) declarations in a module somewhere, and use it without any further work on your part.
The backend (code generator) for the reference compiler is closed source. However, the frontend is dual-licensed under the GPL or Artistic licenses, and is free in every sense of the word.
David Friedman has already had success connecting this frontend to the GCC code generator, in fact: http://home.earthlink.net/~dvdfrdmn/d
This would be a bigger deal if D templates weren't as robust as they are.
It's quite a simple matter to write template classes that extend their template argument. In this way, you can arbitrarily compose things any which way you like in a way that very closely resembles multiple inheritance.
Of course, it requires a bit of work, but it's my understanding that implementing MI involves making the compiler very arcane and complicated. One of the goals of D is to be easy for compiler vendors to implement correctly. (no waiting 10 years for a correct compiler!)
87. By making the Linux operating system free to end users, IBM could undermine and destroy the ability of any of its competitors to charge a fee for distribution of UNIX software in the enterprise market. Thus, IBM, with its army of Global Services integrators who earn money by selling services, would gain a tremendous advantage over all its competitors who earn money by selling UNIX licenses.
Seems like someone's sore because IBM has a better business model.
Personally I strongly reject this "round Earth" attempt at global topology science revisionist history. Stick with what people have been using for centuries, I say, and not submit to what the.... oh hell, I can't properly end this sentance. Too early in the morning.
Nobody can write a compiler that implements all of C++98 properly, let alone 0x. That says something about the complexity of the language.
I want to stop worrying about what features I use, for fear of stepping on the toes of a compiler that can't handle some corner of the language or other.
Re:Platform independence! .. uh..no nvidia.. ati..
on
The Cg Tutorial
·
· Score: 1
Cg runs just fine on anything that implements the ARB or NV extensions, which is basically everything except the Radeon 8500 family. (it works great on the 9700)
I dunno if this is what you're getting at, but I thought I'd clear up a misconception that I see every now and again.
Python doesn't care how much you indent. Just that you indent and dedent consistently. If you have an if block that's indented 14 spaces, power to you, as long as you go back to where you were when the if block is done. Similarly, there's no hard-tab/soft-tab issue; use whichever you want.
Re:Didn't someone say "Give me liberty or...
on
File-sharing and AOL
·
· Score: -1, Redundant
I believe the quote you're after is
"Those who would give up essential liberty, to purchase a little temporary safety, deserve neither liberty nor safety." -- Benjamin Franklin
I guess what I meant was that C and C++ tend to enable, instead of restricting programmers "for their own good." (correct me if I'm wrong, but that's the impression I get from Java)
Also, one little thing: D will un-virtualize a specific call if it can come to the conclusion that it's not necessary. More or less ideal, I think.:) (it's also got things like final methods, for which it is a compile-time error to override)
It seems to be the goal of D to toss a bunch of stuff in the language itself and let the programmer sort it out. I could imagine it being a real pain for a new programmer to learn a language like that.
Sounds an awful lot like C++ to me. C++ is a mish-mash of C, and everything that entails, object oriented programming constructs, and a standard library that is often quite functional in nature. The syntax is convoluted (due in no small part to templates) and the compilers are convoluted beyond human reason.
Don't get me wrong, I love C++'s sheer semantic flexibility, but if you've ever done anything in C#, Java, or Python, it becomes clear just how long it takes to get stuff done in C++. (and it becomes apparent how annoying the Java OOP obsession can be;)
I'll agree with you that C and C++ don't have an overriding philosophy, (and that's one reason why they got where they are today) but it's pretty hard to say that Java isn't designed with object oriented design in mind.
The most obvious example is goto. It may be "evil" most of the time, but every now and again it's the best way to solve a problem. C, C++, and now D trust that the coder knows when it's time to break the rules.
1) setup.exe (RPM is a step in the right direction, but I can count the number of times setup EXEs have let me down with the fingers on one hand) 2) Visual Studio.NET (yes, it really is that good, whether you're into C# or not) 3) Games
Windows is aside from the point. Linux userbase in relation to Macintosh is. And, yes, there are lots of little random factors (like regionalism) thrown in that could skew the data one way or the other.
However, google's records are probably the best measure of who's running what operating system that we'll be able to get at this point.
More to the point, I think it's pretty safe to say that the Macintosh gaming industry is a fair bit more healthy than Linux's at this time.:)
More likely, they did it just because it was easy, (same hardware) or because one of the staffers ported it on his/her own time. Or both.
A Mac port would be more lucrative. But not as easy.:)
oh, and one final nitpick. The original UT favoured software rendering and glide, not D3D. UT2k3 is geared towards Direct3D first and foremost. The GL renderer was extremely hard to code, as I understand it.
I don't think that's what he means.
on
Is RPM Doomed?
·
· Score: 1
Say your package directory was/usr/app (or whatever, there are standards for these things, y'know)
libpng would live in/usr/app/libpng, qt would live in/usr/app/qt. Things could still dynamically link them, and it would still Just Work. The only difference is that you don't have four hundred files all crammed in/usr/lib.
ArrayList is even worse because, instead of these ugly little repetitive idioms, you have casts everywhere. Not only are operations like a resize full of syntactic clutter, but every single read from the collection has this extra syntax that is completely useless to everybody and everything except the compiler.
I'm certainly not everybody, but I don't like Java because it isn't very expressive at all.
Looking at the SWT source code, for instance, there's all manner of boring, uninteresting cruft laying around because Java simply doesn't offer a more concise way to express some extremely common notion, nor does it offer any syntactic mechanisms for alleviating the problem.
The best example I can think of is resizing an array: Java arrays cannot be resized, which leads to the "newFoos = new Foo[oldFoos.length + x]; for (int i .....)" pattern duplicated everywhere, and it doesn't even mean anything. Several lines of cruft, and, unless it's commented as such, or you recognize the idiom, there isn't anything that even hints that all this looping and copying is an append operation.
(Java 5 allows generic containers, but they don't count yet: it's still beta, and a project like SWT is unlikely to adopt it for awhile anyway)
I like Python (and Ruby, Lisp, C++, D, and even sometimes Perl) because it is much easier for me to write code that says what I mean. The code is shorter, clearer, and infinitely easier to understand.
If you can't understand the language of the problem domain, what makes you think that you can understand the solution?
Overloading operators where it makes sense (and nowhere else!) makes simple things look simple so that complicated things can stand out better.
It is clearly in *my* best interest that every copy of Windows running be patched to its utmost, legal or no.
Granted, I agree that Microsoft isn't obliged to provide these updates, but they would be doing their customers a favour if they did.
Just like C is.
The article is a bit short on that one. D has full *link* compatibility with C. As in, you can link a C library, do a few extern (C) declarations in a module somewhere, and use it without any further work on your part.
The backend (code generator) for the reference compiler is closed source. However, the frontend is dual-licensed under the GPL or Artistic licenses, and is free in every sense of the word.
David Friedman has already had success connecting this frontend to the GCC code generator, in fact: http://home.earthlink.net/~dvdfrdmn/d
This would be a bigger deal if D templates weren't as robust as they are.
It's quite a simple matter to write template classes that extend their template argument. In this way, you can arbitrarily compose things any which way you like in a way that very closely resembles multiple inheritance.
Of course, it requires a bit of work, but it's my understanding that implementing MI involves making the compiler very arcane and complicated. One of the goals of D is to be easy for compiler vendors to implement correctly. (no waiting 10 years for a correct compiler!)
D has full *link* compatibility with C. Not source. (if it was source-compatible, it would be C++)
:)
FYI, D *does* require you to cast between signed and unsigned integers.
87. By making the Linux operating system free to end users, IBM could undermine and destroy the ability of any of its competitors to charge a fee for distribution of UNIX software in the enterprise market. Thus, IBM, with its army of Global Services integrators who earn money by selling services, would gain a tremendous advantage over all its competitors who earn money by selling UNIX licenses.
Seems like someone's sore because IBM has a better business model.
Nobody can write a compiler that implements all of C++98 properly, let alone 0x. That says something about the complexity of the language. I want to stop worrying about what features I use, for fear of stepping on the toes of a compiler that can't handle some corner of the language or other.
Cg runs just fine on anything that implements the ARB or NV extensions, which is basically everything except the Radeon 8500 family. (it works great on the 9700)
I dunno if this is what you're getting at, but I thought I'd clear up a misconception that I see every now and again.
Python doesn't care how much you indent. Just that you indent and dedent consistently. If you have an if block that's indented 14 spaces, power to you, as long as you go back to where you were when the if block is done. Similarly, there's no hard-tab/soft-tab issue; use whichever you want.
"Those who would give up essential liberty, to purchase a little temporary safety, deserve neither liberty nor safety." -- Benjamin Franklin
I guess what I meant was that C and C++ tend to enable, instead of restricting programmers "for their own good." (correct me if I'm wrong, but that's the impression I get from Java)
:) (it's also got things like final methods, for which it is a compile-time error to override)
Also, one little thing: D will un-virtualize a specific call if it can come to the conclusion that it's not necessary. More or less ideal, I think.
It seems to be the goal of D to toss a bunch of stuff in the language itself and let the programmer sort it out. I could imagine it being a real pain for a new programmer to learn a language like that.
;)
Sounds an awful lot like C++ to me. C++ is a mish-mash of C, and everything that entails, object oriented programming constructs, and a standard library that is often quite functional in nature. The syntax is convoluted (due in no small part to templates) and the compilers are convoluted beyond human reason.
Don't get me wrong, I love C++'s sheer semantic flexibility, but if you've ever done anything in C#, Java, or Python, it becomes clear just how long it takes to get stuff done in C++. (and it becomes apparent how annoying the Java OOP obsession can be
I'll agree with you that C and C++ don't have an overriding philosophy, (and that's one reason why they got where they are today) but it's pretty hard to say that Java isn't designed with object oriented design in mind.
The most obvious example is goto. It may be "evil" most of the time, but every now and again it's the best way to solve a problem. C, C++, and now D trust that the coder knows when it's time to break the rules.
1) setup.exe (RPM is a step in the right direction, but I can count the number of times setup EXEs have let me down with the fingers on one hand) .NET (yes, it really is that good, whether you're into C# or not)
2) Visual Studio
3) Games
Censorship only sucks when it's crammed down your throat against your will, which simply isn't the case in this instance.
So! All the power to them!
Windows is aside from the point. Linux userbase in relation to Macintosh is. And, yes, there are lots of little random factors (like regionalism) thrown in that could skew the data one way or the other.
:)
However, google's records are probably the best measure of who's running what operating system that we'll be able to get at this point.
More to the point, I think it's pretty safe to say that the Macintosh gaming industry is a fair bit more healthy than Linux's at this time.
More likely, they did it just because it was easy, (same hardware) or because one of the staffers ported it on his/her own time. Or both.
A Mac port would be more lucrative. But not as easy. :)
oh, and one final nitpick. The original UT favoured software rendering and glide, not D3D. UT2k3 is geared towards Direct3D first and foremost. The GL renderer was extremely hard to code, as I understand it.
Suffering "distastefulness" is the price one pays for Freedom of Speech. And it's worth it.
http://www.blindwino.com/driverjunk15.html
Say your package directory was /usr/app (or whatever, there are standards for these things, y'know)
libpng would live in /usr/app/libpng, qt would live in /usr/app/qt. Things could still dynamically link them, and it would still Just Work. The only difference is that you don't have four hundred files all crammed in /usr/lib.