Skip to content

[SR-2008] Implement SE-0110: Distinguish between single-tuple and multiple-argument function types  #44617

Closed

Description

@lattner
mannequin
Previous ID SR-2008
Radar rdar://problem/27383557
Original Reporter @lattner
Type Task
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Task, StarterBug
Assignee @slavapestov
Priority Medium

md5: 83ce6240317526d0237e3fdd515173d3

relates to:

  • SR-2135 Multiple Tuple Parameters to a Closure cannot be Decomposed in the Parameter List

Issue Description:

SE-0110 has been accepted, we just need an implementation!
https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md

Activity

  1. dduan commented on Aug 1, 2016

    @dduan
    Contributor

    Part I (disallow multi-argument to tuple coercion) implemented: #3895

  2. swift-ci commented on Aug 8, 2016

    @swift-ci
    Contributor

    Comment by Paul Meng (JIRA)

    An attempt to implement the full SE-0110: #4102

  3. jtbandes commented on Aug 18, 2016

    @jtbandes
    Contributor

    PaulMeng (JIRA User), is this done?

  4. swift-ci commented on Aug 18, 2016

    @swift-ci
    Contributor

    Comment by Paul (JIRA)

    Yes. It's merged.

  5. swift-ci commented on Aug 18, 2016

    @swift-ci
    Contributor

    Comment by Paul Meng (JIRA)

    Uh, sorry. Logged-in with the wrong account. It's merged.

  6. DougGregor commented on Sep 24, 2016

    @DougGregor
    Member

    This is done, but didn't make it into Swift 3

  7. swift-ci commented on Sep 24, 2016

    @swift-ci
    Contributor

    Comment by Alex Martini (JIRA)

    The implementation was reverted:

    f42158b

  8. swift-ci commented on Sep 26, 2016

    @swift-ci
    Contributor

    Comment by Paul Meng (JIRA)

    Let me look into it and propose a fix.

  9. swift-ci commented on Oct 6, 2016

    @swift-ci
    Contributor

    Comment by Greg Lutz (JIRA)

    I was hoping that the implementation of SE-0110 would end up fixing SR-1795, but I'm not so sure it will. The point is, if single-tuple and multiple-argument functions are distinguishable, they'd damn well better mangle to different names! So they can, for example, co-exist in the same module.

  10. benrimmington commented on Nov 14, 2016

    @benrimmington
    Contributor

    apple/swift#3895 was reverted by apple/swift#3922 (aka apple/swift@f42158b).

    apple/swift#4102 has not been reverted yet.

  11. DougGregor commented on Nov 14, 2016

    @DougGregor
    Member

    The SE-0110 implementation on master is a bit of a mess right now. SE-0110 is partially implemented, but doesn't restrict all of the cases it should restrict, and doesn't provide backward compatibility in the Swift 3 compatibility mode.

  12. swift-ci commented on Dec 26, 2016

    @swift-ci
    Contributor

    Comment by Fabian Ehrentraud (JIRA)

    Will this fix SR-2135 too?

  13. slavapestov commented on Dec 30, 2016

    @slavapestov
    Contributor

    I implemented this on master in this PR: #6133

  14. swift-ci commented on Mar 9, 2017

    @swift-ci
    Contributor

    Comment by Raphael (JIRA)

    It is not clear to me from the SE if

  15. benrimmington commented on Mar 10, 2017

    @benrimmington
    Contributor
  16. swift-ci commented on Mar 12, 2017

    @swift-ci
    Contributor

    Comment by Raphael (JIRA)

    @benrimmington I don't see how links 2,3 are related?

    I see that the issue would be to distinguish ((X,Z,Y)) -> Void from (X,Y,Z) -> Void in the literal. I guess my proposal/expectation is that { (x,y,z) in ... } always have the former type, and { x, y, z in ... } always have the latter, and that both versions are the only way to express their respective type (without explicit type annotations, that is).

    In particular, {{{ (x,y,z) in ... } }} should never match a multi-parameter function type. If I understand correctly, currently both literals would infer to the multi-parameter type, which causes the confusion and, I daresay, inconsistency.

  17. benrimmington commented on Mar 12, 2017

    @benrimmington
    Contributor

    You're proposing two changes:

    • tuple destructuring in parameter lists (which is currently not supported);

    • and for closure expressions, disallowing single parentheses around multiple parameters, or requiring double parentheses for tuple destructuring.

  18. swift-ci commented on Mar 12, 2017

    @swift-ci
    Contributor

    Comment by Raphael (JIRA)

    I guess I am.

    One could be ambitious and propose general destructuring (similar to Scala). By using a keyword, backwards-compatibility and unambiguity could be achieved.

    Example: { let (x,y,z) in ...} : ((X,Y,Z)) -> Void

    I'm not sure which Swift types can be destructured. In addition to typles, enums probably, but that would make little sense in a closure parameter list, except if we could move the case there:

  19. benrimmington commented on Jun 21, 2017

    @benrimmington
    Contributor

    Mark Lacey has merged:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions