Syntactic ambiguities are not very representative of what humans find ambiguous. For example, `const x = 1 const x = 2` (no semicolon) is not ambiguous to a parser at all, but humans have a hard time tracking it.
On Thu, Nov 7, 2019 at 12:53 PM Alex Kodat <[email protected]> wrote: > Jordan, > > That’s not an ambiguity, it’s just a rule of thumb that’s currently true. > No? My question is whether adding TemplateString to ComputedPropertyName in > the spec would create **syntactic** ambiguities or daunting implementation > issues. > > Clearly, there's little interest in this so I'll drop it, I was just > curious as I, at least, was somewhat surprised to see it didn't work. > > Thanks > > ------ > Alex Kodat > Senior Product Architect > Rocket Software > t: +1 781 684 2294 • m: +1 315 527 4764 • w: > http://www.rocketsoftware.com/ > > From: Jordan Harband <[email protected]> > Sent: Thursday, November 7, 2019 2:44 PM > To: Alex Kodat <[email protected]> > Cc: Gus Caplan <[email protected]>; [email protected] > Subject: Re: Template literal property names in object literals > > It would create the ambiguity that "every property name not in brackets is > static/hardcoded" is no longer true. > > On Thu, Nov 7, 2019 at 12:14 PM Alex Kodat <mailto: > [email protected]> wrote: > Jordan, > > The sentiments in that link discuss the wisdom of having the StringLiteral > definition include NoSubstitutionTemplate, a question about which I am > agnostic, and wouldn't provide the full functionality I'm asking about, > anyway. > > And I also understand that the spec currently only allows computed > property names in square brackets. > > My suggestion was that ComputedPropertyName *could* be changed to include > TemplateString (without square brackets). Whether this is worth doing or > paints JS syntax into a corner is a fair question, but I don't see that > adding TemplateString to ComputedPropertyName would create any syntactic > ambiguities and wouldn't seem to present daunting implementation issues. > But maybe this last assertion is incorrect and ambiguities would arise or > implementation would be a nightmare? > > Thanks > > ------ > Alex Kodat > Senior Product Architect > Rocket Software > t: +1 781 684 2294 • m: +1 315 527 4764 • w: > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2F&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764059583&sdata=uyR3LapBE55WBka7oMxIFinkB3u86hxFdAheaEgOuIo%3D&reserved=0 > > From: Jordan Harband <mailto:[email protected]> > Sent: Thursday, November 7, 2019 1:46 PM > To: Alex Kodat <mailto:[email protected]> > Cc: Gus Caplan <mailto:[email protected]>; mailto:[email protected] > Subject: Re: Template literal propery names in object literals > > Anything dynamic - computed - should be in brackets, since that's what > that indicates. > > Thus, template literals with substitutions must require brackets. > > Based on sentiments like > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fecma262%2Fissues%2F1399%23issuecomment-452910799&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764059583&sdata=Zj9u%2FVXu8niYo87ukf22u8SKdnBh9qCUFTn%2Fe%2FEhczI%3D&reserved=0, > either all template literals or none should be permitted in a given > position. > > Thus, no change is possible. > > On Thu, Nov 7, 2019 at 10:00 AM Alex Kodat <mailto:mailto: > [email protected]> wrote: > Thanks Gus, > > Good stuff. Though I think I’d take a different tack on the discussion at > that link, especially as I think the template literals should allow > substitutions (why not?): > > let obj = { `${Date()}`: 1}; > > I guess the tack I would take in the spec would be to add TemplateLiteral > to ComputedPropertyName and not worry about whether or not it's a > NoSubstitutionTemplate. > > Thanks > > ------ > Alex Kodat > Senior Product Architect > Rocket Software > t: +1 781 684 2294 • m: +1 315 527 4764 • w: > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2F&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764069581&sdata=kubTmB4qf6nllE%2BpEkC93HfSvqqard6q%2BUznl%2B%2FjKjc%3D&reserved=0 > > From: Gus Caplan <mailto:mailto:[email protected]> > Sent: Thursday, November 7, 2019 11:13 AM > To: Alex Kodat <mailto:mailto:[email protected]> > Cc: mailto:mailto:[email protected] > Subject: Re: Template literal propery names in object literals > > Related discussion > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftc39%2Fecma262%2Fissues%2F1399&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764069581&sdata=XONOYQh%2FojUU3RYUpL54XXnPQT7kGFAL7bOWRzJdnBQ%3D&reserved=0 > > On Thu, Nov 7, 2019 at 8:46 AM Alex Kodat <mailto:mailto:mailto:mailto: > [email protected]> wrote: > Just curious. Is there a reason template literals are not allowed as > property names in object literals? I can do: > > let obj = {'foo bar': 1}; > > and > > let obj = {"foo bar": 1}; > > but not > > let obj = {`foo bar`: 1}; > > It doesn't seem that allowing the latter would present any syntactic > problems and seems like almost an oversight that it's not allowed. > > The main reason I ask is that we've gone completely over to using template > literals for all our literals (why not?) and was surprised that we can't > use a template literal as an object literal property name. Obviously, we > can do: > > let obj = {[`foo bar`]: 1}; > > And given that square brackets allow arbitrary expressions for propery > names, it wouldn't seem that supporting template literals for object > literal property names would not present any daunting implementation issues. > > I guess I'd argue that the Principle of Least Astonishment and/or > completeness suggests that JS should support this. > > Sorry if this has been asked before but couldn't find anything in the > archive. > > Thanks > > ------ > Alex Kodat > Senior Product Architect > Rocket Software > t: +1 781 684 2294 • m: +1 315 527 4764 • w: > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764079579&sdata=uERLRVxURgftYgRhSQ66kcbkCAg4avY9S2V77mguPMc%3D&reserved=0 > > ================================ > Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA > 02451 ■ Main Office Toll Free Number: +1 855.577.4323 > Contact Customer Support: > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmy.rocketsoftware.com%2FRocketCommunity%2FRCEmailSupport&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764079579&sdata=rhudJ7LM7ZLjEGJfQuCLHMc7GaZxsqsP%2BfBgippoG1Q%3D&reserved=0 > Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fmanage-your-email-preferences&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764089567&sdata=UWwp7D1lSE0H7ziOC0t7FAm8oWe4tcc9vc4U4S35UX0%3D&reserved=0 > Privacy Policy - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fcompany%2Flegal%2Fprivacy-policy&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764089567&sdata=ZZMTzj0emECMbYg%2BClpZ4nadZsIjfRALtbTTX3308F4%3D&reserved=0 > ================================ > > This communication and any attachments may contain confidential > information of Rocket Software, Inc. All unauthorized use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > notify Rocket Software immediately and destroy all copies of this > communication. Thank you. > _______________________________________________ > es-discuss mailing list > mailto:mailto:mailto:mailto:[email protected] > > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.mozilla.org%2Flistinfo%2Fes-discuss&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764099561&sdata=oiqIva2Kds%2F2s2csWDdnSguE54Xcmm8Vqjzbi2EAaig%3D&reserved=0 > ================================ > Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA > 02451 ■ Main Office Toll Free Number: +1 855.577.4323 > Contact Customer Support: > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmy.rocketsoftware.com%2FRocketCommunity%2FRCEmailSupport&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764099561&sdata=rj%2FaTsRvYwz%2B00fb5V7LsGDk5zkiChL1UdMYyP%2F2jzM%3D&reserved=0 > Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fmanage-your-email-preferences&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764109555&sdata=OGaGi8uDTkE3Wfwwk7nWGffA5xWNf9SSx0dZZcP1WXo%3D&reserved=0 > Privacy Policy - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fcompany%2Flegal%2Fprivacy-policy&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764109555&sdata=FiqLAjYkhiRQ%2F%2Bb6IpM%2FuUrYon8%2F3ogwzVCzirq0A8w%3D&reserved=0 > ================================ > > This communication and any attachments may contain confidential > information of Rocket Software, Inc. All unauthorized use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > notify Rocket Software immediately and destroy all copies of this > communication. Thank you. > _______________________________________________ > es-discuss mailing list > mailto:mailto:[email protected] > > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.mozilla.org%2Flistinfo%2Fes-discuss&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764119552&sdata=acLDQPVROIgPKh%2FhN%2BlSVKZOCYve5TCdmOFjBOmSAjc%3D&reserved=0 > ================================ > Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA > 02451 ■ Main Office Toll Free Number: +1 855.577.4323 > Contact Customer Support: > https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmy.rocketsoftware.com%2FRocketCommunity%2FRCEmailSupport&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764119552&sdata=9zWwzOKqEkUW2vkLa%2B7BU0mXjd8SIArqEtYUgbNilR8%3D&reserved=0 > Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fmanage-your-email-preferences&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764129540&sdata=rcwwWUGAQvTuUKPPdivCc7kfeqPpZ0HPo%2FIkiF6vxIM%3D&reserved=0 > Privacy Policy - > https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.rocketsoftware.com%2Fcompany%2Flegal%2Fprivacy-policy&data=02%7C01%7C%7C57ccd30c5787459e5ad808d763c34c67%7C79544c1eed224879a082b67a9a672aae%7C0%7C0%7C637087562764129540&sdata=T7rcW5gdJl68qpPVE1Zv35bZmZlp%2FnhN8KVi93aETsQ%3D&reserved=0 > ================================ > > This communication and any attachments may contain confidential > information of Rocket Software, Inc. All unauthorized use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > notify Rocket Software immediately and destroy all copies of this > communication. Thank you. > ================================ > Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA > 02451 ■ Main Office Toll Free Number: +1 855.577.4323 > Contact Customer Support: > https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport > Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - > http://www.rocketsoftware.com/manage-your-email-preferences > Privacy Policy - > http://www.rocketsoftware.com/company/legal/privacy-policy > ================================ > > This communication and any attachments may contain confidential > information of Rocket Software, Inc. All unauthorized use, disclosure or > distribution is prohibited. If you are not the intended recipient, please > notify Rocket Software immediately and destroy all copies of this > communication. Thank you. >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

