unsafe-and-native.txt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. The 'native' / 'unsafe' system consists of:
  2. - 'native' modules declared at crate level and statically imported from C/C++/whatever
  3. - 'native' functions -- any function declared in a native module
  4. - 'native' types, recursively built from:
  5. the mach types u8, s32, ...
  6. native functions and modules
  7. ptr[t] for native type t
  8. rec(...) where all the fields are native types
  9. - 'unsafe' functions are those that:
  10. - call native methods
  11. - call *un-authorized* unsafe methods
  12. - load or store through ptr[t] values
  13. - create ptr[t] values from ^t or ~t slots
  14. - directly spawn unsafe progs
  15. - 'unsafe' progs are those that call unsafe functions
  16. - 'unsafe' procs are those formed via 'spawn' of unsafe progs
  17. - 'spawn native' that turns an unsafe prog into a safe proc by
  18. *putting it in an OS subprocess*
  19. - the ability to add 'auth' stanzas to crate files:
  20. use std;
  21. auth std.foo; // consider 'unsafe' parts of std.foo 'safe'
  22. use auth std; // short for above