6 ms·
Built-in names are essentially reserved words, and there are dozens of them. The @ prefix ensures you don't step on user's variable names, and that you can add
by ptato 3y ago
Built-in names are essentially reserved words, and there are dozens of them. The @ prefix ensures you don't step on user's variable names, and that you can add new built-ins without making breaking changes.
- andrepd 3y agoWhy aren't they simply namespaced, like `core.some_function`?
- nine_k 3y ago5 characters to type instead of 1.
- AnIdiotOnTheNet 3y agoBecause there'd need to be a magical exception for the "core" namespace that makes it not just a file of Zig code somewhere like every other module.
- deleted 3y ago[deleted]
- hiccuphippo 3y agoIsn't there already a magical exception for "root" and "builtin"?
- kristoff_it 3y agonot really, those are two modules that are always available to you, but you still have to import them like any other Zig module `const builtin = @import("builtin");`