idle language change suggestion #243
hi,
how about some syntactic sugar that allows DefaultMutableTreeNode dmtn =new DefaultMutableTreeNode(userObject,true)
to be shortened toDefaultMutableTreeNode dmtn(userObject,true);
or is this trivial beyond belief? :)
asjf
[358 byte] By [
asjf] at [2007-9-30 19:38:00]

good pointclass Foo {
DefaultMutableTreeNode dmtn(userObject,true);
}
does look like a method at first glance (of course technically it couldn't be one - even abstract since the parameter type declarations are missing)
a slightly longer version might get round this?class Foo {
DefaultMutableTreeNode dmtn = new(userObject,true);
}
asjf
asjf at 2007-7-7 0:22:58 >

> a slightly longer version might get round
> this?class Foo {
> DefaultMutableTreeNode dmtn = new(userObject,true);
> }
asjf
So have you just created a new instance of DefaultMutableTreeNode? (is that the default?) Because:
List l = new ArrayList();
List l2 = new LinkedList();
List l3 = new Vector();
List l4 = new() // ?
YoGee at 2007-7-7 0:22:58 >

the difference with this example is that the type of the reference being assigned to is an interface - the suggested syntax contraction would only work for concrete classes i guess
in the case of assigning to an interface then there is no redundancy in the declaration as both the reference type and the class type are valuable information
asjf at 2007-7-7 0:22:58 >

> > Object o = new String();
>
> ?
ah.. i wasn't suggesting getting rid of the long form - so you'd still be able to do what you've written above
this suggestion was purely because the other afternoon I found myself writingFile file = new File("sdfsdjklfjsdkl");
and similar things lots of times
asjf at 2007-7-7 0:22:58 >

> ah.. i wasn't suggesting getting rid of the long form
> - so you'd still be able to do what you've written
> above
>
> this suggestion was purely because the other afternoon
> I found myself writingFile file = new
> File("sdfsdjklfjsdkl");
and similar things lots
> of times
Hmm, sorry but I don't like it (just my opinion)
YoGee at 2007-7-7 0:22:58 >
