-
-
Notifications
You must be signed in to change notification settings - Fork 65
removing n_evaluation #559
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
Draft
mmatera
wants to merge
8
commits into
master
Choose a base branch
from
more_removing_n_evaluation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2dd8a5f
removing n_evaluation
mmatera ae889a0
removing assert
mmatera dedf6a7
fixing a typo in scipy_utils/integrators
mmatera 3fdad82
commenting changes in to_python, for future revision.
mmatera 3fc8e2d
Merge branch 'master' into more_removing_n_evaluation
mmatera 6438ce7
Merge branch 'master' into more_removing_n_evaluation
mmatera 382017f
Merge branch 'master' into more_removing_n_evaluation
mmatera dac7a92
isort
mmatera 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
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
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
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.
Line 1386 or thereabouts has an assert that
n_evaluation is None. So this isn't needed.n_evaluation, a relatively new feature, is a hack that should not have been added in the first place.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.
Indeed, this line should be removed. Regarding
n_evaluation, it is a feature that I proposed to add before we have theeval_Nfunction, and I think that was a useful intermediate step. In any case, if we still want thatExpression(SymbolFunction,...).to_python(n_evaluation=evaluation)still produce a callable Python object, we can not remove the parameter completely.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.
BTW, if we want that
to_pythonalways returns a "native" Python object, one possibility for Expressions that do not have a clear Python equivalent would be to return a callable object, likeThen, if at some point the expression becomes evaluable and produces a Python native object, then the result would be a Python object...
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.
I'd like to be very clear about this. In my view this was an intermediary step because there was myopic thinking about the code an a lack of a bigger picture about how interpreters normally work.
The entire operation represented as a class is the kind of thing you find in toy interpreters but not performant interpreters. Performant interpreters do not use class methods to implement built-in operations.
For a list of Python built-in operations see https://docs.python.org/3/library/dis.html#opcode-collections . For a list of GNU Emacs operations see https://github.com/rocky/elisp-bytecode . You can find the same thing for Ruby, Java, Javascript, and so on. It is a necessary prerequisite say if you want to have add JIT technology for example (which we are a very long way from being able to contemplate).
I mention to be aware of this so as not do this as much in the future. There has been a rush to just plunge into into new areas where much is not known either in terms of the existing code or of conventional practice. And that sometimes leads to an equal effort to remove it later.
Remind me why would we want to "support"
Expression(SymbolFunction,...).to_python(n_evaluation=evaluation)?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 a possibility but there would be a different method called. As I have said in the past there was this pervasive vaguess which assists a muddling of concepts.
to_python()is used for different kinds of situations which haven't been clearly specified. And that is why we have weird or hybrid behavior such as returning a string when conversion fails instead of raising an exception. (And letting some other routine convert this to a string then if that is what it needs to do).As I have alluded to before,
to_python_literal()would be a better name for at least one of the disentangled functions.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. That was because I was much less aware than now about how to make a readable PR. This is something that I learn in the hard way during this time...
Yes, I agree with all that. But then, we can take two positions: leave the code as it is, diagram a master plan, then rework all the existing pieces, and then (let's say, in a couple of years) see if we can start improving the functionality.
The other way (the one in which I think I could be useful now) is to fix peripherical parts with (maybe suboptimal) code, and to add tests to reinforce the compatibility with WMA. This is what I was trying to do during the last months.
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.
There has been a rough plan. I was making my way over the rewrite-apply-eval process. I had gotten to the top-level evaluation. That was blocking Formatting and Boxing work you wanted to do. So I stopped that process so that you would have free reign over Form, Boxing, and Format. While you are doing that I am looking to expand the use of ListExpression and customized kinds of expressions. Association is a natural for this as well.
The Boxing and Formatting work quickly spilled into scanning and parsing - rightly or wrongly. I'll handle issues that spill over there.
In the places where we have no choice, okay. But in the areas where I have a clearer idea of what needs to be done, let's wait on that. With respect specifically to Forms, Boxing, and Format, this is a clear area where you know more about this than I can even hope to understand, so focus on that. The plan that you have put together seems good so far. So just continue with that.
As for this PR, let's put back that
assertand remove the more complex code that deprecating something that we now know to be ill-defined.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. The assert was removed, and I left the code for converting
Expression(SymbolFunction, ...)as it was before, except by the name of the parameter (I have removed the "n_"). If a call is done with the "n_evaluation" parameter, a deprecation warning is shown, and then continue almost as it was before, except that instead of using theExpression(SymbolN,...).evaluate(n_evaluation)idiom, aeval_N()call is used.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.
Please no deprecation warning for something that should not have been added.
This PR I thought (and actually the previous one) were supposed to remove uses, not deprecate them. The "assert" checks that. In a little while the assert can be removed as well. Thanks.
In a little while the assert could be removed as well.
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.
I commented out both the assert and the code that shows the deprecation. I am going to leave this as a draft, and eventually use this discussion (and the changes) when we want to go over this method.