def tree(): return defaultdict(tree)
But you're not defining a data structure -- you're just reusing the builtin dictionary type.Try defining say a RB tree without using builtin container types, and you quickly see how poor these languages' support for new data structures is.
That doesn’t negate dons’ point that if you need something other than those containers there is relatively poor support for defining your own.
In C++ "return std::set<int>" - there's your tree.
If you like being able to write terse, expressive code, you'll love APL,[1] where Conway's Game of Life[2] can be written in one line as:
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
[1] - https://en.wikipedia.org/wiki/APL_(programming_language)I think a really simple rule of thumb-for-code is "can you dictate it?" through the phone.
My first introduction to functional programming was with J (APL but using ASCII) during my sophomore year of college and I definitely didn't have the chops to understand it at that point. I was scared of functional languages for another year until a different professor introduced me to Haskell.
Java and C# also have native code compilers available to them.
ML was an improvement on most of its successors, and if you trace the development of mainstream languages, you see that they are more and more becoming ML.
Who knows how it would have turned out if UNIX did not became as it turned out to be.
To me, this is one the many reasons why Go will fail.
Most languages that usually have a VM, also tend to have native code compilers available, it is just that most HN folks tend to be unaware of them.
Why the dependency on Oracle?
There are other many other JVM available, even not certified ones, and you can also use compilers to native code if you wish to do so.
Which Go doesn't play well with.
C is a bit of the one out here in that its static typing is a really thin veneer as you can cast things to whatever you want them to.
Python and Ruby (in particular these two) more than anything else allowed you to write really terse, expressive code. The canonical Python example of this is defining a tree data structure:
or solving the N-queens problem in ~6 lines of code [1].Java and C++ OTOH were (and are) much more verbose but only some of this has anything to do with static typing.
All of this is one reason I'm incredibly bullish on the future of Go for such reasons as:
- no interfaces. If an object implements the methods expected by a consumer then it compiles otherwise it doesn't;
- incredibly simple OO system;
- no exceptions as such (particularly checked exceptions in the case of Java, which IMHO are just horrible). Some consider this a minus. I tend to think that exceptions tend to get abused for flow control and aren't the panacea they're made out to be;
- simple semantics for function returns and the ability to return multiple items;
- opinionated formatting (I'm not one of those people who has almost religious zeal for the placement of curly braces and indenting so I'd rather just have a standard and stick to it, whatever it is);
- compiles to a binary rather than running on a VM;
- simple grammar with fast compilation. This last point is contrasted particularly well with C++;
- coroutines (or rather goroutines) as a first-class language citizen for solving concurrency problems;
- the "defer" mechanism for resource cleanup. I find this much easier to read than tortured try-finally semantics and nesting.
Another way to put it is this: a lot of vim/emacs users judge IDEs as horrible based on having (often briefly) used Eclipse, which is a bit like judging the car by having once driven a 1975 Trabant.
Don't judge static typing by Java or even C++. Judge it by Go.
[1]: http://rosettacode.org/wiki/N-queens_problem#Python
[2]: http://www.time.com/time/specials/2007/article/0,28804,16585...