iowo/docs/design/type-notation.typ

39 lines
989 B
Text
Raw Permalink Normal View History

#import "../template.typ": conf
2024-01-11 09:48:43 +00:00
#show: conf
= Type/signature notation
Operator signature that takes two unnamed arbitrary numbers of the same type and returns another:
2024-01-11 09:48:43 +00:00
```iowo
Op<T: Num> [ T T ] -> T
```
2024-01-11 09:55:25 +00:00
Operator signature that takes any color and any number type, and returns a color again:
```iowo
Op<C: Color, M: Num> [ C M ] -> C
```
Operator that takes a 32 bit signed integer and returns another:
2024-01-11 09:48:43 +00:00
```iowo
Op i32 -> i32
```
Operator that does the same with a generic arbitrary number type:
2024-01-11 09:48:43 +00:00
```iowo
Op<T: Num> T -> T
```
One dimensional list of 32 bit signed integers:
2024-01-11 09:48:43 +00:00
```iowo
[i32]
```
2024-01-18 19:29:41 +00:00
Due to inference, you'll also be able to use that in some mathematical operations with integers:
`[i32] + i32` is a valid operation, for example (of course, you can't add types.) But that wouldn't add the second one to the list, but rather add the single i32 to all values in the left hand side list). That would also work with more dimensional arrays and dynamic streams like videos.