mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +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 }
|
||||
.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
|
||||
# The ABCs in this file are not defined as a collection of traits.
|
||||
# Use `std/abc` instead.
|
||||
.Container: ClassType
|
||||
.Hashable: ClassType
|
||||
.Sized: ClassType
|
||||
.Callable: ClassType
|
||||
.Iterable: ClassType
|
||||
.Collection: ClassType
|
||||
.Iterator: ClassType
|
||||
.Reversible: ClassType
|
||||
.Genertor: ClassType
|
||||
.Sequence: ClassType
|
||||
|
|
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