Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cps: implement shims for docgen #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

cps: implement shims for docgen #331

wants to merge 1 commit into from

Conversation

alaviss
Copy link
Contributor

@alaviss alaviss commented Aug 23, 2024

Currently CPS simply left the procedures untouched during docgen. This causes problems when code for whelp gets sem-ed, breaking docgen.

This commit implements a couple docgen shims:

  • cps now result in a {.cps: baseType.} pragma tagged to the resulting procedure and will show up in the generated documentation.
  • whelp will generate nil continuation for the base type of a cps proc. Parameters that are supposed to go on the bootstrap are added using let {.used.}, which should allow their effects to be reflected in the generated docs.
  • whelp will generate a Callback with a factory type that yields a the base continuation type, not the environment type. This should work for most cases when docgen are concerned.

This worked well enough for insideout docs to be generated successfully under NimSkull.

@alaviss alaviss added the enhancement New feature or request label Aug 23, 2024
@alaviss alaviss requested a review from disruptek August 23, 2024 06:54
@alaviss
Copy link
Contributor Author

alaviss commented Aug 23, 2024

How the cps tag looks like in docgen. From sys/sockets.

image

Currently CPS simply left the procedures untouched during docgen. This
causes problems when code for `whelp` gets sem-ed, breaking docgen.

This commit implements a couple docgen shims:

- `cps` now result in a `{.cps: baseType.}` pragma tagged to the
  resulting procedure and will show up in the generated documentation.
- `whelp` will generate `nil` continuation for the base type of a cps
  proc.
- `whelp` will generate a `Callback` with a factory type that yields a
  the base continuation type, not the environment type. This should work
  for most cases when docgen are concerned.

This worked well enough for `insideout` docs to be generated
successfully under NimSkull.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant