Update 'Interface Definitions'
parent
c8f91f394e
commit
ccc12737d0
@ -1,17 +1,21 @@
|
|||||||
|
# Syntax
|
||||||
|
```
|
||||||
|
face ro ReadWriter:Face
|
||||||
|
write
|
||||||
|
> data:{Byte ..}
|
||||||
|
< wrote:Int
|
||||||
|
< err:Error
|
||||||
|
read
|
||||||
|
> into:{Byte ..}
|
||||||
|
< read:Int
|
||||||
|
< err:Error
|
||||||
|
```
|
||||||
|
|
||||||
|
Interface sections contain a list of behaviors. Behaviors are a name followed by an indented block of inputs and outputs. It is essentially a more stripped down version of function syntax.
|
||||||
|
|
||||||
|
# Semantics
|
||||||
Interfaces in ARF are like interfaces in Go, that is to say, their methods are
|
Interfaces in ARF are like interfaces in Go, that is to say, their methods are
|
||||||
defined and any object that has at least those methods can fulfill that
|
defined and any object that has at least those methods can fulfill that
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
They are defined like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
face ro ReadWriter:Face
|
|
||||||
read
|
|
||||||
> into:{Byte ..}
|
|
||||||
< amountRead:Size
|
|
||||||
write
|
|
||||||
> buffer{Byte ..}
|
|
||||||
< amountWrote:Size
|
|
||||||
```
|
|
||||||
|
|
||||||
Interfaces are able to inherit other interfaces using type notation. If an interface inherits nothing, it must inherit `Face`, which is a blank interface.
|
Interfaces are able to inherit other interfaces using type notation. If an interface inherits nothing, it must inherit `Face`, which is a blank interface.
|
Reference in New Issue
Block a user