Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I managed to build dafny on .NET Core on Fedora, and I can generate a linux executable based on .NET Core, which successfully can verify a .dfy file, but when it tries to compile it to C#, it fails because it uses CodeDOM, which has a .NET Core package which makes compilation of dafny succeed, but fails at runtime because no compatible compiler is found, and it seems that CodeDOM is not available on .NET Core and one should use Roslyn instead, which has a different API. See https://stackoverflow.com/questions/38441249/net-core-dynamic-compilation.
Steps to run it on my Fedora machine:
What prevents us from moving to dotnet is that it seems that no CodeDOM implementation is available for .NET core at runtime. This could probably be fixed by using the Roselyn API instead of the CodeDOM API for compilation of C# programs.
However, at this point it might make sense to ask if the
dafny
program should invoke the C# compiler (and go compiler, Java compiler, etc) at all, because that works for simple toy examples, but for more serious software engineering projects with library dependencies, compiling a set of source files is a complex task for which you have to use a dedicated tool (such as eg the dotnet CLI, nuget, maven, etc). Trying to make dafny as smart as these tools will never work, and it seems to me that dafny trying to compile cs files to assembly violates the "separation of concerns" software engineering principle. So my suggestion here would be to entirely remove the code which invokes the C# compiler (and other language compilers) from dafny, and have the user invokecsc
,dotnet build
,mvn build
or any other such command on their own. And maybe provide a simple shell or bat script for the trivial toy example case, which invokesdafny
and thencsc
and runs the executable.