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

Rename module Math->MathLib, name conflicts with Java/C# Math class #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markrtuttle
Copy link

@markrtuttle markrtuttle commented Oct 4, 2023

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

This renames the Math module to MathLib to avoid conflict with the Math class in Java and C#. Prior to this change, the examples in JSON will verify but not compile to Java or C# (error messages about missing symbols indicate the compiler is looking in the standard Math library and not the Dafny Math module).

This does not update the corresponding files under examples. Should it?

This resolves #145

@markrtuttle markrtuttle marked this pull request as ready for review October 4, 2023 22:03
Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting this issue and the proposed fix. I'm not yet sure I want to merge it, though, because it will be a breaking change for anyone using the module, and more importantly hides the underlying issue: code compiled from Dafny should not be dumped into the top-level namespace, where these kinds of conflicts could easily occur for other names in the future as well.

I'd also like to get to the bottom of why the CI didn't catch #145 before we resolve it.

Fortunately we're already working on supporting configuring the parent namespace for compiled code: dafny-lang/dafny#4322. We should definitely use that feature when building library code like this to avoid these problems in general.

The old Math module conflicts with the Java and C# module.  This
change moved the Math module out of the top-level namespace.
@markrtuttle
Copy link
Author

@robin-aws I've pushed an update that merely moves Math into Dafny.Math.

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

Successfully merging this pull request may close these issues.

JSON regression test fails
2 participants