v0.2.17
This commit is contained in:
@@ -16,30 +16,35 @@ operator implémentation d'un contrat opérateur
|
||||
### Exemple 2
|
||||
|
||||
```text
|
||||
opération infaillible
|
||||
-> retourne directement T
|
||||
|
||||
opération pouvant produire une erreur récupérable
|
||||
-> retourne Result<T>
|
||||
ou Result<T,E>
|
||||
T
|
||||
T throws SomeException
|
||||
T faults SomeFault
|
||||
T throws SomeException faults SomeFault
|
||||
Result<T,E>
|
||||
Result<T,E> throws SomeException
|
||||
Result<T,E> faults SomeFault
|
||||
```
|
||||
|
||||
Le type de retour et le mécanisme d'échec sont indépendants.
|
||||
|
||||
### Exemple 3
|
||||
|
||||
```text
|
||||
method length() -> uint64
|
||||
method containsKey(K key) -> bool
|
||||
Object::sameInstance(Object other) -> bool
|
||||
func min(int32 a, int32 b) -> int32
|
||||
func readConfig(String path) -> Config
|
||||
throws IOException
|
||||
|
||||
method elementAt(uint64 index) -> T
|
||||
faults IndexOutOfBoundsFault
|
||||
```
|
||||
|
||||
### Exemple 4
|
||||
|
||||
```text
|
||||
func readFile(String path) -> Result<String, IoError>
|
||||
method parse(String input) -> Result<Value, ParseError>
|
||||
func parseExternalInput(String input) -> Result<Value, ParseError>
|
||||
```
|
||||
|
||||
`Result` reste utilisé lorsque l'échec doit être transporté comme une valeur.
|
||||
|
||||
### Exemple 5
|
||||
|
||||
```text
|
||||
|
||||
Reference in New Issue
Block a user