Hacker News new | ask | show | jobs
by pcwalton 498 days ago
> typeclasses/traits are, internally, virtual classes with a vtable pointer

No, they're not. Rust "boxed traits" are, but those aren't what the author means.

> Primarily because if Zig did have a full Unicode string and some "character" type, now it'd be on the standard library devs to not only define what a "character" is, and then we risk having something like the C++ Unicode situation where you have a char32_t type, but the standard library isn't equipped to handle that type, and then you run into "Oh this encoding is broken" and on and on and on it goes.

The standard library not being equipped to handle Unicode is the entire problem. Not solving it doesn't avoid the issue: it just makes Unicode safety the programmer's responsibility, increasing the complexity of the problem domain for the programmer and leaving more room for error.

4 comments

Not being able to easily write a program without Unicode being pulled in for Rust code was a reason I'd chosen C over Rust before. When targeting binary sizes measured in kilobytes, pulling in full unicode handling is not an option. Especially since programs that don't have direct human interaction rarely actually need unicode.
> The standard library not being equipped to handle Unicode is the entire problem

Zig: I want to be a safer C

C: I don't have string type

Zig: No… not like that!

> The standard library not being equipped to handle Unicode is the entire problem.

what? unicode is in the standard library.

https://github.com/ziglang/zig/blob/master/lib/std/unicode.z...