feat: Runtime type reflection #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ts-macros-issues"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
pnpm gowork cross platform 4947a80cb4ts-macros@5.2.0instead of directly from git 632c82966bThe 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.🎉