feat: Template operations #41

Merged
glen merged 10 commits from template_operations into main 2022-08-01 10:09:32 +00:00

10 Commits

Author SHA1 Message Date
Glen Whitney 36e7b750ce refactor: Make generics more strict via templates
This commit also adds a built-in `typeOf` function to every PocomathInstance.
  It also adds a notation (prefix '!') for "eager" templeates that
  instantiate themselves for all types immediately upon definition.
2022-08-01 03:02:38 -07:00
Glen Whitney fd3d6b2eb3 feat: Template implementations 2022-07-31 23:33:58 -07:00
Glen Whitney 1076c3c727 feat: add built-in typeOf operator to PocomathInstance 2022-07-31 21:26:16 -07:00
Glen Whitney 7bbdc049ce refactor: add stub for patch to generic template behavior 2022-07-31 21:08:28 -07:00
Glen Whitney 171b6941f4 refactor: add stub for instantiating the template 2022-07-31 11:10:41 -07:00
Glen Whitney 5cea71cb25 refactor: isolate in the code the point of template instantiation 2022-07-31 11:10:41 -07:00
Glen Whitney 0fbcbf661e refactor: separate the generation of a typed-function implementation 2022-07-31 11:10:41 -07:00
Glen Whitney 5c3716ff99 refactor: Avoid use of a "magic string " 'T' 2022-07-31 11:10:41 -07:00
Glen Whitney d4a4d8f331 refactor: track all the 'prior types' of a type as types are installed
These are exactly the types that might match before the given type, and
  hence which require to have their template instantiations defined when
  an instantiation with the given type is made.
2022-07-31 11:10:41 -07:00
Glen Whitney 883a351aa8 refactor: Add stubs for function templates
The stubs are so far all no-ops so basically at the moment the only
  allowed template parameter 'T' is just a synonym for 'any'. But at least
  this allows us to put the definition of the generic `subtract` into
  the exact form we actually want to support.
2022-07-31 11:10:41 -07:00