• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: August 18th, 2023

help-circle
  • Oh, Nim is possibly even a better example because it is “transpiled” rather than compiled, meaning the compiler actually generates C or C++ code. You can then compile that with whatever compiler you want. However, I don’t know of any major projects in Nim to compare against ones in C, C++, Rust, etc.

    Edit: and Zig should be extremely efficient as well.


  • It would no longer be UTF-8; it would be UTF-32. UTF-8 is an encoding scheme, meaning that it is a specification for exactly how text is encoded as bits.

    You can certainly use UTF-32 to represent all valid unicode, but you can only do that within the bounds of a single program; once you need to read or write data to or from an external source (say, the file system, or over a network), you’d need to use the same encoding that the other software uses, which is usually UTF-8 (and almost never UTF-32).


  • Who benefits from C being suppressed and attempts being made to replace him? I think there is only one answer - companies. Not developers.

    You’ve missed the group that is most affected by software quality: end-users. Almost everyone in the world relies on computers in some way now, and bugs, especially security vulnerabilities, affect people who have no say in what languages people use to develop software.

    But you as a programmer are (and must be) responsible for the code you write, not a language. And the one way not to do bugs - not doing them.

    Sounds good. How do I, the end-user of software, hold developers accountable for bugs? I guess I can switch from one buggy operating system to another, or from one buggy browser to another.

    But also, do you honestly think that the choice of language does not impact software quality at all? Surely if you were forced to write software in a raw assembly, you’d find it more difficult to write a large and complex system correctly; right? But assembly is just another language; what makes C easier to use correctly? And if C is easier to write correctly than assembly, why would it be surprising that there are languages that are even easier to write correctly, especially after five decades of development in the extremely young field of computer science? Tools are important; your programming language (and compiler) is your first, most important, and most impactful tool as a developer.

    [C] remains the fastest among high-level languages.

    How are you determining that? C, C++, Rust, Fortran, Ada, and D all compile down to machine code, with no garbage collector (D’s is optional). So there’s not really any theoretical reason why they shouldn’t all perform roughly the same. And, in fact, this is largely supported by evidence:

    • There’s a fair amount of competition among grep type tools. grep itself is written in C and heavily optimized. I think it’s fairly well known by now that ripgrep, written in Rust, is probably the fastest of these tools.
    • The TechEmpower web framework benchmarks maintains a ranking of the fastest web frameworks, updated each year. It doesn’t look like the current version of the site shows what language each framework is written in, but the top three (may-minihttp, xitca-web, and ntex) are all Rust projects. The fourth (h2o) is in C.
    • The Benchmarks Game lets people submit programs in a wide variety of languages to solve a variety of problems, and these submissions are benchmarked and compared. Rust and C are effectively neck-and-neck (note that Rust currently does actually beat C in several of the challenges). See the second graph here for an overall visual comparison among languages.

    [Side-note: no one is “suppressing” C. I’m also not convinced anyone thinks C is “useless”.]