Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The only people I’ve met who seem to think it’s a feud war are a few dyed in the wool C++ fans who implicitly hate the idea of programming anything else. Rust is just a language. It has some strengths and weaknesses just like every programming language. Some of its strengths are incredibly compelling.

Personally I’m relieved that we’re starting to see real competition to the C & C++ duopoly. For awhile there all the new languages were GC, and paid for their shiny features with poor runtime performance. (Eg java, C#, Ruby, Python, lua, go, etc etc)

Rust is a fine language. Personally I can’t wait to see what comes after it. I’m sure there’s even better ways to implement some of rust’s features. I hope someone out there is clever enough to figure them out.





[flagged]


> That is a surprising opinion. Rust marketing is entirely based - like in this submission - on comparing its memory safety to C/C++ and saying that C is bad!

I'm not really sure what you expect here. Like, a large driving factor of using rust (compared to C/C++) is that it has better memory safety. Should rust not talk about that? Should we try and be careful about the feelings of C/C++ devs and not name the truth in the room around memory safety?

The reason android is moving to rust is because it decreases the memory related defect rate compared to C++. Should we shy away from talking about C++ memory bugs because they're somehow embarrassing?

When C came out, I'm sure a lot was written about how much easier it was to program in compared to assembly. Does that mean there's a feud between C and assembly? I'm sure some assembly developers felt under attack. But its not a feud. Just two tools with different use cases. That's how I see C and rust.


> Even in its own "memory safety" definition, which is the first result on Google, they criticize C instead of providing a proper definition:

I'm not sure that page is intended to provide a definition of "memory safety" in the first place? It (and the following page) seem more intended to introduce safe/unsafe Rust and the boundaries between the two.

It's also from the Rustinomicon, which states:

> Unlike The Rust Programming Language, we will be assuming considerable prior knowledge. In particular, you should be comfortable with basic systems programming and Rust.

So it's arguably unsurprising that a definition of memory safety would not be found there.

My guess is that if you want a more precise definition you'd want to look at the Rust Reference (e.g., [0]) or in related areas.

[0]: https://doc.rust-lang.org/reference/unsafety.html


I don't think materially contrasting yourself with your direct competition quite constitutes a "feud war"

The downvoting patterns of anything that is mildly critical of Rust (see above) very much indicates a feud war. Rust has a dogmatic, aggressive and self-righteous community that uses any available tactic to push their language through.

The Rust literature is poorly written compared to C and Ada and the argumentation style on forums is sloppy, aggressive, and often unintelligible.

Which is a pity, because the language itself does not seem to be so bad.


> Rust has a dogmatic, aggressive and self-righteous community that uses any available tactic to push their language through.

I'm confused, because that's not been my experience of the rust community at all. I've been very critical of certain aspects of rust over the last few years, and I've (for the most part) gotten fair, reasonable feedback in response.

> The Rust literature is poorly written compared to C and Ada

I'm even more confused. Which literature are you looking at? Can you provide some examples so we’re all talking about the same thing?

I find most of the documentation around rust to be the best in the business. Eg here's the reference documentation for iterator trait, in the standard library:

https://doc.rust-lang.org/std/iter/trait.Iterator.html

Every function in that interface is well documented, with examples.

Here's the equivalent for C++:

https://en.cppreference.com/w/cpp/iterator/iterator.html

Where is the rest of it? This doesn't describe how iterators work at all. Or how to use them. There's more stuff in the header file but its inadequate by far.

So much C library code is documented in ad-hoc ways - often through doxygen, which is a disaster. Eg here's the documentation for LMDB. LMDB is one of the most thoroughly documented C APIs I've seen, but I find this almost totally unusable. I often find myself reading the source instead. There's not even any links to the source from here:

http://www.lmdb.tech/doc/group__mdb.html

In rust, any published crate automatically has a docs.rs/cratename link. Eg for serde's reference manual:

https://docs.rs/serde/

And then for the "guide" style explanation they wrote a book:

https://serde.rs/

Where is any documentation for the C standard library? As far as I can tell, there's no official documentation at all. There are man pages. But in comparison to rust's docs, or mdn for javascript, man pages are nowhere near as good. I’d give examples but this comment is too long already.


> So much C library code is documented in ad-hoc ways - often through doxygen, which is a disaster. Eg here's the documentation for LMDB. LMDB is one of the most thoroughly documented C APIs I've seen, but I find this almost totally unusable. I often find myself reading the source instead. There's not even any links to the source from here:

> http://www.lmdb.tech/doc/group__mdb.html

How is doxygen a disaster?

Why do we need links to the source code? Doxygen is already embedded in the source, you should already be reading the source code on your local machine. It makes no sense to go searching across the web for information that's already stored on your local machine. Especially since you have no idea if the version you find on the web matches the version you're using locally.


Hah! Do you have a running search giving you alerts when lmdb is mentioned or something?

> How is doxygen a disaster?

I've just never read any good, user friendly documentation ever produced by doxygen. Even when I used it myself. It always comes out looking like a pig's breakfast.

Like, take the lmdb docs. And I'm sorry for picking on it. But its a good example, because you've clearly put effort into using doxygen to document lmdb. I think the lmdb docs are about the best that doxygen generated documentation gets.

Looking at this page: http://www.lmdb.tech/doc/group__mdb.html

There's a bunch of concepts here:

- Environment (mdb_env)

- Database and database (dbi)

- Transaction

- Cursor

- Record

- Key

But none of those concepts are defined or explained. They're simply referenced without explanation in a big jumble of function names and descriptions, leaving me to figure out how they're supposed to work together. Maybe if those data types were defined up the top of the page? No. Doxygen tries to put some data structures at the top of the page - but for some reason the only documented types are MDB_val, MDB_stat and MDB_envinfo. All terrible places to start reading if you want to understand how to use lmdb.

Good documentation would lead with some front matter like:

- What does the library do

- How does the library sees the world. Here, explain the above concepts and how they relate. (Eg an environment represents a set of files on disk. Each environment contains a numbered set of databases, database contains a set of records. You can read and write within a txn. You can use a cursor to iterate. ... Etc)

- Code examples of all of the above. Ideally a hello world, and more complex / specific examples showing each feature.

Doxygen does not help with any of that. From this documentation I don't know how to use lmdb to make a correct program. I can kinda guess how to use various features, but not what the features actually are or how to use them correctly.

For example, I can obliquely tell from reading the function descriptions that an environment can be opened multiple times at the same time. But I have no idea why I'd want to do that, or how, or what performance implications there are, or if there are any gotchas I need to be aware of if I do that. I see there's a bunch of functions for mdb_env_copy. Does that copy in memory or on disk? Does it do it atomically, like at a snapshot? Is it synchronous? Does it fsync? fdatasync? What errors can happen? The documentation isn't helpful.

So I'm not just banging on about rust, here's equivalent - but much better - reference documentation for prisma:

https://www.prisma.io/docs/orm/reference/prisma-client-refer...

Prisma also has a separate guide, explaining the concepts involved:

https://www.prisma.io/docs/orm/prisma-client/queries/select-...

Or for another positive example, here's bun's documentation on using sqlite from javascript:

https://bun.com/docs/runtime/sqlite

They explain the concepts and present examples for how to use all the features. When I read those docs, I come away knowing how to use the library to solve my problems. I don't have that experience reading the lmdb documentation.

Maybe its possible to produce good documentation using doxygen. But I've never seen it done. Not even once.

-----

Side points:

> you should already be reading the source code on your local machine.

I'd rather not read the source code of all my dependencies to understand how to use them. Reading the source code of your dependencies should be a last resort. Eg, I don't go reading my compiler's source code if I want to understand my programming language. I don't want to read the source code of my web browser, or postgres, or linux, or any of this stuff.

> It makes no sense to go searching across the web for information that's already stored on your local machine. Especially since you have no idea if the version you find on the web matches the version you're using locally.

I hear you, but honestly I don't really care where documentation lives. Just so long as I can find it and read it. But with rust in particular, if you want local documentation you can run cargo doc to generate & open the documentation of your project and all your dependencies, which is nice.

And re: versions, rust docs hosted online also have a little 'version' field up the top showing which version of the library you're looking at the documentation of. Eg if you open https://docs.rs/rand/ I see "rand-0.9.2". If you change versions, the URL changes. It'd be nice if doxygen had that too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: