Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ridiculous_fish
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
31.
▲
by
ridiculous_fish
2y ago
Any thoughts on the best way to express global locks in Rust? A classic example is a set of bank accounts, atomically transacting with each other. Fine-grained per-account locking is possible, but risks deadlock due to lock ordering inversi
32.
▲
by
ridiculous_fish
2y ago
It changes very little because there’s nothing to receive their kinetic energy. Neutrons lose energy by colliding with things of similar mass, such as hydrogen nuclei (often in water). If they collide with a heavy nucleus, such as plutonium
33.
▲
by
ridiculous_fish
2y ago
Why do we need the property that X is compact? Say we define X (the square) to exclude the boundary: X = (0,1)x(0,1). This is no longer a compact set, but it seems silly for the proof to now fail. Is boundedness sufficient?
34.
▲
by
ridiculous_fish
2y ago
Cobbled together from various sources: """ - Be casual unless otherwise specified - Be very very terse. BE EXTREMELY TERSE. - If you are going to show code, write the code FIRST, any explanation later. ALWAYS WRITE THE CODE F
35.
▲
by
ridiculous_fish
3y ago
What would be the fixed point of f(x) = x + 1 in the classical untyped lambda calculus? Sorry if this question is really basic, but it's honest and I find it fascinating.
36.
▲
by
ridiculous_fish
3y ago
We often extend arithmetic with new sorts of numbers to solve previously unsolvable equations like sqrt(-1) - is finding a fixed point of f(x) = x + 1 in this tradition? Does it point to an extension of arithmetic? Also I find this confusin
37.
▲
by
ridiculous_fish
3y ago
I have no background in combinatory logic, and so I've predictably never understood fixed-point combinators: 1. Every function has a fixed point. 2. A fixed-point combinator will compute it. So what is the fixed point of f(x) = x + 1?
38.
▲
by
ridiculous_fish
3y ago
One unexpected consequence is the behavior around negative zero. For example: var d = -0.0 is different than var d = 0.0 d = -d This IMO crosses the line into "outright bug" territory. https://pla
39.
▲
by
ridiculous_fish
3y ago
You mentioned a compiler crash - I suppose that means the Go compiler? That's pretty interesting! Any more information about the crash? Did you file a bug report?
40.
▲
by
ridiculous_fish
3y ago
This is on the right track but not entirely right. In your F = a1x + a0, here a0 is a force, not a position, so you cannot neglect it on the basis of "default position." Instead you set it to zero because the system is at a stable
41.
▲
by
ridiculous_fish
3y ago
The biggest footgun in `[` and `test` is the single argument behavior. For example, you might attempt to check if a variable is nonempty like so: [ -n $FOO ] but if FOO is unset, it expands to nothing (as opposed to the empty stri
42.
▲
by
ridiculous_fish
3y ago
This article implicitly assumes that a single PR corresponds to a single commit. It doesn't touch on the idea of multiple commits in a single PR. Consider adding a feature. I might structure this as three commits: 1. Refactor in a way
43.
▲
by
ridiculous_fish
3y ago
What is the advantage of breaking up a large change into multiple small PRs, compared to multiple small independently-reviewable commits as part of a single PR? If a PR introduces a new function that will be used in the next commit, I would
44.
▲
by
ridiculous_fish
3y ago
Apple's libc has a pretty wild feature (guarded by _DARWIN_UNLIMITED_SELECT, on by default) which allows fds above FD_SETSIZE. It works by checking the address of the fd_set: if it's within the current thread's stack, then th
45.
▲
by
ridiculous_fish
3y ago
This looks rough: it spawns background "worker threads" for tasks like lazy resizing; and even with that it still sometimes takes locks (see resize_mutex).
46.
▲
by
ridiculous_fish
3y ago
First time seeing dashmap, but a cursory inspection shows it works via sharded locks: pub struct DashMap<K, V, S = RandomState> { shift: usize, shards: Box<[RwLock<HashMap<K, V, S>>]>, h
47.
▲
by
ridiculous_fish
3y ago
How? I honestly don't know how to do it in C++ or Rust, without using exotic techniques like hazard pointers.
48.
▲
by
ridiculous_fish
3y ago
A fascinating design decision of Hashtable in .NET is its support for multiple readers AND a single writer. In C++ or Rust, we get multiple readers OR a single writer. Shared ref or exclusive mut, pick one. But in .NET we have AND not OR: o
49.
▲
by
ridiculous_fish
3y ago
Can you please elaborate on this? What's an example of a seemingly single threaded simple task where you would turn to async? Does "use async rust everywhere now" imply "use tokio everywhere now?" Honest question.
50.
▲
by
ridiculous_fish
3y ago
I searched for longjmp and was pleased to see someone else brought it up first. Yes, you can longjmp from a signal handler back to standard execution flow. It is even considered a "best practice" using readline! https://
51.
▲
by
ridiculous_fish
3y ago
This does not match my understanding. The AGPL does not include any linking exception, so if I include a 500 line JSON parser in my 5 million line app, and that JSON parser is AGPL licensed, then all 5 million lines are considered to be &qu
52.
▲
by
ridiculous_fish
3y ago
There's lots more details about the design in this PDF: https://alex.shamis.au/files/snmalloc-A-Message-Passing-Allo...
53.
▲
by
ridiculous_fish
3y ago
Asking as a Haskell dabbler - why are features like `ExtendedLiterals` behind an opt-in language extension? Why not just turn it on for everyone?
54.
▲
by
ridiculous_fish
3y ago
The insight here is that, for unsigned values, rounding down to a multiple of N is cheaper than rounding up to a multiple of N. In addition to simpler arithmetic, rounding down always succeeds - 0 is a multiple of all N - while rounding up
55.
▲
by
ridiculous_fish
3y ago
I think this doesn't work because `aligned + size` may wrap all the way around into the valid region again. For example if aligned == ptr + 1, and size is usize::MAX, we will end up with new_ptr == ptr and the allocation will wrongly s
56.
▲
by
ridiculous_fish
3y ago
For flooring integer division with a bounded dividend and known constant, the idea is to multiply by a scaled reciprocal. For example with 32 bit division by 3, you might precompute 2^32 / 3, multiply by that, and then flooring-divide
57.
▲
by
ridiculous_fish
3y ago
To clarify, there are two separate notions of division-as-multiplication discussed here. Modular division is straightforward to convert to a multiplication; however this is mainly for specialized applications, like cryptography and number t
58.
▲
by
ridiculous_fish
3y ago
What are some techniques to find dentists who do not engage in such aggressive over-treatments? Asking friends for recommendations is the best approach I've found - are there others?
59.
▲
by
ridiculous_fish
3y ago
Go can multiplex goroutines into a single syscall invocation. Two goroutines waiting on distinct file descriptors will use a single epoll (or similar) syscall. However not all syscalls can be multiplexed this way. IMO this partially undermi
60.
▲
by
ridiculous_fish
3y ago
Can someone in the know please elaborate on why dynamic scoping was considered more efficient than lexical scoping?
More ›