4 ms·
The standard library consists many functions that simply should be dropped. All the globals like errno, locale should be removed. Instead of global allocator, a
by Cloudef 3y ago
The standard library consists many functions that simply should be dropped. All the globals like errno, locale should be removed. Instead of global allocator, allocator struct should be passed around (zig). Headers like stddef and stddint in the standard library should be in the language instead.
https://github.com/Cloudef/zig-budoux/blob/master/src/c.zig#L9 https://github.com/Cloudef/zig-budoux/blob/master/src/c.zig#...
- amluto 3y agoAll true, but that still doesn’t mean that there will ever be a genuinely nice string type or map from string to int or a nice HTTP or any similar thing where some of the data types are dynamically sized.
- Cloudef 3y agostruct and few functions and you get there. Look at zig's std lib. "String" type is also IMO anti-pattern https://mortoray.com/the-string-type-is-broken/ https://mortoray.com/the-string-type-is-broken/ People often complain about null terminated "strings" in C, but I don't really see them as a problem. It rarely is performance bottleneck, and when it is you can opt for your own "string type". There is also bstring that's compatible with these strings but prepend header to the data which contains the length. That said I wish C had language level slicing.