views:

209

answers:

10

Programming languages vary a lot in the syntax they use. The syntax being a bunch of keywords is what we have to deal with in every language. But from the gut feeling not all of these keywords seem to be wisely chosen. One reason might be that a word is a keyword that you would want to use often in your code but you are not allowed to use. In my case it is even that I'm not able to digest a few of this keywords so I ignore the language until an error pops up that remembers me about my stubbornness.

Do you have similar things in mind? What would be your first removal of a keyword in your language?

Update: I'm not surprized about the down votes but I don't understand it. Adding some comment would be helpful.

A: 

From C++ and C# I would eliminate goto

Pervez Choudhury
Yeah well that'd be a fairly naive (even idiotic) thing to do since goto is still useful and still used.
cletus
I don't think it's idiotic or naive. I can see it's impossible to remove due to legacy code, but I don't think goto is useful.
Cameron MacFarland
I've been programming in C++ and C# for 9 years, and have neaver had to use goto once. The only times I see it's use defended is breaking out of deeply nested loops, but I reason that you shouldn't get yourself into that situation in the first place.
Pervez Choudhury
There *are* cases where goto is extremely helpful.
Zifre
17 of 26
+3  A: 

I'd eliminate goto from Java. Or make it actually do something.

Adam Jaskiewicz
+1  A: 

I'll propose a keyword that has already been removed: the Python print keyword, which as of Python 3.0 has been replaced by a regular function, thus allowing it to be handled like all other functions (passed around, etc.).

Print is a function.

Stephan202
+2  A: 

In Javascript "with" must go.

flitzwald
Why? It's quite useful. IMHO with should be introduced to other languages.
Dario
@Dario - mozilla's got some good reasons: https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Statements/With
rampion
+2  A: 

I'd fix static keyword in ANSI C. It means two diffrent things now. Static variable doesn't change between succesive calls to the function, in which it is declared. Static function is visible only inside one file.

Not quite right - file level statics (functions OR variables) have their visibility affected by "static", their duration is from process start to end. Function level statics (variables) have their duration affected by "static", their visibility is inside the function only.
paxdiablo
A: 

I wouldn't eliminate any keywords from any languages.

Modern day languages have been carefully designed by their creators and there's good reasons for the existence of every keyword in them.

Language designers wind up putting a lot more thought into the language than us users and there are specific reasons (which we may or may not be aware of) as to why keywords are added to languages.

17 of 26
"Modern day languages have been carefully designed by their creators" ROFL!!!
Cameron MacFarland
17 of 26
+2  A: 

I'd like to get rid of if/then/else from Haskell and use a function instead.

Dave Hinton
There's a problem with that: `if A then B else C` will check the types of all involved, but only evaluate B or C. A function would evaluate both, which could take a lot longer.
Samir Talwar
A function wouldn't evaluate both - Haskell is lazily evaluated, you would just evaluate the part that is needed when it's needed. Anyway, because it's purely functional, it wouldn't make a difference whether you evaluate the function or not - you may not have side effects.In fact if/then/else *is* a function with some syntactic sugar.
Dario
A: 

i would get rid of 'gets' in C

Sujoy
That ain't no keyword.
Dario
still worth getting rid of though
anon
+1  A: 

I would remove lock from C# and introduce class Lock instead with semantics like this:

using (myLock.Enter())
{
    // Critical section
}

current ability to lock on any class looks quite strange to me.

Konstantin Spirin
In F# lock is a function which is given a closure ;-)
Dario
A: 

I nominate the switch statement in C++. It is horribly overused, an if-ladder is almost always clearer and should be equally well optimised by a smart compiler (if only we had smart compilers), and as for switching on type, that is what virtual functions are for.

anon
I just wish switch were more flexible (like pattern matching in OCaml). if ladders are overly verbose, but switchs are too limited.
Zifre
I disagree (but not to the point of downvoting). A well written switch statement can be a thing of beauty.
rampion
@rampion - next time you see one, let me know
anon
The reason switch was invented was because it could be much more efficient in certain cases than ifs. The problem is that very rarely do you need to switch on numbers (the only case that works). Often I wish it would work on strings or other more complex data structures. OCaml's pattern matching has spoiled me.
Zifre