3 ms·
I quite like C syntax, and I sometimes long for a language that would change a few elements (default to const and static, different/safer standard api for strin
by makapuf 5y ago
I quite like C syntax, and I sometimes long for a language that would change a few elements (default to const and static, different/safer standard api for strings). Some might call it Go but a simple slightly updated C would be nice.
- mhh__ 5y agoThat is pretty much D (assuming you only want to use the C-like bits) - it's not const by default but const is much easier to use and much more violent And arrays are bounds checked by default, no more issues with them (and strings are arrays)
- nicoburns 5y agoHave you seen zig? It's a modern language that tries to keep the simplicity and explicitness of C (it does change the syntax a bit though).
- gpanders 5y agoI really wish Zig had followed Rust’s lead and made variables const by default :/
- samsin 5y agoVariables are immutable by default in Rust, but they're not const by default. The difference is that a variable can become mutable while a const is always immutable.
- makapuf 5y agoHow do you set a variable as mutable after the fact in rust?
- nicoburns 5y agoYou can do: let foo = "1234".to_string(); let mut foo = foo; foo = "5678"; This only works if you have ownership of the variable though. And in practice it's a pretty good compromise, because it's pretty hard to do this by mistake. Note: const in rust is different to const in some other languages: it represents a value that is duplicated inline into each use site at compile time.
- makapuf 5y agoYes I think i see it more like constexpr.