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

feat: minor improvements for purity info #728

Merged
merged 4 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package safeds.lang
* call. `$this` is replaced by the receiver of the call. `$param` is replaced by the value of the parameter called
* `param`. Otherwise, the string is used as-is.
*/
@Experimental
@Target([AnnotationTarget.Function])
annotation PythonCall(
callSpecification: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package safeds.lang

/**
* Indicates that the function has no side effects and always returns the same results given the same arguments.
* **If called on a function:** Indicates that the function has no side effects and always returns the same results
* given the same arguments.
*
* Calls to such a function may be eliminated, if the result is not used. Moreover, the function can be memoized, i.e.
* Calls to such a function may be eliminated, if its results are not used. Moreover, the function can be memoized, i.e.
* we can remember its results for a set of arguments. Finally, a pure function can be called at any time, allowing
* reordering of calls or parallelization.
*
* **If called on a parameter:** Indicates that the parameter only accepts pure callables.
*/
@Experimental
@Target([AnnotationTarget.Function])
@Target([AnnotationTarget.Function, AnnotationTarget.Parameter])
annotation Pure

/**
Expand Down Expand Up @@ -55,6 +58,13 @@ enum ImpurityReason {
*/
FileWriteToParameterizedPath(parameterName: String)

/**
* The function calls another, potentially impure function that gets passed as a parameter.
*
* @param parameterName The name of the parameter that accepts the function.
*/
PotentiallyImpureParameterCall(parameterName: String)

/**
* The function is impure for some other reason. If possible, use a more specific reason.
*/
Expand Down