Hacker News new | past | comments | ask | show | jobs | submit login
Reasons to hate any programming language (stackoverflow.com)
83 points by AmberShah on May 25, 2010 | hide | past | favorite | 40 comments



It seems like the good ones about Clojure and Scala are buried beneath the pile of whining about Java and Ruby.

Anyway, here's my 5 for Haskell.

1. Sometimes the type system feels backwards. What if I don't want the compiler to infer types for my variables? What if I want the opposite, where it does constraint checking on said variables? For example, instead of inferring the type of the elements of a list, it instead makes sure that they all belong to a particular typeclass. This is a subtle but huge difference that makes it difficult for me to program UIs. It can be done, but it seems to take more effort than it does in some other languages.

2. Allowing the construction of infinite values leads to some really frustrating errors sometimes. Sometimes you make mistakes of the form "let x = f x", which is valid in some situations and not others.

3. Monad should imply Applicative should imply Functor.

4. Bytestring handling bites you in the ass sometimes and you don't know it until your program crashes because you mixed things up improperly. Something is wrong here, when we are losing type information that should have prevented this.

5. Typeclasses should be automatically derived for trivial cases, like witness types, but there's a strong potential for abuse there.


I was surprised how far down I had to scroll for Ruby... I expected more people to have a love-hate relationship with it than apparently do.

I also totally disagree that blocks should be passed as regular parameters, but that's neither here nor there.


Accidentally downvoted this while intending to upvote, and now I can't undo - HN is not very mobile-friendly.


Yea that happens to me too. =/


Actually, I'll go further and say I hate the existence of bytestrings. I should not be required to know about bytestrings to do text processing at a reasonable speed.

(I have no opinion as to whether it's reasonable to use bytestrings for interaction with the FFI.)


What's so good about a linked list of characters?

Really, I think most people complain about bytestrings because "foo" makes a "normal string". If it made a bytestring, who would care? Bytestrings do the same API that you'd expect from any traversable.


Nothing. That's my point -- strings suck, Haskell should implement strings as bytestrings or something that isn't slow.


You can make "foo" give you a literal ByteString instead of a [Char]. Use the OverloadedStrings GHC extension. You probably knew that already, though.


Yeah. I thought you were saying the entire concept was worthless or something.

(Incidentally, I have used plain [Char] strings in some Haskell apps, and the performance has been fine. But really, all I do is get them from a char* and print them, so...)


5 Reasons to hate any programming language:

1. It doesn't just know what I want it to do.

2. It doesn't accept ambiguous syntax.

3. I still have to type stuff, even if I use an IDE.

4. It's not fast enough (for any value of "fast").

5. It's either too verbose or else unintelligible.


Re. 3: It seems you haven't worked with LabView. On the other hand -- you're lucky, you haven't worked with LabView.


Labview, why did you have to remind me of that abomination? It is a real shame that US FIRST (FIRST Robotics) has decided for the FRC division to use LabView to have people program their cRio controllers to control their robots.


2a. It does accept ambiguous syntax!


I kinda like the typing, it's something we call code I think is fun.


OCaml:

5) Polymorphic comparison is an ugly hack and land you in an infinite loop when accidentally used on a circular imperative structure. Type classes (specifically, an Ord type class) would fix this problem.

4) Arbitrary gaps and inconsistencies in the standard library. Extlib and Batteries go a long way to fix this, but the language really just needs a standard library overhaul.

3) Inefficient data representation and wonky hacks to optimize a few special cases (e.g. 31/63 bit integers).

2) Absolutely terribly C interface which requires deep knowledge of the runtime data layout.

1) Too many languages in one: OCaml is the awkward synthesis of an awesome module system (functors, first class modules, etc...), a slightly confusing but cool object system, the classic ML core, and some random fancy features (such as polymorphic variants). The interaction of these parts ends up being pretty confusing.

All that said, it's still my favourite language.


This question made me realize I don't have a favorite programming language anymore. I am most experienced in C++, but I've spent enough time with Python and Haskell to know what I'm missing.


I feel the same... but I have a clear area->language mapping now: networking - erlang; random quick tools - bash/python; utilities which should work for a longer time - haskell; anything with gui - c#; stuff that still doesn't quite fit anywhere - c/python; own experiments - ooc.

However, I have clear "hated" languages: perl, ruby and java.


Didn't see anyone mention this little gem about Ruby:

a = [1,2,3]

x = :foo

puts x

a = a.map do |x|

  x+1
end

See anything wrong here? (hint: what is the value of x?)


Here's another fun thing in Ruby:

    irb(main):001:0> x = true or "hi"
    => true
    irb(main):002:0> x
    => true
    irb(main):003:0> x = false or "hi"
    => "hi"
    irb(main):004:0> x
    => false
What? Short-circuit evaluation doesn't work in an assignment..? Oh.

    irb(main):005:0> x = (false or "hi")
    => "hi"
    irb(main):006:0> x
    => "hi"
In fairness, the || operator does not require explicit parentheses — but I still hold that operator precedence is just evil.


I actually was bitten by this just 2 weeks ago. It took me quite a while to figure this out.


Yes, thats surprising behavior. Fortunately its fixed in 1.9. :)

Spoiler alert:

.

.

.

1.8.x produces 3 while 1.9 produces :foo


Why was this broken in the first place? (What abomination of semantics would cause this behaviour)?


Closure variables not having their own scope and shadowing method level vars. They're simply implemented as method level vars, so not true closures.


I got that, but I don't understand why it should gain the value 3 before a single execution of the loop.


It's only at the end that the value of x is 3. The puts x immediately after x = :foo does print :foo


Hmm, interesting. I suspect this will break many things, but I'm happy that they have changed it.


The problem is not as pervasive as you might think, though it does happen.


Sometimes I wonder whether I should really try Ruby, but brainfarts like these always remind me why I decided against it the last time.


All I can see is that this code makes no sense whatsoever to me. I guess that means that Ruby is not for me...


Any programming language you don't know is bound to look something like line noise with some words mixed in.


> Any programming language you don't know is bound to look something like line noise with some words mixed in.

Nuh-uh, not APL! That looks like line noise with no words mixed in. :-)


C#/.Net:

1) Collection classes.

2) Collection classes.

3) Collection classes.

4) Collection classes.

5) Collection classes.


I'm guessing I'm not the only one who wonders why all the Remove(index) methods are void instead of returning the removed element.


I'm just pleased to see that the complaints/rants against python are few, and without much import (at least for me).


One that I didn't see mentioned: why do I have to import a separate module and call a weirdly named function to get a stack trace? Why isn't it just a method on Exception? Not a major issue but it just feels wrong, along the same lines as __init__ and "if __name__=='__main__'".


At some level it makes sense probably... It's not a very common operation, so don't load it unless needed. It looks like an arbitrary choice, rather than good/bad design.


These issues apply to my favorite language and also to the rest. Surely I'm cheating, but I don't believe it's against the spirit of the question.

I hate the fact that we have to program using plain text. A program is not really a sequential structure. I'm old, I do know the reasons that this anachronism has perpetuated. It's been a pain in the ass to deal with proprietary formats using not quite right tools. But in 2010? Seriously? How hard is to define a simple format that can be understood by simple editors?

Just an example: comments need to fit the syntax. So there's a need to delimite them, so some characters or characters combination are not allowed, or you need to use escape sequences, alternating delimiters or something. Think of code blocks that are commented out. I absolutely hate the time that I need to spend "formating" comments. It'd be trivial to create an editor that used certain special character (one that's < ASCII 32) to delimite comments, so we would not have to deal with this.

In general, the editor should be syntax-aware, in a more thorough sense (the editor would perform a first step of compilation), not in the patchy "syntax highlighting" way in which a quick and dirty scan of text is used. That would also speed compilation and "intellisense".

It would also eliminate syntax and the artificial differences among languages. Instead of curly braces vs, indentation vs. begin-end pairs vs. whatever, the program structure would be recognized by the editor and presented graphically.

The editor should only accept legal constructions (the rest would be considered comments or incomplete senteces) instead of the distracting red understrike of Eclipse.

In general, what I most hate is the fact that most languages use the very same constructs, while still are written differently and you need to learn the quirks of each of them. A while loop is the same in most languages. What's the point of learning stupid syntax for a dozen languages. I feel I'm working for the compiler. It should be the other way around.

I hate languages that do now allow me to do something, just because the language "designer" decided so. I feel the languages should be construction kits, not a set of rules to constrain what I can do with them. Why can't I have garbage collections in some languages and at the same time I can't have manual memory management in others? Why can't I have a language that accepts new constructs like Lisp, but not having to be Lisp with all its constraints?

So to summarize, I hate syntax. I hate a = b vs. a := b vs. b -> a vs. let a = b vs. ... Languages have become walled gardens, bigotry and us vs. them. Of course some tasks are different. But I think there's no real reason not to have all the features in the same language and define "sections" of code that use certains "modes", except the competition.


I agree with many things... especially the editor complaint. I wanted to create a syntax-aware editor one day and it's considerably harder than creating a standard one. It's also almost useless in case of dynamic languages, since you cannot verify that much at the editing stage. But this seems just wrong:

> I hate languages that do now allow me to do something, just because the language "designer" decided so.

In many cases it's not about "designer decided so", but rather about tradeoffs. We cannot do X, because that would make Y considerably more difficult / fragile / slower. It also helps create some coding standards and common constructs. For example it's easier to read someone else's python code where the syntax is pretty much minimal and uses the same concepts over and over again (decorators are just functions in functions, decorators with parameters just call another wrapping function to get the decorator, etc.), rather than reading some haskell code, where someone decided to build own DSL which implements everything. Limits can be good.


But limits don't need to be in the language itself. It should be possible to define subsets.

Maybe it seems the same thing to be limited by the language or by a requirement imposed by the boss or the customer. But it's not quite the same. I've worked for companies with very strict code conventions and revisions, and I was happy with them.

It's not the individual freedom what I'm requesting. It's more like having the possibilty of exceptionally resorting to powerful features when it's seen as the best option with the consensus of the team.

IOW: the limits can be good, but I don't think a single person should decide for all the users.


I have a feeling you might enjoy Common Lisp + Emacs + Slime.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: