06-Dec-2014 01:28, Freddy пишет:
On Thursday, 4 December 2014 at 13:48:04 UTC, Russel Winder via
Digitalmars-d wrote:
It's an argument for Java over Python specifically but a bit more
general in reality. This stood out for me:
!…other languages like D and Go are too new to bet my work on."
http://www.teamten.com/lawrence/writings/java-for-everything.html
My problems with java:
no unsigned ints
primitive are passed by value; arrays and user defined types are
passed by reference only (killing memory usage)
no operator overloading(looks at java.util.ArrayList)
no templates
no property syntax(getters and setters are used instead even if
you know the field is never going to be dynamic)
only and exactly one class per file(ALL THE IMPORTS)
every thing must be inside a class(globals and free functions
are static fields in a class)
This is all i can remember.
Solved in Scala:
- operator overloading
- properties - that + optional (), a library writer still can enforce ()
to be used
- only and exactly one class - any number in any combination
- everything class - sort of, it has 'object' clause (just like 'class')
that can be thought as a kind of namespace or a singleton if you love OOP.
Not fixed:
- unsigend types - nothing here unless Java adds support
- pasing by value - there are immutable and value types (e.g. Tuples)
but I think they are references behind the scenes
- no templates, but you may use AST macros which is even more powerful
--
Dmitry Olshansky