Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Umbrella] Deconstruction work items #11299

Closed
jcouv opened this issue May 13, 2016 · 0 comments
Closed

[Umbrella] Deconstruction work items #11299

jcouv opened this issue May 13, 2016 · 0 comments

Comments

@jcouv
Copy link
Member

jcouv commented May 13, 2016

This list is no longer maintained. Remaining work items and issues are tracked as issues with label "Tuples".

This is the TODO list for the development of the deconstruction language feature for C# 7.

Known issues and scenarios

LDM

  • D-assignment return type: could we make use of the return-type of Deconstruct method?

  • D-declaration with typeless tuple literals. (answer: let's make it work. LDM 7/13)

    (string x, byte y, var z) = (null, 1, 2); // what is the type on the RHS?
    (string x, byte y) temp = (null, 1); // the type on the right is (string, byte)
  • What is the return type of a deconstruction-assignment expression? Void or some tuple? (answer: currently void, but if we have time let's do smart tuple return. LDM 7/13)

    • Treat Deconstruct as a kind of conversion in more scenarios?
    (object z5, long z6) = KVP.Create("hello", 42); // You can do this (deconstruction)
    (object z8, long z9) z7 = KVP.Create("hello", 42); // You cannot do this...
  • I assume no compound assignment (x, y) += M(); (answer: not at this point. LDM 7/13)

  • Wildcard? (answer: yes, should probably be star. LDM 7/13)

  • Should anonymous types have a Deconstruct? (answer: no, low value. LDM 7/13)

  • Should names matter in deconstruction? (answer: yes, let's warn tuple literal var (x, y) = (a: 1, x: 2);)

  • Confirm that var (x, y) = ... should be an error if var type exists. (answer: correct)

  • Confirm that var (x, y) = ... is a deconstruction even when a ref-returning "var" method exists. (answer: correct)

  • FYI the Deconstruct method is now resolved like an invocation with out vars. (confirmed, yes)

    • This has implications on bad Deconstruct shadowing another good one (see BadDeconstructShadowsBaseDeconstruct). (confirmed, that's ok)
    • Can dynamic be desconstructed? (answer: no)
  • What contexts are deconstruction-declarations allowed in? (answer: LDM confirmed the prioritization above)

    • P0: local declaration, for statement, foreach,
    • P1: let clause, from clause,
    • later: lambda, method declaration, using, outvar, join clause, query continuation clause, join into clause, catch.
  • Is (int x, var (y, z)) = M(); allowed? (answer: yes)

  • I assume no mix of assignment and declaration int x; (x, int y) = M(); (answer: confirmed in 5/25 LDM)

  • I assume deconstruction-assignment should work even if System.ValueTuple is not present. (answer: that is no longer the case, ValueTuple is required)

  • Switching to tuple-returning-Deconstruct? (answer: no)

  • What is the evaluation order for nested deconstruction-assignment? (answer: all LHS side-effects, all RHS, all conversions, all assignments)

  • Finalize syntax for deconstruction-declaration. (answer: var (x, y) = M(); and (int x, int y) = M();)

    • Reserving ‘var’, or maybe give up on ‘var (x, y) = M();’ syntax that is ambiguous with method invocation. (answer: no need)
    • Considering ‘@’ to simplify parsing of deconstructions. (answer: no need)
  • Do the names matter? int x, y; (a: x, b: y) = M(); (answer: for now this should be error)

Interaction with other language features:

General concerns:

  • Error handling/recovery
    • Errors in parsing
    • Error handling for semantic errors (e.g. ambiguous lookup, inaccessible lookup, wrong kind of thing found, instance vs static thing found, wrong type for the context, value vs variable)
    • Missing types (mscorlib or others)
  • Public interface of compiler APIs, backcompat scenarios
  • backward and forward compatibility (i.e. interoperation with previous and future compilers, each in both directions)
  • VB/F# interop, Mono issues
  • BCL and other customer impact
  • Determinism
  • Loading from metadata (source vs. loaded from metadata)
  • Atomicity
  • Edit-and-continue
  • Completeness of the specification as a guide for testing (e.g. is the spec complete enough to suggest what the compiler should do in each scenario?)
  • XML docs and other external documentation
  • Performance
  • Reflection
  • Review proposed changes to public API
  • Debugging
  • Leverage feature in Roslyn codebase (dogfood)

Types and members:

  • Access modifiers (public, protected, internal, protected internal, private), static modifier
  • Parameter modifiers (ref, out, params)
  • Attributes (including security attribute)
  • Generics (type arguments, constraints, variance)
  • default value
  • partial classes
  • literals
  • enum (implicit vs. explicit underlying type)
  • expression trees
  • Iterators
  • Initializers (object, collection, dictionary)
  • array (single- or multi-dimensional, jagged, initilalizer)
  • Expression-bodied methods/properties/...
  • Extension methods
  • Partial method
  • Named and optional parameters
  • String interpolation
  • Properties (read-write, read-only, write-only, auto-property, expression-bodied)
  • Interfaces (implicit vs. explicit interface member implementation)
  • delegates
  • Multi-declaration

Code:

  • Operators (see Eric's list)
    • Operator overloading
  • Lvalues: the synthesized fields are mutable
    • Ref / out parameters
    • Compound operators (+=, /=, etc ..)
    • Assignment exprs
  • lambdas (capture of parameters or locals, target typing)
  • execution order
  • Target typing (var, lambdas, integrals)
  • Type inference
  • Conversions
    • Implicit (identity, implicit numeric, implicit enumeration, implicit nullable, null litaral, implicit reference, boxing, implicit dynamic, implicit constant, user-defined implicit conversion, anonymous function, method group)
    • Explicit (numeric, enumeration, nullable, reference, unboxing, dynamic, user-defined)
    • Anonymous functions
  • nullable (wrapping, unwrapping)
  • OHI
    • inheritance (virtual, override, abstract, new)
    • overload resolution
  • Anonymous types
  • Unsafe code
  • LINQ
  • constructors, properties, indexers, events, operators, and destructors.
  • Async

Misc:

  • reserved keywords (sometimes contextual)
  • pre-processing directives
  • COM interop

    Interaction with Debugger:

  • typing in immediate/watch window (that also covers hovering over a variable)
  • displaying locals (that also covers autos)

Interaction with IDE:

References

#10642

@jcouv jcouv self-assigned this May 13, 2016
@jaredpar jaredpar added the Bug label May 17, 2016
@VSadov VSadov added this to the 2.0 (Preview 1) milestone Jun 11, 2016
@gafter gafter modified the milestones: 2.0 (Preview 1), 2.0 (RC) Jun 20, 2016
@jaredpar jaredpar modified the milestones: 2.0 (RC), 2.0 (RTM) Jul 18, 2016
@jcouv jcouv added this to the 2.0 (Preview 5) milestone Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done Umbrellas
Development

No branches or pull requests

4 participants