2 ms·
Yuck. The type itself should be a different type from instances of the type, and therefore that error should be "function not found". For the first one, constr
by pjc50 2y ago
Yuck. The type itself should be a different type from instances of the type, and therefore that error should be "function not found".
For the first one, constructors should generally do required init, although there are circumstances where that's very hard. Hence the builder pattern.
- disattention 2y agoThis is a common pattern in zig and compliments comptime well. It's not supposed to be the constructor for the ArrayList, it's more like a C++ template in that you're constructing a type that then needs to be initialized. There isn't templating syntax in zig though, since you just write compile time code in zig directly (which is really nice). Also, the type is different and ZLS will insert the hint if enabled.