mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Add abc.er
This commit is contained in:
parent
7b16e413f7
commit
9b319379d1
2 changed files with 25 additions and 13 deletions
|
@ -1,13 +1,12 @@
|
||||||
.Container = Trait { .__contains__ = (self: Self) -> Bool }
|
# The ABCs in this file are not defined as a collection of traits.
|
||||||
.Hashable = Trait { .__hash__ = (self: Self) -> Nat }
|
# Use `std/abc` instead.
|
||||||
.Sized = Trait { .__len__ = (self: Self) -> Nat }
|
.Container: ClassType
|
||||||
# TODO: varargs
|
.Hashable: ClassType
|
||||||
.Callable = Trait { .__call__ = (self: Self) -> Obj }
|
.Sized: ClassType
|
||||||
# .Iterable T = Trait { .__iter__ = (self: Self) -> Iterator T }
|
.Callable: ClassType
|
||||||
.Iterable = Trait { .__iter__ = (self: Self) -> .Iterator }
|
.Iterable: ClassType
|
||||||
.Collection = Subsume .Container and .Iterable
|
.Collection: ClassType
|
||||||
# .Iterator T = Trait { .__next__ = (self: Self) -> T }
|
.Iterator: ClassType
|
||||||
.Iterator = Trait { .__next__ = (self: Self) -> Obj }
|
.Reversible: ClassType
|
||||||
.Reversible = Trait { .__reversed__ = (self: Self) -> .Iterator }
|
.Genertor: ClassType
|
||||||
.Genertor = Subsume .Iterator
|
.Sequence: ClassType
|
||||||
.Sequence = Subsume .Collection and .Sized and .Reversible
|
|
||||||
|
|
13
compiler/erg_compiler/lib/std/abc.er
Normal file
13
compiler/erg_compiler/lib/std/abc.er
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
.Container = Trait { .__contains__ = (self: Self) -> Bool }
|
||||||
|
.Hashable = Trait { .__hash__ = (self: Self) -> Nat }
|
||||||
|
.Sized = Trait { .__len__ = (self: Self) -> Nat }
|
||||||
|
# TODO: varargs
|
||||||
|
.Callable = Trait { .__call__ = (self: Self) -> Obj }
|
||||||
|
# .Iterable T = Trait { .__iter__ = (self: Self) -> Iterator T }
|
||||||
|
.Iterable = Trait { .__iter__ = (self: Self) -> .Iterator }
|
||||||
|
.Collection = Subsume .Container and .Iterable
|
||||||
|
# .Iterator T = Trait { .__next__ = (self: Self) -> T }
|
||||||
|
.Iterator = Trait { .__next__ = (self: Self) -> Obj }
|
||||||
|
.Reversible = Trait { .__reversed__ = (self: Self) -> .Iterator }
|
||||||
|
.Genertor = Subsume .Iterator
|
||||||
|
.Sequence = Subsume .Collection and .Sized and .Reversible
|
Loading…
Add table
Add a link
Reference in a new issue