609 karma · joined January 10, 2021
My reading of this article wasn't to say that these things are impossible in C++, just that they're not the default or the first thing you try as a beginner is perfectly wrong.
This isn't going to work for everyone, but if you're dealing with non-tech-savvy but mostly-able-to-use-a-computer users, it can, and it being graphical seems to be less of a hill than if I tell people to run `python -m http.server` in the terminal (because, "what is a terminal"...)
This is how I personally use it for discovery, anyway. The other day I was writing some Rust code and needed to remove a prefix from a &str. I tried a few common names after ‘.’ to see what would autocomplete, before finding that Rust calls this idea “trim_start_matches”. I then wanted to know what happens if the prefix wasn’t present, so I just hovered my mouse over it to read. Now, if I was writing Rust a lot, I would end up memorizing this anyway. I’ve never not written Python without a similar tool involved, yet I have a pretty close to encyclopedic knowledge of the standard library.
I feel similarly about go-to-definition. I often use it the first time I’m exploring code, or when I am debugging through some call stack, but I also always do read where I actually end up, and do form a mental map of the codebase. I’m not sure I buy either the contention in this thread that these “crutches” make developers uniformly worse, or that removing them would make all poor developers suddenly more disciplined
For what it's worth,
use integrate::adaptive_quadrature::simpson::adaptive_simpson_method;
use statrs::distribution::{Continuous, Normal};
fn dnorm(x: f64) -> f64 {
Normal::new(0.0, 1.0).unwrap().pdf(x)
}
fn main() {
let result = adaptive_simpson_method(dnorm, -100.0, 100.0, 1e-2, 1e-8);
println!("Result: {:?}", result);
}
prints Result: Ok(1.000000000053865)It does seem to be a usability hazard that the function being integrated is defined as a fn, rather than a Fn, as you can't pass closures that capture variables, requiring the weird dnorm definition
It seems pretty obvious to me that the quality of both teaching and assessment plummeted during this time, so I suspect that it’s even harder than usual to trust things like a transcript to see what an applicant really knows
There is a fork at https://github.com/emception/emception that is trying to make it more production ready, but it looks like that may have stalled
I currently have a use case that uses a server running an emscripten build (using SMODULARIZE and some exports, I suppose it’s not a true dylib)
I’m also a paid Synergy user, and it’s frankly comedic how long Wayland support has been on their road map. I’m not convinced it’s ever coming, which means I’m probably only 1-2 distro updates from being forced to use something else
I think the premise that a lot of experienced programmers can write good C++ is at least somewhat valid. They know to not use raw pointers, which APIs to use for bound checking, whatever. The issue is that new users don’t, and the defaults are bad.
If I have to write #feature on safety in every file, it becomes possible to forget. Opting in vs opting out