yeslogic / doodle

6 stars 1 forks source link

[lang-model]: First-Class Option-type at all layers #187

Closed archaephyrryx closed 4 months ago

archaephyrryx commented 4 months ago

First-Class Option-model (simple, narrow, cons)

We currently have several layers that implicate the std::option::Option type for the ValueType of Formats, specifically around the Format::Maybe type. However, it is not currently possible to work with this as a first-class type in the model.

Example: deflate.rs

In the above example, we are forced to construct a monomorphic microcosm of the Option type instead of being able to access it natively. Along with the inconvenience of this workaround, we also lose the convenient API of the Option type in generated code.

We also lack Value::Option (and ParsedValue::Option), Pattern::Some(Box<Pattern>) and Pattern::None, as well as other, possibly obscure locations where a first-class Option model would be useful/convenient.