922 karma · joined Aug 18, 2014 (12y ago) · 345 submissions
comment 1y ago · link · parent
This means that solar power output is much more seasonal, and most critically, power consumption in Northern Europe is highest during the winter months. I expect this is not the case for Australia.
comment 1y ago · link · parent
comment 1y ago · link · parent
The following code prints 1, 2, 3. It wouldn't do that if the variable was captured by value.
for (let i = 0; i < 3;) {
setTimeout(() => console.log(i));
i++;
}comment 1y ago · link · parent
Rust variable capture is implicit though, but it can't cause the problems described in the article, since mutable references are required to be unique.
comment 1y ago · link · parent
> lexical scope is "the portion of source code in which a binding of a name with an entity applies".
...both `let` and `var` are lexically scoped, the scopes are just different.
comment 1y ago · link · parent
comment 1y ago · link · parent
You haven't looked very hard then, NodeJS has supported worker threads for years. However, to uphold Javascript's safety guarantees, they can only communicate via message passing, or sharing a special `SharedArrayBuffer` datatype, neither of which are well suited to sharing large immutable data structures.
comment 1y ago · link · parent
Software never gets rewritten in a higher level language, but software is constantly replaced by alternatives. First example that comes to mind is Discord, an Electron app that immediately and permanently killed every other voice client on the market when it launched.
comment 1y ago · link · parent
comment 1y ago · link · parent
You can with Rust features. It allows a library to conditionally compile certain parts of the code, and users of the library can decide which features to enable.
If a library only uses stdlib in code gated by #[feature(std)], users can disable that flag, and use the library in no_std contexts.
comment 1y ago · link · parent
comment 1y ago · link · parent
Yes
> Does that sort of thing have to be considered when planning the orbits of probes etc?
Yes, it's a primary concern when sending probes to other planets
> Is Earth traveling fast enough, from the viewpoint of Alice floating near the sun, to have a gravity "tail" or "wake" trailing after it?
If I understand you correctly, then classically (i.e. ignoring relativity), no. Your gravitational acceleration towards the earth depends only your distance to it. If you consider general relativity? It's... complicated.
comment 1y ago · link · parent
I'm sure you could technically emulate all this in C++ is you keep throwing template metaprogramming at it, but at that point anything is a C++ subset and the statement loses all pratical meaning.
comment 1y ago · link · parent
While this may work as a rough heuristic, it's not true in theory nor in practice. First example that comes to mind: Rust has proper sum types (Called enums), which are used everywhere, and C++ doesn't have anything like it.