The name of this particular feature might confuse a lot of developers wondering “Isn’t nullable reference a bad idea?” or “Shouldn’t it be called non nullable reference types?”. Sir Tony Hoare, a British computer scientist invented null references and famously called them the “Billion Dollar Mistake” as the biggest problem is, of course, the risk of getting the infamous null-reference exception.
Since all reference types in C# can be null, you always run the risk of getting an exception when you try to access some member of the object. Functional languages try to deal with this problem by having a type that represents the concept of potential absent value. Instead of introducing non-nullable reference types in C#, Microsoft has chosen to consider reference types as non-nullable by default and provide mechanisms to deal with nullable types. Since the premise of a reference is often considered to be non-nullable and to be dereferenced.
Asynchronous streams provide the ability to use async/await inside an iterator. In most cases, an iterator is implemented synchronously. There are some cases, however, where it might need to await a call on every iteration to fetch the next item. In such cases, asynchronous streams can come in handy. To support this feature, a couple of things need to be taken care of:
The primary use case for default interface methods is to enable the developer to safely evolve an interface. You could add new methods to it and, as long as you provide a default implementation, existing clients of the interface wouldn’t be forced to implement it. Another important value proposition of default implementation on interfaces relates to Android and iOS. Since both Java and Swift offer this feature, it’s tricky to use C# to wrap Android/iOS APIs that make use of default interface implementations. C# 8.0 will make it possible to wrap those APIs more faithfully.
There are plenty of other features proposed to be implemented in C# 8 such as target-typed new expressions, covariant return types, and extension everything. All these features are in different stages of development and a lot can (and probably will) change from now until C# 8.0’s release Till then you can closely follow the official Github repo for C#.
Stay up to date with the latest features, release dates, and general discussions on key programming tools and tech by subscribing to Packt Hub.
Red Programming Language for Android development!
What’s new in Visual Studio 1.22