Re: [Java Spec Report] Re: JSR 201 autobox comments
Neal Gafter <[email protected]> Fri, 09 Apr 2004 08:25:45 -0700
| Newsgroups | gmane.comp.java.spec-report |
|---|---|
| Message-ID | <[email protected]> |
Eric Blake wrote: > As I explained in my first email of this thread, I think it is silly for the > semantics of these two statements to differ: > > while (false); // the ; is unreachable, compile error > while (Boolean.FALSE); // the ; is reachable, compile proceeds > > Likewise, the semantics of these statements: > > int i, j; > if (true) i = 1; // i definitely assigned > if (Boolean.TRUE) j = 1; // j not definitely assigned > i = i; // legal > j = j; // illegal, by current rules > > There are many other examples where the current proposal for autounboxing a > Boolean has different semantics than using a compile-time constant boolean. > In my eyes, part of making Boolean an acceptable replacement for boolean in > control statements (and elsewhere) is making Boolean capable of being a > compile-time constant, so that there are no semantic distinctions. And by > extension, if Boolean can be constant, then so should all the wrapper types. > I am arguing for a forward-compatible change - a wrapper class is only > constant if it is initialized by a constant expression. No existing 1.4 code > will be broken by this change. I don't understand either why the existing semantics are silly, or what kind of programming model is supported by your suggestion that is not supported without it. -Neal "A foolish consistency is the hobgoblin of little minds..." —Ralph Waldo Emerson ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/5cFolB/TM ---------------------------------------------------------------------~-> To unsubscribe from this mailing list, send an email to: [email protected] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/java-spec-report/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/