Computer Science Canada Programming Languages Suck |
Author: | wtd [ Sun Oct 30, 2005 1:41 pm ] | ||||
Post subject: | Programming Languages Suck | ||||
Consider this an even-handed companion to my Why Java sucks thread. Loops One of the most common uses of a loop is to do something a certain number of times. Often, we don't especially care which reptition we're on. We just want something done. So, why can't more languages support this? Instead we often have to introduce a useless counter variable.
That is so horrifically ugly.
And that is beautiful. |
Author: | goomba [ Sun Oct 30, 2005 8:38 pm ] |
Post subject: | |
Probably because Java wants to remain syntactically similar to C. The foreach loop in 1.5 helps a bit when you want to iterate over a list, but I agree that it doesn't compare to the syntax and flexibility of iterations in Python/Ruby. Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior? |
Author: | rizzix [ Sun Oct 30, 2005 8:43 pm ] |
Post subject: | |
cuz TIMTOWTDI is real bad in the real world... ![]() |
Author: | beard0 [ Sun Oct 30, 2005 8:45 pm ] |
Post subject: | Re: Programming Languages Suck |
wtd wrote: Consider this an even-handed companion to my Why Java sucks thread.
wtd is talking about all languages in this post. |
Author: | Cervantes [ Sun Oct 30, 2005 8:59 pm ] |
Post subject: | Re: Programming Languages Suck |
beard0 wrote: wtd is talking about all languages in this post.
Maybe, but Ruby wins this round. ![]() goomba wrote: Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior? Traditions are hard to change... |
Author: | wtd [ Sun Oct 30, 2005 9:11 pm ] |
Post subject: | Re: Programming Languages Suck |
beard0 wrote: wtd wrote: Consider this an even-handed companion to my Why Java sucks thread.
wtd is talking about all languages in this post. Well, for any given problem there are likely at least a few languages that get it right. The "all" part comes from the fact that none of them get everything right. |
Author: | wtd [ Sun Oct 30, 2005 9:13 pm ] |
Post subject: | |
goomba wrote: Which raises the question, why is Java used so much more than Ruby/Python in the "Real World" if it is so inferior?
Sun spent a lot of money hyping the heck out of Java, and still does. Several other companies do as well. I'd say the biggest (though not necessarily the only) reason is that so many people simply haven't either heard of Python or Ruby, or haven't given them a chance. |
Author: | Dan [ Sun Oct 30, 2005 11:14 pm ] |
Post subject: | |
Well the for loop counter var dose make it alot more apreate where the index var is and how to call apone it. I mean in the 2nd case you posted the index var is still there some where you just can not see it (tho it maybe accesable throw other methods). The for aporch makes it so some one viewing or making the code cleary knows how to deal with the index var with out having to know the API or libbrays of the langue. This may not mean this the for aporch is better but it dose give a reason for using it. |
Author: | Martin [ Mon Oct 31, 2005 12:01 am ] |
Post subject: | |
wtd, what do you think the perfect language (syntactically) would look like? |
Author: | rizzix [ Mon Oct 31, 2005 12:02 am ] | ||
Post subject: | Re: Programming Languages Suck | ||
wtd wrote: Instead we often have to introduce a useless counter variable.
I've created many algorithms that make good use of the for ( ; ; ) syntax... there's not need to eliminate it all together.. but sure.. a for (int i : n,m .. p) kind of syntax would be cool.
|
Author: | wtd [ Mon Oct 31, 2005 12:32 am ] |
Post subject: | |
Martin wrote: wtd, what do you think the perfect language (syntactically) would look like?
Haskell is really nice syntactically. The ML languages also have a nice syntax. |
Author: | Martin [ Mon Oct 31, 2005 12:36 am ] |
Post subject: | |
Yeah, Haskell is pretty nifty. |
Author: | rizzix [ Mon Oct 31, 2005 12:37 am ] |
Post subject: | |
Haskell pwnz. |
Author: | Cervantes [ Mon Oct 31, 2005 6:33 pm ] | ||||||||
Post subject: | |||||||||
Hacker Dan wrote: Well the for loop counter var dose make it alot more apreate where the index var is and how to call apone it. I mean in the 2nd case you posted the index var is still there some where you just can not see it (tho it maybe accesable throw other methods). The for aporch makes it so some one viewing or making the code cleary knows how to deal with the index var with out having to know the API or libbrays of the langue.
This may not mean this the for aporch is better but it dose give a reason for using it. Yes, but the Ruby example can be extended as well. You can optionally add the block parameter:
If you don't want to start at zero:
or
And if you want a different incriment other than 1 or -1,
So it becomes a question of somewhat ugly looking syntax that can do everything from the basic configuration, or beautiful syntax that requires more knowledge of the language / more approaches to getting the task done. |
Author: | MysticVegeta [ Mon Nov 07, 2005 3:08 pm ] | ||||||||||
Post subject: | |||||||||||
If I made a programming language (which is just a thought) I would have the following syntax for it
Hmm lets go for the "for" loops
Lets take a look at teh forever loop
Procedures
Functions
This is my idea too bad i am not going to work towards it lol |
Author: | [Gandalf] [ Mon Nov 07, 2005 4:10 pm ] |
Post subject: | |
I think you are taking a bit too much from Turing. There are things like while (forever) {} or for ( ; ; ) {}, which does seem pretty simple, no? Those things, I think, are not really the problem. For example, one thing (which I have of course learned/realized from wtd) is, why do you need var before a variable in the first place? Furthermore, why do you need to specify a type for that variable? The programming language should be smart enough to do that on its own. |
Author: | beard0 [ Mon Nov 07, 2005 5:08 pm ] |
Post subject: | |
[Gandalf] wrote: For example, one thing (which I have of course learned/realized from wtd) is, why do you need var before a variable in the first place? Furthermore, why do you need to specify a type for that variable? The programming language should be smart enough to do that on its own.
One simple answer: PHP |
Author: | wtd [ Mon Nov 07, 2005 5:12 pm ] |
Post subject: | |
PHP answers the typing question about as well as any other dynamically typed language. About on par with Perl, and not quite on the level of Ruby or Python. However, omitting "var" in PHP trades one slight inconveience for a whole world of hurt, since "var" governs PHP's scoping rules. |
Author: | beard0 [ Mon Nov 07, 2005 5:20 pm ] | ||
Post subject: | |||
Not completely:
Quote: Hi
Notice: Undefined variable: x in C:\www\test.php on line 5 |
Author: | MysticVegeta [ Mon Nov 07, 2005 11:39 pm ] |
Post subject: | |
well as for me i prefer var because its a nice to define things and keeps the variable organized and reduces further confusion with procedures and fcn, specially in languges such as Java and C++ |
Author: | [Gandalf] [ Tue Nov 08, 2005 3:43 pm ] |
Post subject: | |
Functions/Methods in Java and C++ are quite obviuous, at least showing that they are what they are. If you mean that you can get a function and variable name mixed up, that is why you have conventions like functions are doSomethingInteresting and constants are ALWAYS_UPPER_CASE - things like that. How much easier would it be to write something like so: snakeSize = 5 snakeLives = 3 snakeStatus = "alive" instead of... var snakeSize : int := 5 var snakeLives : int := 3 var snakeStatus : string := "alive" ? And that is only in a small example, think of when writing larger programs... |
Author: | Cervantes [ Tue Nov 08, 2005 3:52 pm ] |
Post subject: | |
Since variables are probably the most common, among variables, functions, constants, classes, etc., the var keyword could be omitted, and the assumption made that it is a variable. Others would need keywords, such as "def" or "class". |
Author: | wtd [ Tue Nov 08, 2005 3:57 pm ] | ||
Post subject: | |||
[Gandalf] wrote: Functions/Methods in Java and C++ are quite obviuous, at least showing that they are what they are. If you mean that you can get a function and variable name mixed up, that is why you have conventions like functions are doSomethingInteresting and constants are ALWAYS_UPPER_CASE - things like that.
How much easier would it be to write something like so: snakeSize = 5 snakeLives = 3 snakeStatus = "alive" instead of... var snakeSize : int := 5 var snakeLives : int := 3 var snakeStatus : string := "alive" ? And that is only in a small example, think of when writing larger programs... And imagine how much easier it would be if you'd used some kind of aggregate data structure.
|
Author: | MysticVegeta [ Wed Nov 09, 2005 2:56 pm ] |
Post subject: | |
I wonder how many things they would have to cover then, would take forever to build that language but wil be perfectly efficient |
Author: | wtd [ Wed Nov 09, 2005 3:12 pm ] |
Post subject: | |
What makes you think people haven't been working on that? This idea that C and its derivatives are all that we have is extremely disturbing. http://caml.inria.fr/ocaml/index.en.html |
Author: | wtd [ Wed Nov 09, 2005 3:14 pm ] |
Post subject: | |
When I complain about flaws in programming languages, it's not because I'm a pie-in-the-sky, ivory tower idealist. It's because I've seen languages that don't have those flaws. |
Author: | MysticVegeta [ Wed Nov 09, 2005 7:05 pm ] |
Post subject: | |
But I hadn't heard of OCaml before, why is it so unpopular then? Is it because the strengths of C++ and Java surpasses its? |
Author: | wtd [ Wed Nov 09, 2005 7:07 pm ] |
Post subject: | |
MysticVegeta wrote: But I hadn't heard of OCaml before, why is it so unpopular then? Is it because the strengths of C++ and Java surpasses its?
Advantages? They have very few, if any. What they do have is marketing. |