Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
OskarS
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
19 ms
·
241.
▲
by
OskarS
2y ago
The killer feature for me with SQLite is as an application file format: https://sqlite.org/appfileformat.html It has SO MANY advantages over every other solution. It can do the "just a bundle of files" thing, but
242.
▲
by
OskarS
2y ago
I’ve never touched a PEG parser in my life and parsing isn’t super my thing in general, but: a recursive descent parser could parse this just fine (not left recursive), correct? But it would have to backtrack after trying rule 1 five times,
243.
▲
by
OskarS
2y ago
Go see Furiosa! It's not quite as incredible as Fury Road, but it's pretty darn great, and it's the exact kind of movie you should see in the cinema. Feeling the rumble in the chair from the sound system while watching is hon
244.
▲
by
OskarS
2y ago
> In the above example, do you agree that any tail call elimination would result in the wrong evaluation of `g(5) = 0` instead of the correct `g(5) = 4`? No, I very much do not agree: it is still a tail call, and can use tail call optimi
245.
▲
by
OskarS
2y ago
I'm not totally 100% on this, but: valueless_by_exception happens when the move assignment operator throws (which should never happen in good C++, but is not disallowed by the language). That means, the variant used to hold value X, we
246.
▲
by
OskarS
2y ago
I find that argument very unpersuasive: the optimization is tail CALL elimination, not tail RECURSION elimination, and the call to f(x-1) is certainly a tail call. I see no reason you couldn't optimize away that stack frame. "Tail
247.
▲
by
OskarS
2y ago
It's a good question, I'm not sure. I do think it's clearer what's going on, and the steps are more obvious. Like, there's a joke in the song about what to do with the carry, if you add it to subtrahend digit or rem
248.
▲
by
OskarS
2y ago
> But I already pointed out that the steps aren't different. They're the same style. Whether you use the term "carry" or "borrow" makes no difference to anyone. Obviously, it does. Like, that's what the
249.
▲
by
OskarS
2y ago
Yeah, ultimately it's the same algorithm, it's just a question of what are the details of the procedure, which makes it confusing if you've learned one way and not the other. The whole point of the song is that Lehrer thinks
250.
▲
by
OskarS
2y ago
I would say there are two more esoteric options: "no memory allocation at all outside of the program stack" (like... i dunno... lambda calculus?) and fancy-pants computer sciency things like linear types. No sane language does eit
251.
▲
by
OskarS
2y ago
You can do it in C for sure, but "culturally" in C, there's a stateless global allocator called "malloc", which is not the case in Zig. For instance, if you have a library libsomething in C, it will at most (probabl
252.
▲
by
OskarS
2y ago
It absolutely does not. A C++ structure is a much richer object: it can have custom copying, moving and assignment behaviours, it can have vtables, it has RAII, etc. That's the whole point about the "object model" in the arti
253.
▲
by
OskarS
2y ago
Of course the syntax sugar is a good thing if it makes it easier to write the code, but if the question is about "expressive power of the type system", it's not really relevant: Zig's type system can properly express a s
254.
▲
by
OskarS
2y ago
Raku does a version of that as well, it's sick.
255.
▲
by
OskarS
2y ago
The primary concern with this isn't necessarily the extra allocation and GC (though that plays a part too), it's the fact that you're chasing a pointer for every object. That's murder for the cache. MUCH faster to just h
256.
▲
by
OskarS
2y ago
Yeah, it's not bad. Guido famously preferred the list comprehension style over the functional style, but when you have nested data types and the "monadic style" (ish) functions, it does really make sense. You could imagine it
257.
▲
by
OskarS
2y ago
Probably confusing it with Java, where the only value types are the basic ones (unless you store each individual coord in a different array).
258.
▲
by
OskarS
2y ago
You should check out MagicaCSG, which is a more sophisticated version (though still free!) of this: https://ephtracy.github.io/index.html?page=magicacsg#ss-caro...
259.
▲
by
OskarS
2y ago
Not a public one, because they want to have the freedom to change how it works. But if you type in `EXPLAIN CREATE TABLE x(y);` or `EXPLAIN SELECT 3;` or whatever into `sqlite3`, you can see it. And it's reasonably straightforward to d
260.
▲
by
OskarS
2y ago
Windows and particularly macOS makes it difficult to run things that aren't code signed with trusted certificates. Same with packages in Linux package managers. That provides a large level of assurance that the thing you download is ve
261.
▲
by
OskarS
2y ago
Yeah, I was a little bit baffled when I saw the post. I move between two different multi-screen setups with different arrangements (at home and at work), plus using my laptop alone. I haven't done like a study or whatever if it remembe
262.
▲
by
OskarS
3y ago
Yeah, this is a really interesting point, I should try this again with [[musttail]] on clang.
263.
▲
by
OskarS
3y ago
Exactly. The only reason not to use goto here is because of a dogmatic opposition to ever using goto. In fact, this is a rare case where goto makes the flow of the program more clear rather than less clear, and alternate solutions are just
264.
▲
by
OskarS
3y ago
>> - Using a single goto and single label to exit several levels of scope. > Better handled by putting the nested scope in a function and using `return`. I dunno, that seems pretty silly to me. It's a perfectly valid use case
265.
▲
by
OskarS
3y ago
I've been working my way through the latest volume of The Art of Computer Programming (Volume 4B, released last year) which is about combinatorial algorithms. One of the very first algorithms he presents Algorithm B, "Basic backt
266.
▲
by
OskarS
3y ago
Neat little problem! You could do SAT-solvers and stuff, but it's also obviously a graph search problem: each state is a vertex, each edge is an operation that leads to another vertex. So, obviously: Dijkstra works (or really just BFS,
267.
▲
by
OskarS
3y ago
Man, I did not think there were von Neumann truthers out there (seems like a particularly small hill to die on), but you live and you learn, I guess.
268.
▲
by
OskarS
3y ago
It may seem like a mixed blessing now, but without von Neumann architectures computers would not be what they are now. It's an ingenious, and non-obvious idea, that there should be no essential distinction between "program" a
269.
▲
by
OskarS
3y ago
Never realized concepts implied you can have multiple default constructors, that's hilarious. This is still a useful feature though. People complain a lot about C++ corner cases, but this is one you would probably never hit in real cod
270.
▲
by
OskarS
3y ago
> Maybe it's not much extra workload, but ()$ requires you to pattern-match all bracketed content in a string as a possible capture, and the parser can't determine whether it's a capture or not until the $ or a matching cl
More ›