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

feat(primitives): replace Option by Ziglang's native optional type #8

Open
tcoratger opened this issue Sep 13, 2023 · 0 comments
Open

Comments

@tcoratger
Copy link
Owner

Description:

Currently, there is an Option function in the codebase designed to mimic the behavior of Rust's Option type. You can find the code here:

pub fn Option(comptime T: type) type {
return union(enum) { None: bool, Some: T };
}

However, in order to align more closely with Ziglang's idiomatic style, it is advisable to replace this custom Option function with Ziglang's native optional type. Ziglang provides a robust and efficient way of handling optional values. You can refer to the Ziglang documentation on Optionals for more information: Zig Documentation - Optionals.

This change will not only make the codebase more in line with Ziglang conventions but also improve readability and maintainability.

Proposed Solution:

Replace the custom Option function with Ziglang's native optional type where applicable in the codebase.

Additional Context:

This change aims to enhance code quality and maintainability by leveraging Ziglang's built-in features. It will also promote consistency with Ziglang best practices.

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

No branches or pull requests

1 participant