-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Solve the return type ambiguity #1628
Conversation
* <container> { ... } -> <container> . { ... } * <exrp> { ... } -> <expr> . { ...}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's try to get all the changes in a branch, so that master always has all tests passing, with stage1 and stage2 agreeing on syntax.
Edit: oh, I see, this is the branch, and you're still working on it. 👍
* <container> { ... } -> <container> . { ... } * <exrp> { ... } -> <expr> . { ... }
…to solve-return-type-problem
I have all tests passing locally. The |
In using . before { it mentions "Remove the requirement of () for if, while, for, switch, etc.". I pulled in the branch and gave it a try on an
Is it the long term plan to remove the requirment for the parens? |
@winksaville I did not remove this requirement, as the purpose of this PR is to solve the return type ambiguity. Someone else could then remove the requirement in their own PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pending self hosted compiler parsing update
@Hejsil when you get back from your trip, I have an idea how we can avoid too much conflicts, when merging this:
hopefully that reduces the number of conflicts. |
Jobs done! |
I'm really sorry, this is not in anyway trying to be picky or undermind the great work that you guys are doing, but I don't like this change to the language, I may get used to it, but I have a point.
const point = Point.{ .x = 10, .y = 20 }; I respect your decision and I regret not contributing to the original discussion, but I would like to ask to reconsider using I wouldn't mind using keywords like const Point = struct.define {
x: i32,
y: i32,
};
const point = Point.new {
.x = 10,
.y = 20,
}; and to be quite honest I much prefer the original way without a dot or a keyword. |
@Hejsil Thanks, I will do so. |
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
Fixes #760
I chose using
.
before{
as the way to solve this.I've only made the changes nessesary for stage1 to compile this code:
Next step is to have a
zig fmt
branch that can translate old code into the new syntax, and then use that to finish this PR.