-
Notifications
You must be signed in to change notification settings - Fork 257
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
Let target be an argument instead of an option for translate #3231
Let target be an argument instead of an option for translate #3231
Conversation
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.
Wait. Wait. Wait. I thought dafny build was supposed to do what you propose for dafny translate --compile-target . I'd much rather keep each command focussed on its task and not confuse that task with options like this.
I haven't looked at the code, but I don't think making the target mandatory is a good idea. Since Dafny is written in C#, it's natural that, if omitted,
This approach has the benefits that
I don't think removing a command will "remedy this situation" in any sense. I had always considered that "dafny build" produces a hands-off executable or library that I can now independently run. How is that against the intention of Dafny build?
You can definitely add this |
As someone who has done lots of Java in the past and is still concerned that Java integrate well with Dafny, I'll comment the following:
Any large-scale development project today (that uses Dafny at a all) is highly likely to be a mix of Dafny and other code. |
Changes
dafny translate
is intended to let Dafny interoperate with other languages, so it makes sense to let the specific target language be a mandatory argument, instead of an optional option. This PR letstarget
be an argument instead of an option fordafny translate
.dafny build
was intended to mimic the behavior ofdotnet build
, producing either a platform specific executable, like a.exe
for Windows, or a platform independent executable that can be fed todafny [run]
, which executes the program faster than when passing Dafny source files todafny run
, which is similar to producing a.dll
usingdotnet build
and then feeding that.dll
back todotnet
to run it.Right now,
dafny build
instead produces artifacts that can be run using execution platforms other thandafny
, such as usingdotnet
orjava
. This is against the intention ofdafny build
. To remedy this situation, we will also remove thedafny build
for now, until we can implement its behavior so it mimicsdotnet build
.To enable easily producing
.jar
etc., we're adding the--compile-target
convenience option todafny translate
, that tries to further compile the produced target sources, and will produce.dll
and.jar
files when C# or Java are chosen as targets respectively.Testing
Updated tests
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.