Re: 7.0 wishlist?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Harold Yarmouth schreef:
Hendrik Maryns wrote:
Harold Yarmouth schreef:
Hendrik Maryns wrote:
[some attributions are missing here, but I think it's just me and
Hendrik alternating]

I am sorry for that.

It does, but let me think about this a bit:

{ 1, 3 } is an array, so should, like any array in Java, be passed by
reference.

Now, is it mutable? Take the method

public void nasty(int[] ints) {
ints[0] = 0;
// other stuff
}

What do you propose would happen if you did nasty({ 1, 3 })? Without
the comment, nothing of course, but let’s just assume the ‘other stuff’
does more with the array, like use its values.

What does it currently do if passed

static final int[] array = {1, 3};

If that array can actually be modified, then there's a bit of ugliness
in Java, but it does not stem from any proposal of mine.

I think it is modifiable. AFAIK, there is no way in (current) Java to
make an array immutable.

I tend to agree that this is a bit of ugliness.

So I’d say: even you literal is mutable. I don’t think it is desirable
to introduce new behavior here.

But are we? See above.

Which above? If you mean the array should be immutable, then AFAIK you
are introducing new behavior, since there is no way to do that now.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkkazNAACgkQBGFP0CTku6P+zACgtrjzPjoK7bZfA8A0MgtVlk95
JdwAniVkvXiNg6Di6/8NHercc3pTzhXP
=4LQ8
-----END PGP SIGNATURE-----
.