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


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

Re: literals and keywords

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sat, 28 Dec 2013 21:14:14 -0600
Date Sat, 28 Dec 2013 19:14:19 -0800
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows NT 5.2; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: literals and keywords
References <keywords-20131228171259@ram.dialup.fu-berlin.de>
In-Reply-To <keywords-20131228171259@ram.dialup.fu-berlin.de>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Message-ID <q5ydnS2dYpQaDiLPnZ2dnUVZ_rGdnZ2d@earthlink.com> (permalink)
Lines 26
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.195.53
X-Trace sv3-NHez38EiDqe4oPorg4arkYnyGkk/C1Z6Dz72akTk2V9gR9Vikd09n76EUn09CO6EOlyXylMWTm3+2n6!w3QO/K3n5Np/vD7QipHqAX4aFC+nMzmyCx2wiA0aQttv3gKodwIA1AmCS35VMuwm5sxt5kaUqJXo!+GV9lBAVPlzSRxLOAbKuzDBFLCzmhHAP9S6rWr58cv+Hig==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2245
X-Received-Bytes 2386
X-Received-Body-CRC 2095523443
Xref csiph.com comp.lang.java.programmer:27104

Show key headers only | View raw


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

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

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

csiph-web