Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Why aren't they simply namespaced, like `core.some_function`?


Because 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.


Isn't there already a magical exception for "root" and "builtin"?


not 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");`


5 characters to type instead of 1.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: