-
-
Notifications
You must be signed in to change notification settings - Fork 205
PyMathics fixups #996
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
Merged
Merged
PyMathics fixups #996
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
The context of the symbols in the pymathics module should be pymathics
or pymathicsmodulenale` ?Uh oh!
There was an error while loading. Please reload this page.
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.
This is an interesting question for discussion.
A short summary of my thinking right now is
PyMathicsfor now and maybe laterPyMathics<tick>modulelater. But please give me your thoughts.Let me review history.
In v1.0
natlangwas a "buitin" and so its context was I guessSystem. Do I have that right? I get conflicting reports frommathicsscript --full-form:I am guessing that first
Globalis wrong or incompleteNote that right now, we don't break out "System" functions and variables, although they in fact are in different Python modules/files.
So then we split this off. As best as I can tell, dealing with the context might have gotten messed up or had been incomplete. At least, I had a hard time trying get it to the consistentcy it is now.
The choice here was to give all PyMathics modules a
PyMathicscontext rather than add this to System which I think happened in some (all?) cases.And in doing that, part of the problem I ran into was with in
parser.convert.pywhich tries to add the context prefix and seems to get it wrong occasionally as seen above withGlobalThe downside of putting a lot of stuff under a single context is the possibility for name clashes. And that is of course fixed by adding the module name. I guess we could get the name from
pymathics_version_data.name.But in practice, right now there are going to be very few PyMathics modules (that is until Gark writes the definitive guide for writing Mathics builtins).
Probably the only PyMathics modules that are going to exist are the ones we create, which might number as many as 4. There is
NatLangand in the futureGraph. Possibly the Chemical Data should be pulled out too since that feels a bit specialized, like Natural Language Processing.(Note: At some point I'll write a pytest for
LoadModulewhich will basically create the Hello PyMathics module inside the test since that code is so short).So while I think ultimately this is a good thing to do, right now this PR is a bit large.
And there are more things to do just related to this. Renaming
test.pytodoctest.pyand making sure it can be used as a module for testing from PyMathics is an example.So in sum, my opinion is let's just do this step, let it settle and work out the kinks. And then continue doing more ambitious, more correct, other kinds of things.
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.
As I told you before, I think this PR is a great improvement, and I would merge it as it is. What I wanted to point out that the scope of the modules is something to think about it in the future, and I wanted to have your impression of what would be the best way to handle it.
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.
Ok -- thanks. We are in agreement then.
As you say, it is something to do for the future.
Feel free to open issues if that's the way you want to go. For myself, there are so many things that I am aware of that should be addressed, issues in general haven't been that helpful to me as it seems for others.