Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27104 > unrolled thread

Re: literals and keywords

Started byPatricia Shanahan <pats@acm.org>
First post2013-12-28 19:14 -0800
Last post2014-01-07 15:04 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: literals and keywords Patricia Shanahan <pats@acm.org> - 2013-12-28 19:14 -0800
    Re: literals and keywords Sigebriht <sigebriht@yahoo.com> - 2014-01-07 15:04 +0000

#27104 — Re: literals and keywords

FromPatricia Shanahan <pats@acm.org>
Date2013-12-28 19:14 -0800
SubjectRe: literals and keywords
Message-ID<q5ydnS2dYpQaDiLPnZ2dnUVZ_rGdnZ2d@earthlink.com>
On 12/28/2013 8:15 AM, Stefan Ram wrote:
>    The JLS contains this wording:
>
>        »While true and false might appear to be keywords, they
>        are technically Boolean literals (§3.10.3). Similarly,
>        while null might appear to be a keyword, it is
>        technically the null literal (§3.10.7).«
>
>    Does it matter?
>
>    Can you find any program, where one can observe the difference?
>    E.g., some program that does compile because they are not keywords,
>    but would not compile when they were keywords, or vice versa?
>    Or are there any other observable consequences of this difference?
>

"true" and "false" do need to be literals. That is used, for example, in
the definition of constant expressions,
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.28

I suspect that not also classing them as keywords might be intended to
keep classes of tokens disjoint. Each token is either a keyword, or a
literal, or white space, etc. but cannot be more than one of those things.

Patricia

[toc] | [next] | [standalone]


#27251

FromSigebriht <sigebriht@yahoo.com>
Date2014-01-07 15:04 +0000
Message-ID<lah526$b51$1@dont-email.me>
In reply to#27104
On 29/12/2013 03:14, Patricia Shanahan wrote:

> I suspect that not also classing them as keywords might be intended to
> keep classes of tokens disjoint. Each token is either a keyword, or a
> literal, or white space, etc. but cannot be more than one of those things.

That certainly makes sense.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web