Existential Operator / Null Propagation Operator
rossberg at google.com
Thu Aug 20 10:35:52 UTC 2015
On 19 August 2015 at 16:21, Tingan Ho <tingan87 at gmail.com> wrote:
> Strange why do they need an operator for that? Probably to make it less
> error prone with access nil errors. But that could be fixed with static
> code analysis.
OT but: The whole point of optional values (as opposed to
null/nil/undefined inhabiting everything) is to make the boundaries of
optionality explicit, thereby avoiding Hoare's billion dollar mistake.
That said, "convenient" operators like ! already destroy half the benefit.
Plenty of experience from other languages like ML or Haskell shows that
they are almost always used incorrectly (read: over-optimistically). If a
language has to have such an operator, it should at least be very explicit
and as inconvenient as bearable.
On Wed, Aug 19, 2015 at 10:09 PM, Kevin Smith <zenparsing at gmail.com> wrote:
>> In TypeScript `?` means optional. But throw if the value is nil is the
>>> same same as non-nullable?
>> In Swift, the postfix "!" operator unwraps an optional value, throwing if
> Tingan Ho
> @tingan87 <https://twitter.com/tingan87>
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss