Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Rusky
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
31.
▲
by
Rusky
1y ago
The handler doesn't have to follow the pattern of "do its work, resume the computation, go away." It can instead do things like "do some work, resume the computation, do some more work." Or even more invasively, &qu
32.
▲
by
Rusky
1y ago
Yeah, you're still responding to something I'm not saying, and not saying anything I'm trying to argue with. I wrote "who" as shorthand for "the language implementation vs the individual programs."
33.
▲
by
Rusky
1y ago
I mean, again, yeah. I specifically compared the safe API/unsafe implementation aspect, not who writes the unsafe implementation. To me the interesting thing about Rust's approach is precisely this ability to compose unrelated pie
34.
▲
by
Rusky
1y ago
Yeah, that's what I meant by "depends on the specific programs you're writing." Confining unsafe Rust to core libraries is totally something people do.
35.
▲
by
Rusky
1y ago
The stuff Fil-C adds is on the same footing as `unsafe` code in Rust- its implementation isn't checked, but its surface area is designed so that (if the implementation is correct) the rest of the program can't break it. Whether th
36.
▲
by
Rusky
1y ago
Why would it require constructors? As opposed to simply enforcing that it always be initialized with a constant/variable/procedure/etc rather than zeroed.
37.
▲
by
Rusky
1y ago
If you don't want to make it "opt-in" would it at least make sense to make it "opt-out"? Does Odin have a way for specific types to omit a zero value?
38.
▲
by
Rusky
1y ago
It's worth noting (and the paper does go into this) that this is limited to a very specific subset of UB, which they call "guardable." They are not removing UB around things like out-of-bounds or use-after-free, which would
39.
▲
by
Rusky
1y ago
wavemode's comment only applies to `&mut T`. You do not have to use `&mut T` to form the reference graph in your arena, which indeed would be unlikely to work out.
40.
▲
by
Rusky
1y ago
That is true of `&mut T`, but `&mut T` is not the only way to do mutation in Rust. The set of possible safe patterns gets much wider when you include `&Cell<T>`. For example see this language that uses its equivalent of `&
41.
▲
by
Rusky
1y ago
You can explain this sort of pattern to the borrow checker quite trivially: slap a single `'arena` lifetime on all the references that point to something in that arena. This pattern is used all over the place, including rustc itself. (
42.
▲
by
Rusky
2y ago
> And in Rust? Well, let's see. Turns out monomorphization isn't all you need. Turns out that it is, in fact, occasionally useful to unify an object and its behavior in a runtime-polymorphic way. I expect yeet_expr to go throug
43.
▲
by
Rusky
2y ago
It means you can't just write `impl Bar for MyType` and get Foo pulled in automatically. You have to write both `impl`s yourself. The inheritance-like syntax is shorthand for `trait Bar where Self: Foo`, and bounds like this can show u
44.
▲
by
Rusky
2y ago
Algebraic subtyping and structured typing are not the same thing. Algebraic subtyping is a specific approach to type inference and checking of subtyping, which may or may not be used with structural types.
45.
▲
by
Rusky
2y ago
I believe they only standardized the two's-complement representation (so casts to unsigned have a more specific behavior, for example) but they did not make overflow defined.
46.
▲
by
Rusky
2y ago
> They can't now. They could up to and almost including 1.0. At that point the consensus was that memory leaks were unsafe and so unsafe code could rely on them not happening. That code was not incorrect! This is not how it worked,
47.
▲
by
Rusky
2y ago
> Rust's definition of "unsafe" is basically just "whatever Rust prevents". It's not that circular. Rust defines data races as unsafe because they can lead to reads that produce corrupt values, outside the s
48.
▲
by
Rusky
2y ago
> - You can't export a reference to the thing you are dropping. You can do that in C++. This prevents "re-animation", where something destroyed comes back to life or is accessed beyond death. Microsoft Managed C++ (early 2
49.
▲
by
Rusky
2y ago
That's true as Pratt described it. I mentioned it because it's a good example of the general idea of extending recursive descent to handle more deterministic grammars than vanilla LL.
50.
▲
by
Rusky
2y ago
> A properly implemented Earley parser will do unambiguous grammars with left/right/mutual recursion in linear time. It's not linear for all unambiguous grammars- only deterministic grammars, which can also be parsed with
51.
▲
by
Rusky
2y ago
I don't care. I wasn't trying to say whether you were or weren't. Not every comment on HN is a direct rebuttal to its parent.
52.
▲
by
Rusky
2y ago
> step 2 was fine, because it wasn't C, so it didn't have the aliasing semantics of C. LLVM still has its own aliasing semantics. It must, both so that it can exploit at least some of C's aliasing rules, and more important
53.
▲
by
Rusky
2y ago
My point was that toy examples like this are useful as long as you think about them consistently. I wasn't trying to make any claims about your concrete argument in particular.
54.
▲
by
Rusky
2y ago
A good mental exercise with these kinds of examples is to imagine splitting up the parts of the program that each optimization looked at, so that they live in different translation units. This prevents your mind from playing games with what
55.
▲
by
Rusky
2y ago
The IR doesn't have to cater to programmers in the same way, and can support many choices of semantics simultaneously in a single program. For example, LLVM IR is used to compile C both with and without strict aliasing. The choice is l
56.
▲
by
Rusky
2y ago
Exactly. This is essentially converting the parser to bottom-up just for these rules. It's how Pratt parsing/precedence climbing works. I wrote this post on the connection: https://www.abubalay.com/blog/2021&#
57.
▲
by
Rusky
2y ago
Rust's ownership model has two aspects: - A dynamic part specifies what is actually allowed, and totally supports doubly linked lists and other sorts of cyclic mutable data structures. - A static part conservatively approximates the dy
58.
▲
by
Rusky
2y ago
Ah, I wasn't really talking about Rust. Rust already does have some level of const generic expressions, but they are indeed only possible to instantiate with values known at compile time, like C++. The difficulty of type checking them
59.
▲
by
Rusky
2y ago
The point of dependent types is to check these uses of N and M at compile time symbolically, for all possible values, without having to "lift" their actual concrete values to compile time. Typical implementations of dependent type
60.
▲
by
Rusky
2y ago
Is what really dependently typed? I'm saying C++ is not dependently typed, because it doesn't do any symbolic verification of N and M.
More ›