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

The description of usage of Builtin and Predefined class in <Evaluation of an Expression> is incorrect? #9

Open
CallmeNezha opened this issue May 4, 2021 · 3 comments

Comments

@CallmeNezha
Copy link

Hi, I am new to mathics. When reading the document of how to extend mathics, I found the description of usage of Builtin and Predefined maybe incorrect.
In chapter of evaluation.rst, it says

Functions which take no parameters are generally subclassed off of the Builtin class.
However when a function takes parameters it method’s Object class is derived either directly indirectly from the Predefined class rather than the Builtin. To figure out which apply method in the class object to call, each method’s document string (or docstring) is consulted. The lookup process is kicked off using the evaluate() method found in the Predefined class.

And when I contiue to read the document of Hello, World! – using Predefined and Introducing the Builtin Class also with the source code of Builtin and Predefined class, I found the description above is quite opposite.

https://github.com/Mathics3/mathics-development-guide/blob/6b5e3c92089eeed69528ba005afe04e5a4ae94d0/docs/extending/developing-code/code-overview/evaluation.rst

@rocky
Copy link
Member

rocky commented May 4, 2021

I might have gotten this wrong. Suggest how you think this should be worded.

@mmatera
Copy link
Contributor

mmatera commented May 4, 2021

@CallmeNezha, you are right: Predefineds are Builtins that represent the behaviour and rules or Symbols like True or Pi. So, Predefined objects does not have leaves. Also, there are Expressions which to not take parameters like ``MemoryInUse[]```. Those are represented by Builtins. So, the right sentence would be something like

"Functions which take no parameters are generally subclassed off of the Builtin class, while Symbols are subclassed off of the Predefined class. "

Over the weekend I will try to rewrite this section.

@rocky
Copy link
Member

rocky commented May 9, 2021

@CallmeNezha In branch https://github.com/Mathics3/mathics-development-guide/tree/builtin-vs-predefined I made a pass at addressing the concerns you raise. As I work on the system, I understand more about it. So in that respect I am no different than anyone else, including yourself.

If you can, please look that over to see if this now helps and matches your expectation. @mmatera has the most experience with all of this, so we'll just wait for him to look over before I commit this to the master branch and update the readthedocs material online.

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

No branches or pull requests

3 participants