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

Dafny compiler plugin to mangle extern arguments #45

Closed
robin-aws opened this issue Nov 3, 2022 · 2 comments
Closed

Dafny compiler plugin to mangle extern arguments #45

robin-aws opened this issue Nov 3, 2022 · 2 comments

Comments

@robin-aws
Copy link
Contributor

Follow-up from dafny-lang/dafny#2952, where we collectively decided it didn't make sense for Dafny itself to do this, but it was a reasonable external customization.

The Smithy-to-Dafny code generation will create extern declarations like the following:

module {:extern "Dafny.Aws.EncryptionSdk.Core"} Aws.Crypto {
  // ...
}

The issue is that this assumes a single extern declaration will work for every target language, but Dafny doesn't really guarantee that, and in practice {:extern} needs to be customized per target language. In particular, Go modules can't have periods in them.

It is reasonable, instead, for a polymorph user to provide a compiler plugin that will replace "Dafny.Aws.EncryptionSdk.Core" with "Dafny_mAws_mEncryptionSdk_mCore" when compiling the Dafny to Go, for example. There's a good chance more of the functionality of polymorph could find it's way into such a plugin in the future as well.

@texastony
Copy link
Contributor

texastony commented Nov 7, 2022

Interesting.
I have brought up this issue internally before.
I was going to suggest using regular expressions so we could convert all the extern references,
Polymorph generated or otherwise,
as is done in an internal project.

robin-aws pushed a commit that referenced this issue Apr 19, 2024
These are the changes to the ESDK
to integrate with the MPL
@robin-aws
Copy link
Contributor Author

#528 is the better way to go here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants