From 8ddd1748b8c644b2754f5bb442bd697837aff17b Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Mon, 1 Jan 2024 23:56:31 +0100 Subject: [PATCH 1/2] actually write things --- docs/design/types.typ | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/design/types.typ b/docs/design/types.typ index 2e4af6e..1fa9fac 100644 --- a/docs/design/types.typ +++ b/docs/design/types.typ @@ -3,8 +3,14 @@ doc ) -= meow nya += Type data model -nyanyanya +== Requirements -#lorem(50) +- Color-aware + - It can handle colors and colorspaces for images + - ocio???? +- number/number type support +- custom types (structs/enums) +- algebraic enums +- traits (`Numeric`...) -- 2.46.0 From 5b55dd30ab035160c5de37d5753d6e5e595b0ec0 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Mon, 8 Jan 2024 13:43:44 +0100 Subject: [PATCH 2/2] write some ideas for the type system --- docs/design/types.typ | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/design/types.typ b/docs/design/types.typ index 1fa9fac..198bdd7 100644 --- a/docs/design/types.typ +++ b/docs/design/types.typ @@ -3,7 +3,7 @@ doc ) -= Type data model += Type system == Requirements @@ -14,3 +14,30 @@ - custom types (structs/enums) - algebraic enums - traits (`Numeric`...) +- functions as data + +== Ideas + +=== Generic-focused + +Color-awareness may be handled as seperate types, so one might have `LinearRgb`, `SRgb`, `Xyz` etc. Optimally implemented using our own constructs. + +An image in sRGB might have the following type signature: `Image`. Colors could also have a trait which could implement conversions. + +=== Group inference + +==== Example: Multiplying an image with 0.5 + +The syntax should be the same as just multiplying two numbers, just that one of the values is an image. + +Type signatures of the values in a generic system: + +`Image> * f32` + +Desugared that would look like this: + +`[[(u8, u8, u8)]] * f32 -> [[(u8, u8, u8)]]` + +Since all of the values are numbers (-> implementing `Num`/`Number`), they should be able to implicitely multiplied. + +Since an image has additional data, how should that be handled? should the resolution be static array lengths? -- 2.46.0