[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: the benefits of immutability
Vadim Nasardinov <el-vadimo@comcast.net> wrote:
> Anyhow, I am starting to lose interest in this thread. I hoped to
> hear some good arguments against Java. None have emerged thus far,
> which I find rather surprising.
Finding arguments against Java is like trying to make a
teenager depressed.
How about:
1. No syntactic abstraction (macros)
2. No multiple inheritence
3. Single dispatch
4. C-like syntax
5. Verbosity
6. Expressions and statements that are not interchangable
7. In general, no tail recursion.
8. Dichotomy between primitive types and class types
9. No MOP
Any of these can be `killer' problems. It certainly makes Java useless
for some of the projects I work on.
But there is a wonderful refutation to all of these:
`Hey, at least it isn't Perl.'
> How about, we refine the "no function
> pointers" argument into "no higher order functions" and proceed to
> show the latter to also be less than entirely correct?
At some level, you can emulate most any semantics if you wrap
enough class structure around it. But sure, I'll bite:
No higher order functions: write the following in Java:
(defun compose (f g)
(lambda (x) (funcall f (funcall g x))))
and use it to compose the square root function and the
ToString function to create a function that takes numbers
and produces the printed representation of their square root.
Extra credit if you can do it in 240 characters. (three 80 character lines)