I'm actually more puzzled about the infinite recursion in this type function:
fn Node(T: type) type {
return struct {
value: T,
next: ?*Node(T) = null,
};
}
In other languages, defining types in terms of themselves is unproblematic, because the type identifier is just a symbol and the whole thing amounts to a graph with a backreference.However, here it's supposed to represent actual executable code, which is run by the compiler and "produces" a type in the end. But how would the compiler execute this function without getting stuck in a loop?