Post Acaa2kSmlkeYcRf2S8 by thejpster@hachyderm.io
(DIR) More posts by thejpster@hachyderm.io
(DIR) Post #Acaa2kSmlkeYcRf2S8 by thejpster@hachyderm.io
2023-12-07T11:18:55Z
0 likes, 0 repeats
https://github.com/rust-lang/rust/pull/117472Soon you will be able to write c"Hello" in rust and get a valid UTF-8 encoded *NUL-terminated* string. This is amazing for people who work with C APIs.
(DIR) Post #Acaa2lgIF13IOczL96 by chrysn@chaos.social
2023-12-07T11:29:55Z
1 likes, 0 repeats
@thejpster I'm conflicted about this. Sure it's nice ergonomics, but `cstr!(...)` wasn't that bad, and it feels like it's giving a foreign language construct more weight in the language than it should have. Yeah it's used widely, but so is `hexlit!(...)`, and where do we stop.
(DIR) Post #Acaa7btS3jpfUJS5J2 by dalias@hachyderm.io
2023-12-07T17:47:24Z
0 likes, 0 repeats
@chrysn @thejpster It's not just "foreign language" but a fundamental part of the contract with system interfaces and lots of inter-systems interfaces. No good reason for excluding it except anti-C ideologuerry.
(DIR) Post #Acaa7chR3toZzKq0DQ by chrysn@chaos.social
2023-12-07T18:33:00Z
0 likes, 0 repeats
@dalias I'm not arguing its exclusion, but that it's getting this prominent a place in the language instead of a namespaced extension point.The point on system interfaces is true for Unix based OSes, but on embedded and WASM systems I don't know of any interfaces where nul-terminated strings are meaningful.
(DIR) Post #Acaa7dUi6hEKS9tM1I by dalias@hachyderm.io
2023-12-07T18:35:52Z
1 likes, 0 repeats
@chrysn That's THE STANDARD for interfacing with an OS. Any OS that attempts to be interoperable with the corpus of existing software rather than going off and doing its own random thing. Attempting to characterize that as "just" "unix based OSs" is ideologuerry.