64 points · by bensummers · 17y ago · 47 comments
If they can also do something about closures, I'll be much happier as a Java developer when this comes out than I am today.
I'm trying to understand why the collections syntax would create only immutable collections? Anyone know why so?
The collection literals are nice too, but why couldn't they infer the type from the following?
Map<String, Integer> map = {"key" : 1};
to make the syntax: Map<> map = {"key" : 1};It's kind of trivial in your example, but with complex objects that implement a lot of interfaces it isn't as obvious what the programmer means.
Since you can always make it specific what you want, you can assume that the most common case is the "default". That's what c#'s `var` does anyways - if you have a `var a=1;`, 'a' an int, not an object. If you use `var a=new []{1,2,3};`, it's int[], not object[].
I was thinking specifically of the example in C# where you can do something like:
var list = new[] { "hello", null, "world" }
which the runtime casts as a string[].It just seemed like these collection literals would be good candidates to use the new type-inference capabilities they're rolling out.
Yes, this is a really stupid feature of the language.
http://kenai.com/projects/duby
It uses Java types, doesn't need a runtime, and most interestingly, has a pluggable compiler. The Ruby-like syntax may not be to everyone's taste, but it's nicely compact.
(note to self for own project: make samples very accessible)
Current -> MyProg_1.8.9
MyProg_1.8.9
MyProg_1.8.8
MyProg_1.8.7
How/why would you do that without symlinks?Hard-links would also be a nice addition. I am sure NTFS supports them deep inside it.
Also, could you explain some more. Why do you think that they're "atrocious hacks"? They solve some problems in a quite nice way (simple versioning for example)
here's bind(2) man page, in case you're interested in learning some 20 year old technology http://plan9.bell-labs.com/magic/man2html?man=bind§=...
Set<String> mutable = new HashSet<String>(immutable)The first thing people are going to do with these half assed immutable collections is pour the contents out into a mutable container. Which completely obviates all the thread safety and whatnot.
I slap my forehead. Do these people have no sense?
List<String> list = new ArrayList<String>();
list.add("item");
String item = list[0];
right?I guess I was thrown off by the wording- I assumed the line about collections being immutable applied to all collections that use the new syntax.
This proposal was just rejected in Go, alas.
What a readability difference it makes in Ruby, Eiffel and (originally) Ada.