Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pcwalton
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
45 ms
·
571.
▲
by
pcwalton
4y ago
You shouldn't be giving Zig (or C, for that matter) a free pass. If your language isn't memory safe, and it compiles to LLVM with the optimizations on, then it's inheriting most of the complexity of Rust's undefined beha
572.
▲
by
pcwalton
4y ago
Borrow checking only works if your APIs are designed with borrow checking in mind. Zig's APIs are not, so they won't borrow check.
573.
▲
by
pcwalton
4y ago
> Programmer forgot to handle a division by zero in some degenerate case of the smoothing computation which ends up leading to an exception: a value becomes zero, someone used unsigned integers for n in an "n - 1" computation w
574.
▲
by
pcwalton
4y ago
Pew Research Center says the progressive left are 6% of the public and 12% of Democrats: https://www.pewresearch.org/politics/2021/11/09/progressive-... This seems about right, given that they couldn
575.
▲
by
pcwalton
4y ago
We live in a democracy in which most people think that the government should step in to ensure commodities necessary for survival, like housing or food, remain affordable. Given that in California (and many other places) every community s
576.
▲
by
pcwalton
4y ago
There are plenty of very livable US college towns with medium-density downtowns, condos for far less than $1M, plenty of green space, and streets I'd feel comfortable letting my kids (if I had any) ride their bikes around. Bloomington,
577.
▲
by
pcwalton
4y ago
A 19% decrease in housing prices, even assuming that that number were true (it's not even close to that for the SF property I own, for example), is not nearly enough to make SFBA affordable. Your argument was stronger when you were sim
578.
▲
by
pcwalton
4y ago
What California is moving towards strikes me as eminently sensible: the local community may decide where to place the housing, but it must zone for enough housing somehow . This preserves "community voice in community matters"
579.
▲
by
pcwalton
4y ago
In Rust's case it was popular demand. Old Rust used dynamic linking a lot more. But our users demanded static linking (Go's popularity was a big driver of this), so the decision was made to do static linking by default.
580.
▲
by
pcwalton
4y ago
Zig has raw pointers with pointer arithmetic/indexing [1], so as far as I can tell it doesn't enforce spatial memory safety. I don't think spatial memory safety alone is a large improvement over C++ in particular, since most
581.
▲
by
pcwalton
4y ago
Memory safety is also a helpful productivity tool, because it eliminates bugs, even if those bugs don't turn into security vulnerabilities. Whether that is worth the mental overhead of the lifetime/borrow system is something you h
582.
▲
by
pcwalton
4y ago
The reason why you need the barycentric extension and can't just make up barycentric coordinates in your vertex shader like: out vec3 vBarycentricCoords; void main() { ... // wrong vBarycentr
583.
▲
by
pcwalton
4y ago
Ah, I see, it's a split stack. Well, we experimented with those in Rust for Rust->C calls and they were not fast enough (also, they cause problems with debuggers and tooling). Perhaps if virtual calls are uncommon, though. At that p
584.
▲
by
pcwalton
4y ago
No worries, it's my fault for not being clear. The absolute last thing I want to do is to take credit for things we didn't do. Rust wouldn't exist without that academic work by Tofte, Talpin, Grossman, etc.
585.
▲
by
pcwalton
4y ago
Oh, I'm sorry, I didn't mean to imply that Rust invented any of those things. Cyclone was a big influence on Rust actually. We chatted with Dan Grossman early on, and his presentation "Existential Types and Imperative Languag
586.
▲
by
pcwalton
4y ago
Honestly, I think what you describe is a much more defensible claim--in fact, I suspect it's true that the vast majority of bugs in C++ code aren't memory safety. I've often seen the stronger claim that memory safety proble
587.
▲
by
pcwalton
4y ago
It sounds like the "region borrow checker" is fundamentally based on reference counting, which makes it a garbage collected system. Also, statically eliminating reference count traffic from the stack isn't new; it goes back t
588.
▲
by
pcwalton
4y ago
> Rust is a terribly complex language, there are people at FAANG companies threatening to fork the language when attempts to simplify it are proposed. Ironically, the person I think you're referring to is actually me, and that'
589.
▲
by
pcwalton
4y ago
Car analogies aren't a substitute for actually writing widely-attacked software. There are systematic reasons why I'm skeptical Zig's approach will lead to better results than what we see in modern C++. The worst memory safet
590.
▲
by
pcwalton
4y ago
There have been memory-safe non-GC languages before, like Ada SPARK, but they generally disallow heap allocation altogether. If you heap allocate you get a GC. There were also some academic languages, most notably ML Kit, that offered a saf
591.
▲
by
pcwalton
4y ago
The trouble here is the same problem that affects tons of static analyses: what do you do about higher order functions. I'm pretty skeptical that heap allocating every call to a function pointer/closure/virtual method is goin
592.
▲
by
pcwalton
4y ago
Well, that weaker sense of "correct programs have no UB" is true for Rust as well, then.
593.
▲
by
pcwalton
4y ago
For what it's worth, I totally agree with you that GC is a perfectly reasonable memory management solution for most apps. "GC is bad" is not the takeaway anyone should have from new systems languages like Rust and Zig.
594.
▲
by
pcwalton
4y ago
Do you disallow function pointers/closures/virtual methods too, since these can be used to smuggle recursion into the semantics without the compiler being able to statically detect it? You'd have to heap allocate every call t
595.
▲
by
pcwalton
4y ago
We've had close to 50 years to answer the question "is memory safety necessary to write secure code under normal industry development practices"? During this time dozens of languages have come and gone, and the evidence still
596.
▲
by
pcwalton
4y ago
> In practice, it's not an issue, and unlike with rust I have a very clear idea of when and where memory is being freed and allocated. I'm very skeptical that the lack of memory safety is not going to be an issue "in pract
597.
▲
by
pcwalton
4y ago
How does Zig protect against stack overflow? To make a "100% panic-safe program" you must disallow recursion .
598.
▲
by
pcwalton
4y ago
This is incorrect in two ways. First, Zig certainly has undefined behavior. Any non-memory-safe language trivially has UB. Second, this implicitly assumes that terminating on OOM is not "correct" behavior, and handling OOM is the
599.
▲
by
pcwalton
4y ago
You expect to go to jail for being caught stealing $1,000 from a cash register. So you shouldn't be surprised when you go to jail for stealing $1,500,000 in cryptocurrency.
600.
▲
by
pcwalton
4y ago
The indictment describes the numerous ways in which the perpetrator managed to obfuscate the insider trading. It didn't stop the USG from finding him and prosecuting him.
More ›