Code Monkey home page Code Monkey logo

Comments (1)

mgeisler avatar mgeisler commented on May 22, 2024 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 cover Once. But really that's just a tedious and error prone way of building up things like once_cell manually. In practice people just use once_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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.