Open
Description
Eg. A function like this doesn't compile:
fn Module(comptime T: type) type {
const ListType = ArrayList(T);
return struct {
pub fn reduce(
f: fn(T, @typeOf(init)) @typeOf(init),
init: var,
list: ListType
) @typeOf(init) {
// ...
}
};
}
Where init
is ordered before f
but is referenced by f
with @typeOf
.
However, if init
is placed at the start of the function, it is able to be referenced
// ...
pub fn reduce(
init: var,
f: fn(T, @typeOf(init)) @typeOf(init),
list: ListType
) @typeOf(init) {
// ...
}
I would have thought that @typeOf
should be able to reference an argument regardless of order.