• 1 Post
  • 12 Comments
Joined 2 years ago
cake
Cake day: June 17th, 2023

help-circle



  • First and foremost: It’s not about optimization, as I have mentioned before. Never once have I intended to optimize the conversion, because I know it is pointless. Stop making that assumption and only then we can continue the discussion.

    There is no reason why people cannot use Rust as “C, but actually type-safe”. A type-safe representation of C’s error code pattern is a part of that. This way the code is “backwards compatible” with debuggers designed for C/C++, such that “-EINVAL” is actually displayed as “-EINVAL” in the debugger and not a mysterious struct of (discriminant, data).


  • The reason I asked the question, was that I wanted to keep an int an int throughout the program.

    It’s not for performance reasons, it’s just that I feel like there is a certain elegance in keeping things type safe entirely “for free” much like how Option<&T> is actually just a regular T*, even if it could be pointless in the big picture.



  • I don’t know where D fits nowadays and which problem it’s trying to solve.

    My experience has been similar - it’s hard to categorize the language.

    As a low-level system language like C, C++, Rust, Zig? The garbage collector makes it a hard sell to other people, even though one can opt out of it.

    As a higher-level application language like Java and Go? D frequently gives me a “low-level language” feel, but I am not sure why.

    As a scripting language? I feel like its type system works against the rapid-prototyping coding style commonly seen in scripts.