Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
verdagon
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
151.
▲
by
verdagon
4y ago
That was a typo, supposed to say "memory unsafety". Thanks for catching that, edited now.
152.
▲
by
verdagon
4y ago
I think there's three reasons one might use Zig instead of Rust. These are just opinions, and I would love yall's thoughts. First: there's only a certain amount of effort that one is willing to put into accomplishing one'
153.
▲
by
verdagon
4y ago
For many situations, a language will add a lot of complexity that doesn't bring much benefit. In the end, a language's complexity can sometimes be a net detriment to its user. For example, one might be making an embedded program w
154.
▲
by
verdagon
4y ago
I suspect this might not be a problem for Zig long-term. One can imagine a blend of comptime, concepts, and generics which which can help mitigate (and often solve) these kinds of problems. When combined with compiler enforcement (or even a
155.
▲
by
verdagon
4y ago
This is a perspective I've been following and cultivating for a long time, and even led to my current endeavor [0]. Code should really be structured to be easy for us humans to understand and change, and we humans are sometimes not as
156.
▲
by
verdagon
4y ago
Did Trasodone cure the sleep apnea itself or the low threshold?
157.
▲
by
verdagon
4y ago
Good point, the statement was too absolute. Perhaps I should instead say that for a lot of use cases C solved enough of the problems that assembly previously solved.
158.
▲
by
verdagon
4y ago
A few big benefits off the top of my head: * A concurrency mechanism that's very easy to use, because it doesn't have the function coloring problem of async/await. * Extra assistance with memory safety, via its "release-
159.
▲
by
verdagon
4y ago
The region borrow checker was originally designed for a reference-counted system, but not any more. We later discovered generational references, a method for memory-safe single ownership with no borrow checker, reference counting, nor garba
160.
▲
by
verdagon
4y ago
To add to that, there are some applications for which memory unsafety just doesn't cause that much harm. I worked on a very large C++ codebase that compiled to webassembly, which runs sandboxed in people's browsers. It only talked
161.
▲
by
verdagon
4y ago
There's some exciting work already going on in this space, in fact! * Andrew Kelley is looking into combining escape analysis with allocators to assist in Zig's memory safety. [0] It could be quite a step forward! * D is adding a
162.
▲
by
verdagon
4y ago
> Nice balanced writeup! However, I am not convinced one can make something solving all the things Rust solves which is substantially simpler as language. I used to think this too, but my opinions have evolved a bit. Recall the transitio
163.
▲
by
verdagon
4y ago
I realize I was ambiguous; I didn't mean to say "just use assertions and panics", I meant "just use assertions and panics for unexpected errors", my apologies. I wouldn't recommend someone only use Result<T,
164.
▲
by
verdagon
4y ago
In a language like Rust, one has to carefully orchestrate the dance between Ship, &mut Ship, and &Ship... and Rc<Ship> and RefCell<Ship> and Cell<Ship> and Rc<RefCell<Ship>> and Box<Ship>. In the
165.
▲
by
verdagon
4y ago
I think that the "let it fail" approach is often inevitable, even when we try to use Result<T, E>. Often, we see an "unknown" variant in the error enum, as a catch-all for a library's unexpected errors. Then,
166.
▲
by
verdagon
4y ago
I'd imagine retrying/reconnecting is compatible with the general "let it fail" approach. If you just sent a message/request to an actor/server and it still hasn't responded after 5 seconds, you can send an
167.
▲
by
verdagon
4y ago
In a lot of fields, it's more important to have a codebase that's easier to use and more flexible than a codebase that uses less memory. This is why people opt for GC and why it's such a big benefit.
168.
▲
by
verdagon
4y ago
I suspect the mismatch is actually due to the borrow checker's inability to do various common abstractions such as delegates and observers. These patterns are quite useful, especially in stateful situations such as GUI. They help decou
169.
▲
by
verdagon
4y ago
I respectfully disagree; I don't think concurrency has to be that much more fundamentally complicated. It's likely that Rust's other design decisions are what made concurrency so difficult in Rust. Pony does fearless concurre
170.
▲
by
verdagon
4y ago
You might be interested in Cone [0] which is centered around letting their users build custom memory management strategies, and then making them all work together with each other and a borrow checker. [0] https://cone.jondgoodwin
171.
▲
by
verdagon
4y ago
Thanks mate, I appreciate the kind words. I try not to judge myself too harshly for taking the time off, but it does help to hear it from a kind soul such as yourself. Luckily, the PTSD isn't spilling over into my other interests (game
172.
▲
by
verdagon
4y ago
Askin' the right questions! The generations are colocated with the objects, and we can release memory back to the OS using the virtual memory shenanigans explained in [0]. However, the design and implementation have simplified quite a
173.
▲
by
verdagon
4y ago
If talking about regions and HGM, that's fair to say. Regions are further behind where I hoped because the latter stages are blocked on generics, and I had to take 8 months off a year ago because of some PTSD from work (long story). I
174.
▲
by
verdagon
4y ago
That would be pretty cool! I'm not sure Rust can support these features, though. * Generational References involve some pretty deep compiler support. One can implement something like it in Rust with a thread-local side table, but with
175.
▲
by
verdagon
4y ago
Happy to oblige, edited it upward. Hope your day is going well =)
176.
▲
by
verdagon
4y ago
(Disclaimer: Vale lead here!) You might be interested in what we're working on with Vale, its core innovations happen to be around memory management. Some off the top of my head: * Generational references, for single-ownership memory s
177.
▲
by
verdagon
4y ago
I think impostor syndrome naturally emerges from the way we usually interact with those around us. Everyone puts their best face forward, emphasizes their strengths, and downplays their weaknesses. In fact, it's often a requirement for
178.
▲
by
verdagon
4y ago
There are many methods, but this is one of my favorites. If the bias is rooted in fear, then it can sometimes help to ask yourself a bunch of "what if X" questions, where X can be anything related to the idea. While doing this, pa
179.
▲
by
verdagon
4y ago
I recommend a first step of identifying the "pure calculation" sections of the function, and separate those out into other functions. If there's any slight adjustments you can make to make a section more pure, then do so. It
180.
▲
by
verdagon
4y ago
Very cool! I wonder if this, combined with some sandboxing for apps' unsafe code, could make a more secure OS than any previous mainstream ones.
More ›