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


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

Re: Operators

Started byArne Vajhøj <arne@vajhoej.dk>
First post2016-09-08 19:24 -0400
Last post2016-09-14 20:23 -0400
Articles 7 — 3 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: Operators Arne Vajhøj <arne@vajhoej.dk> - 2016-09-08 19:24 -0400
    Re: Operators Roedy Green <inquiry@mindprod.com> - 2016-09-12 22:13 -0700
    Re: Operators Lew <lewbloch@gmail.com> - 2016-09-13 17:47 -0700
      Re: Operators Arne Vajhøj <arne@vajhoej.dk> - 2016-09-13 22:15 -0400
      Re: Operators Arne Vajhøj <arne@vajhoej.dk> - 2016-09-13 22:18 -0400
      Re: Operators Roedy Green <inquiry@mindprod.com> - 2016-09-13 19:51 -0700
        Re: Operators Arne Vajhøj <arne@vajhoej.dk> - 2016-09-14 20:23 -0400

#35575 — Re: Operators

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-09-08 19:24 -0400
SubjectRe: Operators
Message-ID<nqsrvj$15u5$1@gioia.aioe.org>
On 9/7/2016 8:45 PM, Stefan Ram wrote:
>       »3.12 Operators
>
>       38 tokens, formed from ASCII characters, are the
>       operators.
>
>       Operator: one of
>
>       =  >  <  !  ~  ?  :  ->
>
>       == >= <= != && || ++ --
>
>       +  -  *  /  &  |  ^  %  <<  >>  >>>
>
>       += -= *= /= &= |= ^= %= <<= >>= >>>=«
>
>     JLS8
>
>   This is the complete sections 3.12.
>
>   Does this mean that »a?b:c« contains /two/
>   operators, but »(int)3.2«, »(3)« and »f(x)«
>   do not contain an operator?

I think that common terminology among Java developers
would be that:

?: is a single operator
cast is not an operator
parenthesis are not operators
method call is not an operator

Arne

[toc] | [next] | [standalone]


#35590

FromRoedy Green <inquiry@mindprod.com>
Date2016-09-12 22:13 -0700
Message-ID<5g2ftbhivhiu2g2n2fj45mt6gu66tjdgcm@4ax.com>
In reply to#35575
On Thu, 8 Sep 2016 19:24:35 -0400, Arne Vajhøj <arne@vajhoej.dk>
wrote:

>?: is a single operator

I did some Googling.  ?: is refered to as the ternary operator, so the
?: as a lump is an operator by most programmers.

[toc] | [prev] | [next] | [standalone]


#35596

FromLew <lewbloch@gmail.com>
Date2016-09-13 17:47 -0700
Message-ID<e57ce88e-78d3-4a8f-b278-6b95b3f20f1b@googlegroups.com>
In reply to#35575
On Thursday, September 8, 2016 at 4:24:51 PM UTC-7, Arne Vajhøj wrote:
> On 9/7/2016 8:45 PM, Stefan Ram wrote:
> >       »3.12 Operators
> >
> >       38 tokens, formed from ASCII characters, are the
> >       operators.
> >
> >       Operator: one of
> >
> >       =  >  <  !  ~  ?  :  ->
> >
> >       == >= <= != && || ++ --
> >
> >       +  -  *  /  &  |  ^  %  <<  >>  >>>
> >
> >       += -= *= /= &= |= ^= %= <<= >>= >>>=«
> >
> >     JLS8
> >
> >   This is the complete sections 3.12.
> >
> >   Does this mean that »a?b:c« contains /two/
> >   operators, but »(int)3.2«, »(3)« and »f(x)«
> >   do not contain an operator?
> 
> I think that common terminology among Java developers
> would be that:
> 
> ?: is a single operator
> cast is not an operator
> parenthesis are not operators
> method call is not an operator

Whatever is common or rare among programmers is irrelevant. What is relevant is 
https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.12

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#35598

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-09-13 22:15 -0400
Message-ID<nrabrb$5a9$1@gioia.aioe.org>
In reply to#35596
On 9/13/2016 8:47 PM, Lew wrote:
> On Thursday, September 8, 2016 at 4:24:51 PM UTC-7, Arne Vajhøj wrote:
>> On 9/7/2016 8:45 PM, Stefan Ram wrote:
>>>       »3.12 Operators
>>>
>>>       38 tokens, formed from ASCII characters, are the
>>>       operators.
>>>
>>>       Operator: one of
>>>
>>>       =  >  <  !  ~  ?  :  ->
>>>
>>>       == >= <= != && || ++ --
>>>
>>>       +  -  *  /  &  |  ^  %  <<  >>  >>>
>>>
>>>       += -= *= /= &= |= ^= %= <<= >>= >>>=«
>>>
>>>     JLS8
>>>
>>>   This is the complete sections 3.12.
>>>
>>>   Does this mean that »a?b:c« contains /two/
>>>   operators, but »(int)3.2«, »(3)« and »f(x)«
>>>   do not contain an operator?
>>
>> I think that common terminology among Java developers
>> would be that:
>>
>> ?: is a single operator
>> cast is not an operator
>> parenthesis are not operators
>> method call is not an operator
>
> Whatever is common or rare among programmers is irrelevant. What is relevant is
> https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.12

Java developers frequently have to communicate with people that know
development but not Java, so I disagree. Understanding common
terminology is essential for effective communication with the
development process.

Arne

[toc] | [prev] | [next] | [standalone]


#35599

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-09-13 22:18 -0400
Message-ID<nrac1g$5lh$1@gioia.aioe.org>
In reply to#35596
On 9/13/2016 8:47 PM, Lew wrote:
> On Thursday, September 8, 2016 at 4:24:51 PM UTC-7, Arne Vajhøj wrote:
>> On 9/7/2016 8:45 PM, Stefan Ram wrote:
>>>       »3.12 Operators
>>>
>>>       38 tokens, formed from ASCII characters, are the
>>>       operators.
>>>
>>>       Operator: one of
>>>
>>>       =  >  <  !  ~  ?  :  ->
>>>
>>>       == >= <= != && || ++ --
>>>
>>>       +  -  *  /  &  |  ^  %  <<  >>  >>>
>>>
>>>       += -= *= /= &= |= ^= %= <<= >>= >>>=«
>>>
>>>     JLS8
>>>
>>>   This is the complete sections 3.12.
>>>
>>>   Does this mean that »a?b:c« contains /two/
>>>   operators, but »(int)3.2«, »(3)« and »f(x)«
>>>   do not contain an operator?
>>
>> I think that common terminology among Java developers
>> would be that:
>>
>> ?: is a single operator
>> cast is not an operator
>> parenthesis are not operators
>> method call is not an operator
>
> Whatever is common or rare among programmers is irrelevant. What is relevant is
> https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.12

Also note that 3.12 seems to say that "?" is one operator and ":" is one
operator, but 15.25 calls "? :" one operator.

https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.25

<quote>
15.25. Conditional Operator ? :

The conditional operator ? : ...
</quote>

I will stick the one operator claim!

Arne


[toc] | [prev] | [next] | [standalone]


#35600

FromRoedy Green <inquiry@mindprod.com>
Date2016-09-13 19:51 -0700
Message-ID<cnehtbtdnt0s9hurm4poi9bni372mpp9d3@4ax.com>
In reply to#35596
On Tue, 13 Sep 2016 17:47:57 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote:

>t is=20
>https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.12

it says ? and : are both operators independently, contrary to net
convention.  Obviously oracle is the authority.

[toc] | [prev] | [next] | [standalone]


#35611

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-09-14 20:23 -0400
Message-ID<nrcpm3$j36$1@gioia.aioe.org>
In reply to#35600
On 9/13/2016 10:51 PM, Roedy Green wrote:
> On Tue, 13 Sep 2016 17:47:57 -0700 (PDT), Lew <lewbloch@gmail.com>
> wrote:
>> https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.12
>
> it says ? and : are both operators independently, contrary to net
> convention.  Obviously oracle is the authority.

In 3.12 they authoritatively says 2.

In 15.25 they authoritatively says 1.

:-)

Maybe they are not authoritatively the authority.

:-)

Or maybe there is a good explanation.

Chapter 3 is about lexical structure.

?: is definitely two lexical elements or tokens.

So:

"38 tokens, formed from ASCII characters, are the operators."

should possible be read:

"38 tokens [in the lexical scan], formed from ASCII characters, are
[used to create] the [37] operators"

In general one should be very careful about interpreting specs
like this.

But in this case it actually makes 3.12:
- consistent with 15.25
- consistent with common terminology

Arne

[toc] | [prev] | [standalone]


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


csiph-web