rtm / js-pick-notation

Proposal for Picked Properties in JavaScript
MIT License
26 stars 0 forks source link

Guarded pick notation #2

Closed raulsebastianmihaila closed 7 years ago

raulsebastianmihaila commented 8 years ago

How about writing o.!a for guarded pick instead of o.?a ? It would be similar to the mandatory properties notation. ? makes me think of optional stuff.

peisenmann commented 8 years ago

I've heard this called the "Null Safe Deferencing" operator before. Groovy, for example, uses ?. like o?.a. Using the ! makes me think of logical not, so I don't see the switch from ? to ! to be a win. Either a question mark and dot or a symbol that isn't used elsewhere makes the most sense imho.

raulsebastianmihaila commented 8 years ago

Consistency with o.{a, b!}. Or this could be written as o.{a, b?} instead.

rtm commented 7 years ago

Closing this issue as it relates to an earlier, obsolete version of the proposal.