This commit is contained in:
2026-09-13 10:20:16 +02:00
parent 019c8ad335
commit b72193d656
38 changed files with 1523 additions and 837 deletions

View File

@@ -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