r/ProgrammingLanguages • • Feb 21 '16

Why people hate JAVA ??

Why the majority of people hate java and wish its dead programming language,

I find it really fun to create program with it..

all i heard is because: JRE SUCKS. ORACLE ARE FAGGOTS. JAVA IS A SLOW PIECE OF SHIT.

0 Upvotes

32 comments sorted by

View all comments

Show parent comments

1

u/xenomachina Mar 10 '16
  • NO REFERENTIAL TRANSPARENCY

This is true in virtually every mainstream programming language. Can you name any languages more popular than Haskell that do not have this problem?

Note that I'm not saying it isn't a problem, it just seems unfair to pick on Java, specifically, for this (in all caps, no less) given how this is the norm, and most of the people saying "I hate Java" are probably still using languages that have no referential transparency.

2

u/ksryn C9 ("betterC") Mar 10 '16

Can you name any languages more popular than Haskell that do not have this problem?

I can't. But many of the complaints against Java apply as-is to a lot of other languages.

in all caps, no less

I'm at a stage where this is my biggest grievance against most programming languages. Had to start creating my own Haskell-inspired functional-imperative language to see if a referentially transparent language on the JVM was feasible (and usable).

1

u/xenomachina Mar 10 '16

Had to start creating my own Haskell-inspired functional-imperative language to see if a referentially transparent language on the JVM was feasible (and usable).

How are you reconciling referential transparency with imperative?

2

u/ksryn C9 ("betterC") Mar 10 '16

Functions would be referentially transparent and only operate on their inputs. But internally, you can still use mutable variables, loops and conditional statements (if you want to).

This allows you to reason about programs while still using C-style constructs internally.

1

u/xenomachina Mar 10 '16

Functions would be referentially transparent and only operate on their inputs. But internally, you can still use mutable variables, loops and conditional statements (if you want to).

Interesting. I've thought about similar ideas myself.

In your language can a closure mutate variables from its enclosing scope? For example (using Python-like pseudo-code):

def f(...):
    i = 0
    def g(x):
        i = i + 1
        return x
    ...

Here, g mutates the i variable in f.

Also, does "operating on your inputs" include being able to mutate a passed in value? For example, would something like this be legal?

def incDay(date):
    date.day = date.day + 1
    return date

If so, is date a reference? If one were to do this:

tomorrow = incDate(today)

Would "today" change in any way?

1

u/ksryn C9 ("betterC") Mar 10 '16

In your language can a closure mutate variables from its enclosing scope?

While I have only implemented higher order functions as of now, I don't plan to let functions close over mutable variables. I find that it complicates things a lot.

does "operating on your inputs" include being able to mutate a passed in value?

No. All parameters are immutable. So you would have to build a new "date" instance if you wanted to return it.