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

Don't require ugly comma for structural extensions #7036

Closed
Simn opened this issue May 17, 2018 · 4 comments · Fixed by #7127
Closed

Don't require ugly comma for structural extensions #7036

Simn opened this issue May 17, 2018 · 4 comments · Fixed by #7127
Assignees
Milestone

Comments

@Simn
Copy link
Member

Simn commented May 17, 2018

typedef T1 = {
    > T2, // <--
    var x:String;
}

I don't think we need that comma for the parser.

@Simn Simn added this to the Release 4.0 milestone May 17, 2018
@Simn Simn self-assigned this May 17, 2018
@nadako
Copy link
Member

nadako commented May 17, 2018

random thought: what would maybe look cool asthetically in the long notation is extends T2 instead of >T2 :)

@back2dos
Copy link
Member

How about we parse this as TExtend:

typedef T1 = T2 & {
  var x:String;
} & T3 & {
  var y:Int;
}```

This could be considered equivalent to:

```haxe
typedef T1 = {
  >T2, >T3,
  var x:String;
  var y:Int;
}

Beyond that point we would treat "base types" the same, i.e. it wouldn't work for classes or enums (at least not for now).

Or we could substitute TExtend by TIntersect(t:Array<ComplexType>) and have it work only for the cases when it currently works. Does that stand a chance as a haxe-evolution proposal?

@Simn
Copy link
Member Author

Simn commented May 17, 2018

@back2dos
Copy link
Member

Ah, well, ignore me then ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants