Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dbaupp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
24 ms
·
211.
▲
by
dbaupp
8y ago
It seems like this is an unsafe and also leaky way of wrapping the API? Copying an URIWithoutFinalise seems to allocate a new C pointer and never free it, and it seems the URI type can be copied without creating a new pointer, leading to do
212.
▲
by
dbaupp
8y ago
Accidentally "leaking" fds to a child process due to a resource leak would be a great example! However, I still feel memory/resource leaks are not the same as memory corruption. Memory corruption is more fundamental: it can b
213.
▲
by
dbaupp
8y ago
Can a memory leak be the root cause of memory corruption? No: there has to have been some other problem, which is why it is worth separating it from other more dangerous "safety" issues.
214.
▲
by
dbaupp
8y ago
I'm referring only to the thing being discussed in this post. To expand for precision: dynamic linking doesn't force the Swift compiler to insert more dynamic checks for exclusivity enforcement.
215.
▲
by
dbaupp
8y ago
No, Swift needs the static signature of the library for dynamic linking too, by default. You are correct that Swift wants to be able to change signatures without recompiling clients ("resilience"), but this is very limited, espec
216.
▲
by
dbaupp
8y ago
Dynamic linking isn't a problem. Rust's checking is local, and doesn't require checking things in other functions, just their signatures. Swift is the same. There are some cases were dynamic checks are required (e.g. with ref
217.
▲
by
dbaupp
8y ago
Standing is denser than walking, so the throughput is greater (at the cost of latency, for those who would walk). I believe the station only encouraged the break in tradition at peak times, when there are significant numbers of people waiti
218.
▲
by
dbaupp
8y ago
A more general approach to this is something like https://bors.tech/ where each merge is explicitly tested before hitting the main branch. Branches then don't need to be manually rebased, but there's still much re
219.
▲
by
dbaupp
8y ago
That means one loses all the conveniences and guarantees of the string types and, in many cases, forces an immediate revalidation the byte slice as UTF-8 to get back to &str, which is O(n). Furthermore, this is also rather clunky. I sup
220.
▲
by
dbaupp
8y ago
Rust's main toolchain has first class support for musl: https://rust-lang-nursery.github.io/edition-guide/rust-2018/...
221.
▲
by
dbaupp
8y ago
String slicing using byte indices has to exist in some form, since it is the only thing that is efficient (O(1)). But, I guess it could have used syntax other than somestring[...].
222.
▲
by
dbaupp
8y ago
That's something else: x == y, so the difference must be 0. What you said above is if x != y, x - y != 0 which holds for all x and y, but is different to if dx != 0, x + dx != x which fails for some (many!) x and dx.
223.
▲
by
dbaupp
8y ago
I believe IEEE754 floats have that subtraction/addition guarantee (as long as the hardware doesn't map subnormals to zero). The problem in this case is the input numbers are rounded when they are converted from text/decimal
224.
▲
by
dbaupp
8y ago
I think crev is actually explicitly trying to establish trust for the code, not the programmer. > It protects against compromised dev accounts, intentional malicious code, typesquating, compromised package registries, or just plain poor
225.
▲
by
dbaupp
8y ago
> Lifetimes - implicit/explicit semantics for how long a name is considered alive, whereas in C++ there would be a delete or falling out of scope. In Rust there's a move or a falling out of scope. Lifetimes are passive, and
226.
▲
by
dbaupp
8y ago
expm1 avoids catastrophic cancellation (due to finite precision floating point), and so is more accurate for x close to zero than naive(x) = exp(x) - 1, e.g. expm1(1e-100) != 0, but naive(1e-100) = 0.
227.
▲
by
dbaupp
8y ago
One reason why someone might choose to do that is performance: it ensures that any precomputation required by the two-way algorithm is cached and only done once. After the first search, later ones can jump straight into the main search loop
228.
▲
by
dbaupp
8y ago
Using a solid thermal mass is discussed on the linked wiki: https://fridge0.branchable.com/thermal_mass/ composition Water is the easy choice. A material that can be frozen would be better, because it takes a lot of e
229.
▲
by
dbaupp
8y ago
""" can't behave like this, because it won't be able to include """ itself in the string. The """# case is handled by using more #s: ##""" in string ""&
230.
▲
by
dbaupp
8y ago
Language implementors are a very special case. Their effort is O(1) while the other two are O(amount of code in the language). In any case, I don't see what your point is. --- I think you're conflating things too: NLL is defined i
231.
▲
by
dbaupp
8y ago
"User" refers to someone writing code in the programming language---someone "using" the compiler. It's not some project-management-y jargon. ----- Extending expressiveness vs sugar is fundamentally a property of the
232.
▲
by
dbaupp
8y ago
All of those unsafe "hole fixes" are features, meaning your desires are for adding even more features. Additionally, useful back pointer support (i.e. for anything more than a toy doubly linked list) is probably a bigger feature t
233.
▲
by
dbaupp
8y ago
I don't think either "linear types" or "affine types" (they're separate but related things) are ambiguous terms. Under linear typing, values must be used once, and under affine typing, at most once. Could you c
234.
▲
by
dbaupp
8y ago
There's a fundamental difference between the Rust approach of the library providing a function for opting-in to potential crashes and the C/Java approach of not distinguishing that case at all. The programmer still is forced to
235.
▲
by
dbaupp
8y ago
Ah, I see. Looking at the source code https://docs.rs/crate/failure/0.1.3/source/src/backtrace/int... , "failure" uses https://docs.rs/backtrace/0.3.9/backtra
236.
▲
by
dbaupp
8y ago
Link for convenience: https://ziglang.org/documentation/master/#Error-Return-Trace...
237.
▲
by
dbaupp
8y ago
Rust's panics and their backtrackes are essentially the same as C++ exceptions.
238.
▲
by
dbaupp
8y ago
"Parsing" CSV using split (whether on graphemes or on scalars) isn't correct at all, though, due to quoting.
239.
▲
by
dbaupp
8y ago
Why couldn't the print imported in the hypothetical short example above be made to fail? If all the stdout code is packaged into it, with the same try's, it seems like the code could at least be: pub fn main() !void { try
240.
▲
by
dbaupp
8y ago
2 cycles for a 32-bit to 64-bit extension? I don't think that makes sense: for instance, on x86-64, there's no cast necessary, just use the %rax register instead of the %eax one (plus, memory addressing works fine with 32 bit regi
More ›