-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
type systemDesign of the Fir type systemDesign of the Fir type system
Description
I think in impl
methods we can always omit self
types. For example, we have this in the standard library:
trait Step[t]:
step(self: t): t
impl Step[I32]:
step(self: I32): I32 = self + 1
Here we can infer type of self
from the impl
head.
Another, more complex example: (note that this trait will change when we implement associated types again)
trait Iterator[iter, item]:
next(self: iter): Option[item]
map(self: iter, f: Fn(item): b): Map[iter, item, b]
Map(iter = self, f = f)
type Map[iter, a, b]: ...
impl[Iterator[iter, a]] Iterator[Map[iter, a, b], b]:
next(self: Map[iter, a, b]): Option[b] = ...
Metadata
Metadata
Assignees
Labels
type systemDesign of the Fir type systemDesign of the Fir type system