1,655 karma · joined Mar 24, 2014 (12y ago) · 1,715 submissions
comment 2y ago · link · parent
It's almost impossible to imagine the one aspect of the dreamlike state dominating the mind without the disruption of the other, but even if the senses are perfectly unperturbed I would think the unconstrained and disordered psyche alone could be very upsetting or confusing.
comment 2y ago · link · parent
You should use the right tool for the job.
std::unique_ptr is just a move-only ergonomics type over a bare pointer, it doesn't have extra state. std::shared_ptr is basically no different than Rust's Arc.
Closures specify capture semantics explicitly, so you will always know, and default to copy.
And yes, you can capture local references and leave. Don't do that, or return references to local variables, or lots of other fun stuff.
comment 2y ago · link · parent
auto my_closure = [](int x, int y) { return x + y; };
let my_closure = |x: int, y: int| { x + y }
and frankly, the option of an explicit capture-list with aliases and mixing moves and copies is a benefit: int sum = 0, diff = 0;
auto adder = [&sum](int num) {
sum += num;
// compilation error, author didn't
// mean to capture diff.
diff -= num;
};comment 2y ago · link · parent
The Vikings themselves were eventually pacified by the same evangelization, and social integration into the new Europe.
comment 2y ago · link · parent
Why isn’t async straightforward? It seems like a fairly fundamental aspect of a language and a key differentiator. I suppose it has something to do with capturing a reference to self, but I don’t think I understood that bit either. And why are static impl traits supported but not dynamic?
At the end of the day this feature is simply inaccessible. I’m not a complete outsider, I understand why it’s useful to return a future of result user record, or the difference between impl trait and dyn trait.
There are fairly technical answers to these questions, and people have attempted to offer them, but I suppose I would need a master class to get me to where I could understand the answers.
That isn’t the case for async in most languages and I’m not really clear why people didn’t put a bit more care into the async API for Rust.
If your language requires an expert to use a fundamental feature, I feel there is a gap in the design principles.
comment 2y ago · link · parent
comment 2y ago · link · parent