by loxodrome 8 hours ago

I just want Zig with classes, Zig++. :(

TSiege 8 hours ago | [-1 more]

Isn't the whole point of zig that it eschews classes and object oriented programming?

dnautics 6 hours ago | [-0 more]

You can bind functions to structs and first parameter is special cased when it's a pointer-to or a const version of the structs... What more do you want really besides inheritance (which is considered dangerous by many). In the era of LLMs do you really want that sort of "hidden action" that you force the LLM to inefficently reason through?

F3nd0 7 hours ago | [-1 more]

Or possibly Objective-Zig. :-)

jsight 2 hours ago | [-0 more]

I'd expect that to get swiftly replace by something else.

Mond_ 8 hours ago | [-3 more]

What exactly do you need that Zig doesn't have? Inheritance?

cgh 8 hours ago | [-2 more]

Proper interfaces would be nice. I realize that eg tagged unions work for most cases but the syntactic sugar would reduce a bit of friction.

smj-edison an hour ago | [-1 more]

What form of interfaces would you want? Something trait-based? Rust's orphan rule has bitten me many times now, and it causes consolidation around certain libraries. Something like Go's interface, where the signature just needs to match? That would be nicer than the current situation with `anytype`, but I don't know if it's better enough to justify a full interface system. Curious to hear your thoughts.

cgh 17 minutes ago | [-0 more]

Essentially enough syntactic sugar so you could write eg the Allocator interface without manually specifying the vtable and the opaque pointer.

But yeah, Go’s system is nice and simple. I am not sure, but I think the fact that Zig programs are a single compilation unit might have some bearing on the orphan rule. There is no concept of crates so “traits”/interfaces can be defined and implemented anywhere.