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

Only allow foreign declarations in a top-level module #1442

Closed
yav opened this issue Sep 27, 2022 · 2 comments
Closed

Only allow foreign declarations in a top-level module #1442

yav opened this issue Sep 27, 2022 · 2 comments
Assignees
Labels
FFI Foreign function interface

Comments

@yav
Copy link
Member

yav commented Sep 27, 2022

If we were to allow foreign declarations in nested modules, it is possible to have multiple declarations with the same name, so we'd need some way to disambiguate between them.

To keep thing simple, we should only allow them at the top level. Of course, a nested module could easily define a Cryptol function that simply calls a foreign declaration defined in its ancestor, so this does not really loose any functionality.

@yav yav added the FFI Foreign function interface label Sep 27, 2022
@yav yav self-assigned this Sep 27, 2022
@yav
Copy link
Member Author

yav commented Sep 27, 2022

Also we should probably not allow foreign declarations in functors, even if they are top level. This is because it is not clear what should happen to such declarations when the functor is instantiated.

@yav
Copy link
Member Author

yav commented Sep 28, 2022

On further though, allowing foreign declarations in nested non-functor modules is OK, as long as no name clashes (i.e., the foreign declaration should all have a different Ident which is what we use to compute the name of the C function)

yav added a commit that referenced this issue Sep 28, 2022
@yav yav closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FFI Foreign function interface
Projects
None yet
Development

No branches or pull requests

1 participant