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

Allow a HO type to specify that the value will be called at least once or exactly once #389

Open
pschachte opened this issue May 10, 2023 · 0 comments
Labels
enhancement New feature or request research project

Comments

@pschachte
Copy link
Owner

pschachte commented May 10, 2023

...and then permit procedure calls with outputs to be passed as such a HO value using the pass by reference technology added as part of the TCMC project. Since it is declared to definitely be called, the mode checker can be assured that the outputs will definitely be assigned by the higher order call. That will extend what can be done in library procs. For example, if the call1 modifier signifies that a HO value will definitely be called exactly once, we could define:

def trust(tst:{call1,test}()) {
    tst | error("Trusted procedure failed")
}

Then one could write a statement like:

    trust ?h = head(lst)

to bind h to the head of lst, throwing an error if lst is empty. This would be a nice answer to issue #368.

@pschachte pschachte added enhancement New feature or request research project labels May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research project
Projects
None yet
Development

No branches or pull requests

1 participant