# C# Language Design Notes for August 22, 2018 # Agenda 1. Target-typed new 1. Clarification on constraints with nullable reference types enabled # Discussion ## Target-typed new Proposal: https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-new.md *Question: Should target-typed `new` be allowed for tuple types?* We currently don't allow the constructor syntax `new (int, int)(0, 0)`. Should we allow `(int, int) t = new(0, 0)`? Would this mean the same thing as a tuple literal, or a call to a constructor on System.ValueTuple? This would also expose some of the differences between ValueTuple and tuple types, in that there is no constructor for a tuple type with greater than 7 elements. Decision: Let's allow it, as long as that doesn't require a lot of extra work. The meaning would be to call the underlying System.ValueTuple constructors. This would expose differences in tuples with a lot of elements, but this seems like a very rare and unimportant case. *Question: Allow `throw new()`? It would convert to bare `Exception` by the spec.* Decision: Disallow. Fundamentally, we don't like this stylistically. *Question: Allow `new()` with user-defined comparison and arithmetic operators?* Decision: Allow. ## Generic constraints with nullable reference types *Question: In the following snippet, is `U` a non-nullable reference type?* ```C# void M() where T : class, U : T` {} ``` Answer: Yes *Question: In the following snippet, is `I` a non-nullable reference type?* ```C# interface I {} void M() where T : I {} ``` Answer: Yes *Q: Do we want to warn for redundant constraints?* A: We don't currently. Let's stay with that decision for now.