It's a committee-compromise grammar hack. On 3:52AM, Thu, Oct 20, 2016 medikoo <medikoo+mozilla....@medikoo.com> wrote:
> ES is already not free from such cases, e.g. `!'property' in object` will > also not resolve as most will expect. > > I understand and agree that case is ambigous and is problematic. It just > feels very controversial to me that it was decided that this case will be > handled differently than others that share exactly same problem. > > For those who are not aware of all such quirks/inconsistences it leaves > feeling that language is unpredictable in its behaviors. > > On 10/18/2016 01:05 AM, medikoo wrote: > > There are many other cases when with no parens involved, people have > > different expectations on the outcome. > > If expression looks ambigous the actual result always depends on > operators > > precedence, it's how language worked for years, and I don't remember any > > big > > problems due to that. > > > > > > Jordan Harband wrote > >> It's quite simple (as has already been stated): some people expect `-x > ** > >> y` to be `-(x ** y)`. Some expect it to be `(-x) ** y`. > >> > >> The early SyntaxError ensures that nobody is confused - programmers will > >> immediately add parens to disambiguate. > >> > >> Avoiding a potential footgun for the next 50 years, at the insignificant > >> cost of adding two characters so that it parses seems like a very cheap > >> price to pay. > >> > >> On Tue, Oct 18, 2016 at 12:20 AM, medikoo < > >> medikoo+mozilla.org@ > >> > > >> wrote: > >> > >>> I must say throwing here, instead of relying on math dictated operators > >>> precedence looks really bad. > >>> It's very surprising to those well experienced with the language, and > >>> totally inconsistent with how operators worked so far (there is no > >>> previous > >>> case where one will throw for similar reason). > >>> > >>> Also argument that it's inconsistent with Math.pow(-2, 2), is total > miss > >>> in > >>> my eyes. > >>> I believe to most programmers `Math.pow(-2, 2)`, translates to > >>> `(-2)**(2)` > >>> and not to `-2**2`, > >>> same as `Math.pow(a ? b : c, 2)` intuitively translates to `(a ? b : > >>> c)**(2)` and not to `a ? b : c**2` > >>> > >>> > >>> > >>> > >>> -- > >>> View this message in context: http://mozilla.6506.n7.nabble. > >>> com/Power-operator-why-does-2-3-throws-tp359609p359731.html > >>> Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at > >>> Nabble.com. > >>> _______________________________________________ > >>> es-discuss mailing list > >>> > >> es-discuss@ > >>> https://mail.mozilla.org/listinfo/es-discuss > >>> > >> _______________________________________________ > >> es-discuss mailing list > >> es-discuss@ > >> https://mail.mozilla.org/listinfo/es-discuss > > > > > > > > > > -- > > View this message in context: > > > http://mozilla.6506.n7.nabble.com/Power-operator-why-does-2-3-throws-tp359609p359733.html > > Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at > > Nabble.com. > > _______________________________________________ > > es-discuss mailing list > > es-discuss@ > > https://mail.mozilla.org/listinfo/es-discuss > > > _______________________________________________ > es-discuss mailing list > es-discuss@ > https://mail.mozilla.org/listinfo/es-discuss > > > > > > -- > View this message in context: > http://mozilla.6506.n7.nabble.com/Power-operator-why-does-2-3-throws-tp359609p359853.html > Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at > Nabble.com. > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss