Using the type above, if I want to implement an associated function (should we call these "methods"?) on Vec[U8], there's currently no syntax to specify that T = U8.
An idea:
# T is left generic, no need to specify
fn Vec.push(self, elem: T) = ...
# T is overridden after the type name
fn Vec[U8].readByte(byteIdx: Usize): U8 = ...
One disadvantage of this is that I can no longer easily search for function definitions, for example I can't do ag -w 'fn Vec.readByte' and find the definition of it.
We can't put it after the function name as that's for the predicate list. E.g.
Using the type above, if I want to implement an associated function (should we call these "methods"?) on
Vec[U8]
, there's currently no syntax to specify thatT = U8
.An idea:
One disadvantage of this is that I can no longer easily search for function definitions, for example I can't do
ag -w 'fn Vec.readByte'
and find the definition of it.We can't put it after the function name as that's for the predicate list. E.g.