Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 397
    • Issues 397
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Wiki
  • Propsals ideas
  • Safe functions Calls

Safe functions Calls · Changes

Page history
Add reference to Stephen Dolan subtyping phd for infering pragma safe. It... authored Apr 09, 2025 by Quinten Cabo's avatar Quinten Cabo
Add reference to Stephen Dolan subtyping phd for infering pragma safe. It seems relevant but I have not read it fully yet.
Hide whitespace changes
Inline Side-by-side
propsals-ideas/Safe-functions-Calls.md
View page @ 91559596
...@@ -557,7 +557,9 @@ int foo(int b) | isprime(b) {return b;} ...@@ -557,7 +557,9 @@ int foo(int b) | isprime(b) {return b;}
Here the prechecks performed on `a` contain all the checks that foo performs on b. Here the prechecks performed on `a` contain all the checks that foo performs on b.
As long as `a` is not reassigned here then we know that the predicates `a>2` and `isprime` hold for `a`at the call to foo. Thus, foo could be inferred as safe. As long as `a` is not reassigned here then we know that the predicates `a>2` and `isprime` hold for `a`at the call to foo. Thus, foo could be inferred as safe.
This requires binding the predicate expressions to the variable assignments. > Read https://www.cs.tufts.edu/comp/150FP/archive/stephen-dolan/thesis.pdf ?
This might require binding the predicate expressions to the variable assignments.
If the compiler supports this it should be able to infer `#pragma safe`. If the compiler supports this it should be able to infer `#pragma safe`.
With the example above, the compiler could look up the checks that foo does on its input and then look up the set of predicates of the argument given. For instance a function called `pred` that takes a function name and the name of an input and returns the set of predicates which hold for that input variable. I think it's a good idea to replace the binding of input variable itself with a Greek letter so that you can easily compare sets of predicates. I chose $I$ iota for this to refer to identity. With the example above, the compiler could look up the checks that foo does on its input and then look up the set of predicates of the argument given. For instance a function called `pred` that takes a function name and the name of an input and returns the set of predicates which hold for that input variable. I think it's a good idea to replace the binding of input variable itself with a Greek letter so that you can easily compare sets of predicates. I chose $I$ iota for this to refer to identity.
......
Clone repository
  • concepts
    • Deprecated Modules
    • Globals
    • Intermediate Code Macros
    • Named Tuples
    • Overloading
    • Preprocessor
    • Primitive functions
    • Runetime Representations
    • input stdin
    • phm xt
    • ref counting methods
    • type famlies
    • type patterns
  • error messages
    • Anthropomorphic error essages
    • Colored error messages
View All Pages