Why don't we have two nulls?

后端 未结 27 1132
孤独总比滥情好
孤独总比滥情好 2021-02-02 08:38

I\'ve often wondered why languages with a null representing \"no value\" don\'t differentiate between the passive \"I don\'t know what the value is\"

27条回答
  •  心在旅途
    2021-02-02 08:46

    In .net langages, you can use nullable types, which address this problem for value types.

    The problem remains, however, for reference types. Since there's no such thing as pointers in .net (at least in 'safe' blocks), "object? o" won't compile.

提交回复
热议问题