-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add explanation of the scope of the variables for minimal MeTTa #738
Conversation
|
||
When variable is passed as an argument to the function call and matched by a | ||
value then the value is assigned to the variable. If variable passed as an | ||
actual argument is matched by a formal argument variable then it is referenced |
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 feel like the terms "formal argument" and "actual argument" need to be defined. The example helps but I found this part a little bit confusing.
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.
It is a quite common terminology (for example see Wikipedia article). Is using word "argument" for the passed arguments and word "parameter" for the function input variables clears the thing? For example:
When a variable is passed as an argument to a function call and matched by a
value used in a function definition then the value is assigned to the variable.
If variable passed as an argument is matched by a function's parameter variable
then parameter variable references the variable passed as an argument. In this
case the variable passed as an argument can receive a value outsides of its
scope.
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.
Ah ok. Thanks. I had never encountered that phrasing before.
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.
Well it is not only terminology and I started using it intentionally to make readers clearly see that both sides are arguments but different kinds of arguments. Because to me words "parameter" and "argument" are ambiguous. I am not sure if it is easy to read this. If it is hard and there is more familiar words then I would use them.
Co-authored-by: luketpeterson <[email protected]>
Luke thank you very much for the edits! |
No description provided.