miniblog.

← Back to all posts
14
One nice feature of cargo that I wasn't previously aware of: you don't need to do anything after updating your Cargo.toml. In npm, you need to remember to `npm i` after changing package.json. It's not declarative and the state can get out of sync.

4 Comments

@wilfredh Node.js's decoupled approach comes at a dubious upside, however: it's very easy to edit files in node_modules to e.g. add prints while debugging. (But then again, such an ability is not as useful in Rust, where a small change in one module can result in cascading rebuilds of the whole world)
@bojidar_bg That's an excellent point: I've had a few hairy debugging sessions where that was useful. That doesn't seem entirely conflicting with automatically updating your node_modules, but I guess the explicit invocation helps.
@wilfredh Hm.. what happens if you change the package.json file while you have a changed file in node_modules? If it's a direct dependency, overwriting the changes seems warranted, but what about changes in transitive dependencies? ..I guess the correct thing to do is to detect changes and show a diff to the user / ask them to confirm / store the diff in a special folder, but all of that comes at the cost of added package manager complexity, so not sure if someone'd implement it 😅😅