-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
You can see it here. I've seen it in some new languages, and I think it fits perfectly into Zig. Also, it allows adding functions that operate on any type after declaring all their members: just put it as the first argument.
glfwSetKeyCallback(window, key_callback); // Meh
window.glfwSetKeyCallback(key_callback); // Nice!
struct TwoNumbers {
x: i32,
y: i32,
pub fn add() -> i32 {
return x + y;
}
}
// Simple and clean!
pub fn sub(self: TwoNumbers) -> i32 {
return self.x - self.y;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.