feat: Runtime type reflection #17

Merged
glen merged 21 commits from ts-macros-issues into main 2023-10-17 22:02:18 +00:00
Owner

Now each behavior specification "knows" its type information.
Also bumps version number and sets up so that the scripts will run on Windows as well as Unix (thanks to Jos).
Resolves #5.
Resolves #16.

Now each behavior specification "knows" its type information. Also bumps version number and sets up so that the scripts will run on Windows as well as Unix (thanks to Jos). Resolves #5. Resolves #16.
glen added 21 commits 2023-10-17 22:01:57 +00:00
ebe7cf831e refactor: Explore final patterns for runtime typing with ts-macros
The idea is to have a single macro which lets you reflect multiple
  implementations. That's provided in this commit. However, there
  is a hitch with implementations that have no dependencies: the
  reflectedType property did not exist on the Signature type. However,
  if you add it, then the Signature type becomes opaque, so we would
  have to look up signatures; but that appears to be tricky, as there
  doesn't seem to be a way to reflect the full generic type of the
  Signatures interface.

  So this commit provides three example resolutions:
  (A) Export a type RTT and all no-dependency implementations have to
      intersect with RTT (see 'add' in number/arithmetic.ts)
  (B) Write no-dependency implementations as functions of no arguments
      (representing no dependencies passed in) returning the actual
      implementation (see 'subtract' in number/arithmetic.ts)
  (C) Make a special DSignature<> generic type (short for "Direct Signature"
      used only (and always) for implementations with no dependencies, and
      a matching $Dreflect!() macro for generating their type info.

  Of course, there may be other possibilities I haven't thought of. But we
  need to pick one. I don't think it matters _too_ much, since there only
  a small fraction of all implementations have no dependencies.
6f44567306 refactor: Extend reflection to all implementations so far
And also enhances the reflected type parsing so that the types of all
  implementations so far will parse.
glen merged commit 40146c2f48 into main 2023-10-17 22:02:18 +00:00
Collaborator

🎉

🎉
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: glen/typocomath#17
No description provided.