Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: What is a "primary expression"? Date: Sun, 7 Oct 2018 16:55:13 -0400 Organization: A noiseless patient Spider Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 7 Oct 2018 20:55:15 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="172d78621c819c247f1475e176c6053e"; logging-data="14717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F3wdewy4REn2jD1X68qje" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cancel-Lock: sha1:ZbXmD1gjfCmHiWah0hBnG/fo/bk= In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:38640 On 10/7/2018 12:24 PM, Stefan Ram wrote: > What is a "primary expression"? > > I know that, technically, it's defined by JLS11 > "15.8 Primary Expressions" as > > Primary: > PrimaryNoNewArray > ArrayCreationExpression > > . But what's the idea behind it? Can you > characterize it by specific properties? > [...] The explanation in the JLS itself seems clear: Primary expressions include most of the simplest kinds of expressions, from which all others are constructed: literals, object creations, field accesses, method invocations, method references, and array accesses. [...] Informally, PE's are the "building blocks" of expressions, the "atoms" that operators and so on join to produce "molecules." Whimsically, PE's are the "bottommost turtles" of Java expressions. The JLS has some additional language to explain/defend the non- inclusion of a few things that other languages consider "primary:" for example, "identifier" is not a PE. The reasons given seem to be not really about the goals of Java but about simplifying a few wrinkles in the grammar that describes it. -- esosman@comcast-dot-net.invalid Eight hundred thirty-six days to go.