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
Removing Tuples Types? #537
Comments
From
In type Pos is (int,int) Realistically, this would be better anyway: type Pos is {int x, int y} |
One of the big challenges here, however, is: what type to give functions which return multiple values? A few points on this:
|
DavePearce
added a commit
that referenced
this issue
Jan 6, 2016
Have done a large amount of the leg-work to remove tuples. This includes removing the type from wyc, wyil and wyjc along with all corresponding bytecodes and code generation, etc. What remains is to decide how to deal with the lack of type patterns.
DavePearce
added a commit
that referenced
this issue
Jan 6, 2016
Have done a large amount of the leg-work to remove tuples. This includes removing the type from wyc, wyil and wyjc along with all corresponding bytecodes and code generation, etc. What remains is to decide how to deal with the lack of type patterns.
DavePearce
added a commit
that referenced
this issue
Jan 6, 2016
This fixes a lot of obvious problems related the handling of tuples, and partially fixes the parser. It looks likely that I will also require return types to be bracketed, and to include names.
DavePearce
added a commit
that referenced
this issue
Jan 7, 2016
Have continued and almost finished removing tuples. Lots of problems arose, including: 1) Have temporarily removed ability to handle multiple assignments 2) Have had to think about ordering of parameter and return registers in WyIL. This puts parameters first and then returns. 3) Have updated parser to disambiguiate assignments, variable declarations and function invocations. These changes will undoubtedly cause a lot of problems.
DavePearce
added a commit
that referenced
this issue
Jan 7, 2016
This patch removes the notion of a "tuple" from Whiley. This has fairly significant ramifications for the syntax of the language. Notably: 1) Removal of tuples types, expressions and associated bytecodes. In particular, this means there is no longer a notion of a "tuple LVal". This means that we lose support for "destructuring assignments". 2) Change syntax for multiple returns in functions/methods. Previously, multiple return values were handled at the Whiley source level using "type patterns". Now, instead, functions and methods have an internal notion of "returns" instead of a single "return", largely similar to the way that parameters are represented. This also means that the way registers are allocated at the WyIL bytecode level is adjusted so that parameters take the first n slots, followed by m returns and then local variables, etc. 3) Removal of "Type Pattern". One of the advantages of losing tuples is that we can basically remove the notion of a "Type Pattern" altogether. However, this means that we've temporarily (at least) lost the ability to do a rational destructuring assignment. This needs to be resolved in one way or another. 4) Return types are now required to be bracketed, and to include names. This was previously something I was considering and now seems like a good idea to drop it in. These changes are non-trivial and more thought is required to properly integrate them into the Whiley language.
DavePearce
added a commit
that referenced
this issue
Jan 10, 2016
This patch removes the notion of a "tuple" from Whiley. This has fairly significant ramifications for the syntax of the language. Notably: 1) Removal of tuples types, expressions and associated bytecodes. In particular, this means there is no longer a notion of a "tuple LVal". This means that we lose support for "destructuring assignments". 2) Change syntax for multiple returns in functions/methods. Previously, multiple return values were handled at the Whiley source level using "type patterns". Now, instead, functions and methods have an internal notion of "returns" instead of a single "return", largely similar to the way that parameters are represented. This also means that the way registers are allocated at the WyIL bytecode level is adjusted so that parameters take the first n slots, followed by m returns and then local variables, etc. 3) Removal of "Type Pattern". One of the advantages of losing tuples is that we can basically remove the notion of a "Type Pattern" altogether. However, this means that we've temporarily (at least) lost the ability to do a rational destructuring assignment. This needs to be resolved in one way or another. 4) Return types are now required to be bracketed, and to include names. This was previously something I was considering and now seems like a good idea to drop it in. These changes are non-trivial and more thought is required to properly integrate them into the Whiley language.
DavePearce
added a commit
that referenced
this issue
Jan 13, 2016
This patch removes the notion of a "tuple" from Whiley. This has fairly significant ramifications for the syntax of the language. Notably: 1) Removal of tuples types, expressions and associated bytecodes. In particular, this means there is no longer a notion of a "tuple LVal". This means that we lose support for "destructuring assignments". 2) Loss of "multiple returns" for functions or methods. This is something I may revisit in the future as I believe it's useful. But, for the moment, it remains a "nice to have". 3) Removal of "Type Pattern". One of the advantages of losing tuples is that we can basically remove the notion of a "Type Pattern" altogether. However, this means that we've temporarily (at least) lost the ability to do a rational destructuring assignment. This needs to be resolved in one way or another. In addition, I have removed the concept of a "throws clause" from wyil types altogether.
DavePearce
added a commit
that referenced
this issue
Jan 13, 2016
Many test cases used tuples, and were failing after tuples had been removed. These are now either deleted or reworked not to use tuples. There are a small number which still fail for more fundamental reasons.
DavePearce
added a commit
that referenced
this issue
Jan 13, 2016
These are a bunch of fixes which get almost all test cases passing, finally.
This was referenced Jan 13, 2016
Closed
DavePearce
added a commit
that referenced
this issue
Jan 13, 2016
This fixes some outstanding problems related to the removal of tuples. In particular, it prevents duplicate variable names between the return type and the body of the function/method.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An interesting question is whether or not we can actually remove tuple types altogether. My reasoning for this is:
To support this, I think it would be quite useful to examine the use of tuple types in my benchmarks and test cases.
The text was updated successfully, but these errors were encountered: