Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Rusky
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
61.
▲
by
Rusky
2y ago
This is the wrong side of the API to make C++20 dependently typed. Concepts let the compiler report errors at the instantiation site of a template, but they don't do anything to let the compiler report errors with the template definiti
62.
▲
by
Rusky
2y ago
The question of whether a language is dependently typed only has to do with how type checking is done. The optimizer doesn't come into play until later, so whether it uses the information is unrelated to whether the language is depende
63.
▲
by
Rusky
2y ago
C++ is not a dependently typed language, for the same reason that templates do not emit errors until after they are instantiated. All non-type template parameters get fully evaluated at instantiation time so they can be checked concretely.
64.
▲
by
Rusky
2y ago
> those “killer features” are usually absolute nonsense, very niche, or they rarely have any big benefit This is a fantastic way to turn everyone off of your language: dismiss everything they like about the ones they're already usin
65.
▲
by
Rusky
2y ago
It's not the same unwritten social contract: in Rust even the unsafe code has the same stricter type signatures as the safe code, so there is a formal way to judge which part of the program is at fault when the contract is broken. You
66.
▲
by
Rusky
2y ago
A worked example: https://github.com/pizlonator/llvm-project-deluge/blob/delug...
67.
▲
by
Rusky
2y ago
They could not "just" have used SPIR-V bytecode. WebGL already had to do a bunch of work to restrict GLSL's semantics to work in the web sandbox; whatever WebGPU chose would have had the same problem.
68.
▲
by
Rusky
2y ago
The point of the post is that conservative GC can be useful for reasons other than that simple lack of control.
69.
▲
by
Rusky
2y ago
And the same can of course be done under conservative GC...
70.
▲
by
Rusky
2y ago
Any tracing GC, conservative or precise, generational or not, already does this. Hinkley is wrong about what "conservative" and "precise" mean.
71.
▲
by
Rusky
2y ago
Paterson-Wegman and Martelli-Montanari are worst-case linear, but Algorithm J just uses the earlier almost-linear union-find approach: unification variables are represented as mutable pointers to either a) nothing, or b) another type (which
72.
▲
by
Rusky
2y ago
The Polonius rules were formulated using Datalog, but the implementation that will ship in rustc does not use Datalog: https://blog.rust-lang.org/inside-rust/2023/10/06/polonius-u...
73.
▲
by
Rusky
2y ago
In fact, those union-find trickeries come from the same paper that presented algorithm W, where they were named algorithm J. W was known from the start to be more useful for proofs than implementation: > As it stands, W is hardly an ef
74.
▲
by
Rusky
2y ago
I am not talking about UB at all. I am talking about the same constant-time stuff that djb's post is talking about.
75.
▲
by
Rusky
2y ago
Disabling all optimizations isn't even enough- fundamentally what you need is a much narrower specification for how the source language maps to its output. Even -O0 doesn't give you that, and in fact will often be counterproductiv
76.
▲
by
Rusky
2y ago
A compiler that emitted enough checks to make TypeScript sound would not perform competitively with a JIT, is my point.
77.
▲
by
Rusky
2y ago
Because the context here is the idea of using the type system to justify removing those sorts of dynamic checks to generate better code. The dynamic checks in the Java case are are a well-defined and narrowly-targeted part of the language s
78.
▲
by
Rusky
2y ago
Technically it is possible to swap the HashMap out of the Cell, mutate it, and put it back, but that is maybe even worse than the RefCell. What I would expect a production language implementation to do is build its own table that integrates
79.
▲
by
Rusky
2y ago
I guess a better way to put it is, if you got Lox working with RefCells, then you didn't need RefCells (or their overhead) to begin with - you must not have been holding those dynamic borrows any longer than a single VM instruction, or
80.
▲
by
Rusky
2y ago
You don't want to use `RefCell` for something like this- it is still too strict for Lox's semantics. Doing this properly means putting `GcData`'s fields (and/or `ObjFun`/`ObjClosure`/etc's fields) in plain
81.
▲
by
Rusky
2y ago
> Especially I find it confusing that the term mutable reference is sometimes used to mean a reference to a mutable place. It always means this- unlike C, the mutability of a place is not part of its type, so if you're talking abo
82.
▲
by
Rusky
2y ago
Yes, it's safe to cast a reference to a raw pointer and a raw pointer to an address. It might have been nicer in some ways if the language had restricted that a bit more up front, but it would probably have taken some design work to do
83.
▲
by
Rusky
2y ago
Yes, they are necessarily global pointers. If a self reference is an offset, what happens when you take its address (and pass that somewhere else that doesn't know where it came from)? Now every "reference to a reference" (
84.
▲
by
Rusky
2y ago
They're not quite that independent, because the choice of memory management strategy relies on the aliasing rules. But (as the post argues) the aliasing rules don't rely on the memory management strategy. The guarantee that &m
85.
▲
by
Rusky
2y ago
It wouldn't. For some reason in Rust people tend to apply the term "arena" to "vector + indices" as well as the proper definition, which does have that restriction.
86.
▲
by
Rusky
2y ago
Neither Windows Aero nor Zed renders every single frame, 120 times per second. The parent comment is correct is correct that the important thing is to be able to render any given frame in 1/120th of a second, but to leave things alon
87.
▲
by
Rusky
2y ago
Roslyn specifically does not include parent pointers in its immutable AST nodes. It must do this in order to share those nodes between different versions of the tree. It only introduces parent pointers in a convenience wrapper layer, bu
88.
▲
by
Rusky
2y ago
Unfortunately, C++ containers generally cannot use realloc, because they are required to invoke their elements' move/copy constructors when their addresses change.
89.
▲
by
Rusky
2y ago
&T is noalias - while there may be aliases none can write, which is the important thing - without UnsafeCell, and &UnsafeCell<T> loses noalias for that reason.
90.
▲
by
Rusky
2y ago
There's another, much nicer, solution to the contiguous allocation problem: use a proper arena allocator. This is essentially the article's `std::deque` option, but without the downsides of "every node is the same size"
More ›