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


Groups > comp.lang.javascript > #33212

Re: -2 ** 2

Newsgroups comp.lang.javascript
Subject Re: -2 ** 2
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References (1 earlier) <slrnogmdu6.50n.jon+usenet@sable.unequivocal.eu> <040520171656060213%timstreater@greenbee.net> <slrnognfde.50n.jon+usenet@sable.unequivocal.eu> <XnsA76C5E4D9FE3Beejj99@194.109.6.166> <rhfogcl0fb2qg5l9oiga5p44nrrfdj32s6@4ax.com>
Date 2017-05-05 11:16 +0200
Message-ID <XnsA76C72A62E467eejj99@194.109.6.166> (permalink)

Show all headers | View raw


John G Harris <niam@jghnorth.org.uk.invalid> wrote on 05 May 2017 in 
comp.lang.javascript:

> On Fri, 05 May 2017 09:16:13 +0200, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
> 
>   <snip>
>>Even so, it seems that the way the minus sign is parsed,
>>the unary behavour is unnoticed in this case 
>>by the parsing engine [back to js, please]:
>>
>>let  r1 = -2 ^ 2; // -2
>>
>>... even if it is just unforgivable as in:
>>
>>let  r2 = 0 + -2 ^ 2; // -2
> 
> The problem is that 
>   -3**2
> could be parsed as 
>   (-3)**2 == 9
> or as
>   -(3**2) == -9
> 
> Which would you prefer? How would you justify your choice to people
> complaining loudly that the other way is the *obvious* way!

I said what I find unforgivable parsing above,
as it is clearly an unary minus,
I repeat it here:

let  r2 = 0 + -2 ^ 2; // -2;

I'm not in the least interested in justifying choices on demand.

> I'm guessing the ECMA262 committee decided to avoid arguments.

If that were the case they obviously failed.

Methinks your guess is wrong, as the ECMA262 committee should go for 
symplicity, logic and consistency, not for avoiding arguments.

After all, what is wrong with arguments, unless you are indoctrinated from 
childhood that that is against some deity's will?

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


Thread

Re: -2 ** 2 Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-05-04 14:13 +0000
  Re: -2 ** 2 Tim Streater <timstreater@greenbee.net> - 2017-05-04 16:56 +0100
    Re: -2 ** 2 Mark Lloyd <not@mail.invalid> - 2017-05-04 12:08 -0500
    Re: -2 ** 2 John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-04 20:02 +0100
    Re: -2 ** 2 Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-05-04 23:44 +0000
      Re: -2 ** 2 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-05 09:16 +0200
        Re: -2 ** 2 John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-05 09:56 +0100
          Re: -2 ** 2 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-05 11:16 +0200
            Re: -2 ** 2 John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-06 10:27 +0100
              Re: -2 ** 2 "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-05-06 11:42 +0200
  Re: -2 ** 2 Robert Heller <heller@deepsoft.com> - 2017-05-04 11:01 -0500
  Re: -2 ** 2 Sam E <why.should.this@be.email.invalid> - 2017-05-04 12:04 -0500
    Re: -2 ** 2 John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-04 19:29 +0100
      Re: -2 ** 2 Tim Streater <timstreater@greenbee.net> - 2017-05-04 19:51 +0100
        Re: -2 ** 2 John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-05 09:41 +0100
        Re: -2 ** 2 Tim Slattery <tim@risingdove.com> - 2017-05-05 11:02 -0400
          Re: -2 ** 2 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-05 17:47 +0200
          Re: -2 ** 2 Tim Streater <timstreater@greenbee.net> - 2017-05-05 16:49 +0100
            Re: -2 ** 2 Tim Slattery <tim@risingdove.com> - 2017-05-06 11:21 -0400
              Re: -2 ** 2 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-06 19:04 +0200
                Re: -2 ** 2 Tim Slattery <tim@risingdove.com> - 2017-05-07 12:40 -0400
                Re: -2 ** 2 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-07 20:35 +0200
                Re: -2 ** 2 RobG <rgqld@iinet.net.au> - 2017-05-10 17:46 -0700
                Re: -2 ** 2 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-11 03:00 +0200
          Re: -2 ** 2 Mark Lloyd <not@mail.invalid> - 2017-05-05 23:20 -0500
          Re: -2 ** 2 Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-05-08 23:19 +0100
      Re: -2 ** 2 Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-05-08 23:16 +0100
        Re: -2 ** 2 "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-05-09 09:55 -0700
        Re: -2 ** 2 Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-05-10 17:39 +0100
          Re: -2 ** 2 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-11 03:08 +0200

csiph-web