Comments (1)
Hi @QuineDot, thanks a lot!
You do say "We will look at mutating static data in the chapter on Unsafe Rust", and indeed have a page on
static mut
.. That slide should just be deleted.
I have not actually used this particular feature myself, so this is valuable information. To be honest, the slide is only there because I wanted to at least mention all the "super powers" you get when you use the unsafe
keyword. I wanted to de-mystify what it does — when teaching the class, I make a point out of telling people that unsafe
doesn't "disable the borrow checker" like you sometimes see people imply.
If you must leave in
static mut
, at least coverOnce
. But really that's just a tedious and error prone way of building up things likeonce_cell
manually. In practice people just useonce_cell
and similar instead of rolling their own.
We don't have to leave static mut
in and I'm happy to replace the page with a write up about how to actually do it like you suggest.
In fact, your suggestion touches on something I've discussed with @qwandor and @maurer from my team: we need a set of slides which gives people an opinionated approach to Rust. Something like "Real life Rust" with a bunch of problems and suggested solutions. I already entered that a bit with the examples of how to use thiserror
and anyhow
for error handling. I think we need more of this.
Such a section matches feedback I got from teaching the course internally: people who are new to Rust want to be told what the best solution is by people who have already spent the time searching for a solution. The students are smart people, but we can save them a lot of time by taking them directly to a recommended solution.
from comprehensive-rust.
Related Issues (20)
- Need explanation how `context` and `with_context` operate on non-anyhow types HOT 2
- GUI Exercise is more about text formatting than trait objects HOT 4
- Miss type, miss spell HOT 3
- Typo in Control Flow Basics - Macros HOT 1
- Examples for Sync/Send leave too many open questions HOT 2
- Ambiguous "pointers to data on the stack" HOT 2
- Add links to background information in "more to explore"
- dependabot commits dump html, git log unreadable HOT 9
- Electronic pre commit waiver/signature. HOT 2
- Fix rendering of emojis in PDFs HOT 4
- Lines not wrapping in PDF tables HOT 6
- Introduce fmt and clippy early on as "recommended practices" HOT 2
- Use secrets to allow PR commenting HOT 1
- Getting error while installing ```mdbook-svgbob``` dependency HOT 2
- Show/hide the sizing box without re-running `mdbook` HOT 38
- README.MD Contains dead link
- Incorrect niche optimization explanation for the linked list in the box section HOT 10
- Update the same comment with schedule changes
- Android stopped the transition to Bazel a few months ago. We may have to amend the original text.
- Better course schedule diff
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comprehensive-rust.