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

Support returning literals in specs #39

Closed
mkaput opened this issue Jun 15, 2020 · 2 comments
Closed

Support returning literals in specs #39

mkaput opened this issue Jun 15, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@mkaput
Copy link
Member

mkaput commented Jun 15, 2020

sometimes it could be handy to hide generation of constant literals inside unifex specs, for example to express void procedures, or known error atoms:

spec remove_stream(state, stream_id :: unsigned) :: nil
spec create() :: {:ok :: label, state} | {:error :: label, :failed}

on ambiguous cases, unifex should raise a compilation error, e.g.:

spec foo() :: {:error :: label, 8} | {:error :: label, 9}
@mkaput mkaput added the enhancement New feature or request label Jun 15, 2020
@mkaput
Copy link
Member Author

mkaput commented Jun 15, 2020

Currently as a workaround one may use :: label, though note it influences result creators' naming:

spec remove_stream(state, stream_id :: unsigned) :: (nil :: label)
spec create() :: {:ok :: label, state} | {:error :: label, :failed :: label}

@mickel8
Copy link
Member

mickel8 commented Apr 22, 2021

Moved to #61

@mickel8 mickel8 closed this as completed Apr 22, 2021
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

No branches or pull requests

2 participants