-
Notifications
You must be signed in to change notification settings - Fork 40
Soften 'functions are second-class' statement in language tour #1159
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
base: master
Are you sure you want to change the base?
Conversation
|
|
|
||
| Functions are second-class in Effekt, but for a good reason. Functions closing over capabilities must not be returned, otherwise it can not be guaranteed that these capabilities are still in scope. | ||
| Thus, we have to keep track of these captures and ensure they are in scope upon invoking. | ||
| [Computations](/tour/computation), such as functions and objects, are second-class _by default_ in Effekt, but for a good reason. |
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.
Does the "but for a good reason" add anything? 🤔
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 think it is fine, since it leads over to the next sentence.
Note that #1172 added back the explicit syntax. |
| [Computations](/tour/computation), such as functions and objects, are second-class _by default_ in Effekt, but for a good reason. | ||
| Since computations can capture capabilities, they can only be used where those capabilities remain in scope. | ||
| For statically preventing capabilities from escaping their valid scope, Effekt tracks captured capabilities on the type level and verifies they're still in scope upon usage. | ||
| We call this mechanism _boxing_ and will discuss in greater details in the next [section](/tour/captures#boxing). |
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 bit misleading IMO. I would rather say something like
| We call this mechanism _boxing_ and will discuss in greater details in the next [section](/tour/captures#boxing). | |
| Functions and capabilities can still be treated as first-class values by means of _boxing_, which we discuss in greater details in the next [section](/tour/captures#boxing). |
Feel free to also add other grievances you have with the language tour. Then we can just bundle them all in one PR.