-
Notifications
You must be signed in to change notification settings - Fork 265
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
feat: Add an :options attribute on modules #2073
Conversation
I like this functionality! As you had described to me off-line, this proposal does:
Since this lets us support options that affect syntax (like
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bravo!
Just adding my support for this feature as well - I had thought you were proposing some additional file-level Any chance |
This would also useful from within the IDE, so the more generic the attribute name, the better I would think. |
Yes, but the options themselves are CLI options (the arguments to that attribute are passed directly into the command line parser). So maybe cliOptions is in fact a good name? Although I don't like the lowercase |
This is great :-) Also an extra reason to remove references to
Doesn't this PR change that? After this PR they are both CLI and module options. In the future they'll also be in the project file. I don't see what makes them more tied to the CLI than to the project or to a module. |
@keyboardDrummer you got a point here ! But perhaps @cpitclaudel was concerned about the syntax, because this option attribute uses a syntax that is command-line. |
I don't think we need to do that urgently, because the only option this accepts for now applies to parsing ( |
Done in Parser.cs |
I don't have a strong opinion on the name of the attribute; but re:
I would say the syntax does: the choice here was to not invent a new syntax for options, so I used exactly the parser's options. In the future we might decide that it's cleaner to have a non-cli option syntax. But in that case we can give it a different name, like |
This is a draft to start a discussion on how we want to specify per-file options in Dafny.
The problem
Different files within a single Dafny project may need different settings:
/functionSyntax
,/allowGlobals
)/NLArith
,/arith
)/trackPrintEffects
)We have discussed introducing a DafnyProject file, but this is not sufficient, because individual files or even individual modules may need custom settings.
Proposal
Introduce syntax within Dafny file to set options temporarily. This PR does this by adding an
:options
attribute that supports a subset of Dafny's command line options. For now, I've added the general infrastructure + support for/functionSyntax
(which would allow us to migrate the libraries to the new function syntax (ghost function
) without breaking customers, since they could compile their code using the old syntax while using libraries with the new syntax).(Of course, in the case of
functionSyntax
, it would be relatively easy to build an automated porting tool)The code needs small changes in Boogie (https://github.com/boogie-org/boogie/tree/cpitclaudel_cli-error-reporter), so this branch won't compile as is.