This is just a suggestion, but I feel like the usingnamespace keyword adds unnecessary complexity to the language. I really like how Zig uses variables like namespaces, and usingnamespace really breaks that nice pattern.
I feel that the statement _ = @import("std"); is far more intuitive and consistent with the rest of the language than usingnamespace @import("std");
Already in the language, the underscore can be used to mean "I don't want to assign this to a variable / constant", and it would make sense that if you don't want to assign the value of @import() to a constant, it would imply that you want to use the functions / variables from the imported file directly. It also makes sense visually, because the underscore is kind of like a blank character.
I am aware that this is a little nitpicky, but I thought I'd throw it out there as I think that it is important that Zig be as simple as possible.
I would find it odd if _ = @import("foo.zig"); imported the decls where _ in all other contexts means to throw away/ignore the result and this change seems to make _ = ... mean differently depending on where it's used.
example:
struct {
_ = @import("thing.zig"); // imports all decls
fn foo() void {
_ = @import("stuff.zig"); // what should happen here?
}
}
Most helpful comment
I would find it odd if
_ = @import("foo.zig");imported the decls where_in all other contexts means to throw away/ignore the result and this change seems to make_ = ...mean differently depending on where it's used.example: