specta icon indicating copy to clipboard operation
specta copied to clipboard

#203 - Nuanced types

Open oscartbeaumont opened this issue 2 years ago • 0 comments

The high-level thinking is to separate the idea of a Rust declaration and a Typescript type. Would this mean we can remove Any, Unknown and PrimitiveType/LiteralType::None.

Questions:

  • How should List and Map constructors deal with inline vs reference
  • Right now you can have a DataType::Nullable(DataType::Nullable(...)) which is not great. Should we have it be more split up.
  • How does DataTypeFrom fit into this?
  • Should Type::inline go and instead have Reference { inline: true } and post-process it?
  • Should we merge Reference and DatTypeReference?? I feel like it makes it more typesafe so probs.
  • What if inline and definition become one method and the generics arg is an enum instead.
  • Removing NamedType???

TODO:

  • [ ] Can ImplLocation be constructed using use_caller? Should it be removed?
  • [ ] Public List constructor
  • [ ] Public Map constructor
  • [ ] DataType::is
  • [ ] Give each type a SpectaID including primitives.
  • [ ] std::convert::Infallible should be rejected by the Serde validator.
  • [ ] Rename List and Map to ListType and MapType
  • [ ] Support ! but with Serde exporter warning
  • [ ] Option for static arrays. A normal data structure should require zero memory allocations.

Tied to #203 and #140.

oscartbeaumont avatar Dec 24 '23 13:12 oscartbeaumont