//unsafe code propagation rule rule: (X: function, Y: function) case X call Y { warning Y tag unsafe -> X tag unsafe message "safe function should not call unsafe code" } //unsafe code propagation rule rule: (X: function, Y: function) case X call Y { warning Y tag bug(no(No)) -> X tag bug(no(No)) message "Function should declare bugs it aware of" } testfunc3 = function: (a: num, b: num)->num , unsafe, bug(no(1273)) //function tags list { x = a+b: num; y = a - b: num; (x + y) / 2; } testfunc2 = function: (a: num)->bool // because of testfunc3 marked as unsafe code, // testfunc2 should be marked so too { b = testfunc3(a+1, a-1): num; (b==0); } testfunc4 = function: ()->bool { a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] : [num]; b = [1, 3, 2]: [num]; (a[1]==b[2]); } /* find6 = function: bool { x = [1, 2, 3, 4, 5, 6, 7]: [num]; //эффективная инициализация y = map (x) [el]-> {2 * el}; y = loop map (x->el: num ): [num] { 2 * el; } exists(y, 12); } exists = function: (list:[a], el: a)->bool { acc: bool; acc = reduce(list, false) [el, acc] -> { acc = acc & (el == e): saturated(true); } } */