You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dafny files in the src/dafny directory define modules as Dafny.* (e.g. Dafny.FileIO). But because the Dafny runtime also uses Dafny as a top-level namespace, compiling these Dafny files into Golang results in Go module name collisions (when the Go code compiled from Dafny, is passed to the Go compiler):
$ dafny build --target:go src/dafny/FileIO/FileIO.dfy
src/dafny/FileIO/FileIO-go/src/System_/System_.go:7:3: found packages Dafny (dafny.go) and dafny (dafnyFromDafny.go) in /<snip>/src/dafny/FileIO/FileIO-go/src/dafny
src/dafny/FileIO/FileIO-go/src/FileIO.go:10:3: found packages Dafny (dafny.go) and dafny (dafnyFromDafny.go) in /<snip>/src/dafny/FileIO/FileIO-go/src/Dafny
The text was updated successfully, but these errors were encountered:
Instead of unifying the Dafny code in this repo under the Dafny namespace/module, we might want to use a name like Dafny.Lib or similar. In the same vein, we might also consider changing the Dafny runtime to use a namespace like Dafny.Runtime or similar (though perhaps the Dafny runtime is the most "deserving" of the unqualified Dafny namespace... but then again doing so would probably prevent similar issues down the line.)
Also, even though unifying library code under a single namespace is a good idea, and we'll want to keep the documentation that's been added in the src/dafny tree, we should be wary of having a second copy of the code without mechanisms to ensure it stays in sync and is maintained to our quality standards.
Good remarks.
In a test branch, I'm also using a copy of the C# runtime in DafnyCore itself but in C#, namespaces don't conflict as in Go. Moreover, we use the namespace Microsoft.Dafny whereas the runtime can be accessed using global::Dafny.
Could this issue just be fixed in Go so that every other language does not have to deal with two different namespaces?
Dafny files in the
src/dafny
directory define modules asDafny.*
(e.g.Dafny.FileIO
). But because the Dafny runtime also usesDafny
as a top-level namespace, compiling these Dafny files into Golang results in Go module name collisions (when the Go code compiled from Dafny, is passed to the Go compiler):The text was updated successfully, but these errors were encountered: