HN user

rld

20 karma
Posts0
Comments16
View on HN
No posts found.

It's not duplicate syntax. `func` adds a named function to the current environment, and `->` only describes an anonymous function. It's the equivalent of `function foo(...)` vs `function(...)` in JS.

No, it applies for local variables as well: http://stackoverflow.com/questions/7423028/java-local-variab...

I still don't understand why you consider having a compiler-enforced restriction on mutation worse than letting readers figure out what was the developer's intent.

In Java, the only "downside" is having to add "final" as a modifier, which is negligible.

In Scala, the alternative is to declare that variable as "var" instead of "val". When would you ever choose var over val if your object isn't supposed to mutate?

At least in Java, non-final variables can't be used inside anonymous inner classes. Also, it's easier for me as a developer to read "final" and know that (referential) immutability is guaranteed by the compiler instead of having to read the local scope, which likely contains method calls that may or may not modify that variable.

val and final have stronger meanings when your objects are immutable. True immutability makes reasoning far easier than just referential immutability.

I thought it was worth mentioning as a separate point; just saying "you can pattern match" doesn't say much, when it's actually a key feature to guarantee certain correctness in a program.

Pattern matching offers mainly correctness and conciseness, maybe the correctness part should have been emphasized more.

Not mentioned here: pattern matching. It certainly goes a long way to ensure all cases are being handled, since the compiler lets you know when your patterns are non-exhaustive.

The author never mentions artistic merit, presumably because it's a result of his premise. If you can't cheat at art, it's because there's nothing to cheat for, so there's no such thing as artistic merit.

Usually this is not what you want to separate interfaces from implementations. For example, this:

    List<T> l = new ArrayList<T>();
is preferred to this:
    ArrayList<T> l = new ArrayList<T>();
Of course, it would be nice for the compiler to assume the latter if no type is specified on the left side.

It's not the same to be observed by some invisible or unknown entity than to be observed directly by a person. Someone pointing a digital camera at a person is usually more disturbing than a CCTV camera doing the same thing.

Also, Google Glass may be constantly recording in private places usually without CCTV: homes, dinner tables, meetings, etc.

Budding spies and others of a paranoid nature can buy a couple of those SIM cards to swap in and out of their (unlocked) phones for $10 in any 7-11, no registration, no questions asked (try doing that in India or Argentina!)

Argentine here, you can buy SIM cards literally everywhere. Vendors will even sell them to you on trains.