PL sucks

C++: .h & .cpp? …yeah, right, it would be too simple to define a class in a single file.

Java: I can’t have an int as value or key in a hash table?! …meh …let’s create a container object for the millions of integers I have to use!

Haskell: instead of  world.countries[“Antartica”].weatherStats.averageTemperature  you have:
averageTemperature (weatherStats (lookup “Antartica” (countries world)))
…well, I don’t like it

Advertisements

4 Responses to “PL sucks”

  1. roy_hu Says:

    In Haskell you can just write
    averageTemperature $ weatherStats $ lookup “Antartica” $ countries world

    • sidewords Says:

      well, technically you also have to perform a pattern matching on the lookup:
      case lookup “Antartica” $ countries world of
      Just x -> …
      Nothing -> …

      The point was more to illustrate that the reverse order of things is a bit less intuitive and takes a bit longer to decrypt. I also prefer to have a clear distinction between function calls and data elements, which is not the case here. In the end however, all of this is a question of taste, therefore subjective. That I dislike it solely my personnal opinion. I also agree that one could define an operator “#” (or whatsover) which would do the exactly the same as $ but in the reverse order. …yet these are workarounds.

      But perhaps others love this notation …who knows.

      cheers,
      sw

  2. Winheim Raulsh Says:

    You said: averageTemperature (weatherStats (lookup “Antartica” (countries world)))

    for Haskell. Personally, the naming is not the best. I would have designed the naming differently to correspond more intuitively to natural language:

    GetAverageTempFrom(WeatherStatsFor(NamedCountryInWorld(“Antartica”,world)))

    It’s understandable enough. Function calls are like navigation from one information entity to a relative entity.

  3. Jason Stumpf Says:

    You’re whining about the difference between:

    “world’s Antarctica’s temperature’s average”
    vs
    “the average of the temperature of Antarctica found in the world”

    Both are stilted, as is necessary for unambiguous meaning, but personally my day to day speech is closer to the second one. Not that it matters, programming languages aren’t supposed to read like natural languages. Any that do risk confusing users by appearing familiar while not actually being familiar.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: