About the non-nullable types debate

前端 未结 7 644
北海茫月
北海茫月 2020-12-20 18:07

I keep hearing people talk about how non-nullable reference types would solve so many bugs and make programming so much easier. Even the creator of null calls it his billion

7条回答
  •  一向
    一向 (楼主)
    2020-12-20 18:31

    I'm currently working on this topic in C#. .NET has Nullable for value types, but the inverse feature doesn't exist for reference types.

    I created NotNullable for reference types, and moved the problem from if's (no more checks for null) to the datatype domain. This makes the application to throw exceptions in runtime and not in compile-time.

提交回复
热议问题