Re:Show HN: The C3 programming language (C alternative langu...
by mort96 on Sunday April 06, 2025 @06:47PM
(#43605639)
I don't understand why you're repeating this. The module is a struct, not an object. That means that in Zig, module lookup and object member lookup are different things. A module is not an object, it is a struct, so looking something up in a module is not looking up a member in an object.
[ Parent
| on HN ]
Re:Show HN: The C3 programming language (C alternative langu...
by throwawaymaths on Monday April 07, 2025 @08:01AM
(#43610308)
Please enlighten me, what are objects in zig? As far as i know this is not a defined concept in the language, so I'm assuming you think that structs are objects because struct namespace functions can be called with a syntactic sugar that makes it look like an object in a language that has them.
Do you mean object like object file (to be linked)? Those don't have member functions as far as I know.
Re:Show HN: The C3 programming language (C alternative langu...
by mort96 on Tuesday April 08, 2025 @05:20AM
(#43619750)
Why would I think that structs are objects?
I'm using "object" as it is commonly used; essentially a value. In e.g Java or C or C++, the struct/class is a type, and an instance of the struct/class is an object.
Accessing an object's members is a different operation from looking up a symbol in a namespace. Even in Zig.