Women in Technology

Hear us Roar



Article:
  Readable Java 1.5
Subject:   interesting, but...
Date:   2003-09-25 11:44:47
From:   sjungels
Response to: interesting, but...

I wanted "in" also. The reason I didn't argue for it is that it's already used by System.in. Java compiler writers would have to do backflips to distinguish between an "in" keyword and "in" the member variable. So "in" is out, unfortunately.
Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • interesting, but...
    2003-10-16 15:18:11  anonymous2 [View]

    maybe a 'from' ?
    Object o from collection
  • interesting, but...
    2003-09-29 15:26:12  anonymous2 [View]

    I tend to think that clearer syntax is much more important than the difficulty of writing the compiler. After all, many more people write Java code than write Java compilers. Is this one of the major reasons Sun did not want to use the "in" keyword?

    Of course, I am not planning on ever writing a Java 1.5 compiler.

    Thanks for the article, I really enjoyed it.
    • interesting, but...
      2003-12-20 06:54:24  anonymous2 [View]

      Java's keywords are reserved -- you can't
      use any of the keywords as variables or
      method names. Making an exception for "in"
      isn't just a matter of making it "difficult"
      to write the compiler, it's a radical change
      in the language structure that would require
      the lexer to be context-sensitive. Sun would
      (justifiably) never ever make such a change, so
      it's pointless to debate the value of an "in" keyword.

      Someone suggested "from". "of" is another
      possibility. But it's not like Sun didn't
      consider these -- they almost certainly did,
      and rejected them because there may be programs
      that use them as variable names. Thus, they
      chose the ":" syntax, and it's very unlikely
      that they're about to change their minds.