Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ada does this -- sort of. In the base language procedures can't return anything, and functions must return something. However, either of the two can execute side effects.

The SPARK subset of Ada enforces purity of functions at compile time.

SPARK also allows partial purity, i.e. you can declare that a procedure has side effects, but only in the sense that it uses the wall clock as an input, or only in the sense that it writes to a global variable. You can specify in some detail exactly which side effects are allowed to happen in a procedure.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: