Skip to content

Allow a proc with one in-out (!) parameter to be called as a function producing the new argument value #517

@pschachte

Description

@pschachte

This is the dual of the feature that allows a function to be called as a statement with one argument provided in in-out (!) mode, eg, !x + 1 to increment x. This is to support the principle I call irrelevance insensitivity, which says that unimportant decisions should not have important consequences. So deciding that a proc modifies an argument rather than producing a new value, or vice-versa, should not be important. This request asks that a decision to modify an argument should easily be changed to instead produce a new value.

So if p is declared to have mode p(!x:int, y:int), we'd like to be able to use p(a, b) as an expression whose value is what would be the final value of a if we called p(!a, b), but a is left unchanged. Ie, it should be equivalent to t where {?t=a ; p(!t, b)}. This would only work in cases where there is a single in-out argument, and all the others are inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions