input.xreate
No OneTemporary

File Metadata

Created
Sat, Mar 14, 3:50 AM

input.xreate

//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"
}
testfunc3 = function: (a: num, b: num)->num , unsafe //function tags list
{
x = a+b: num;
y = a - b: num;
(x + y) / 2;
}
testfunc2 = function: (a: num)->bool, unsafe // because of testfunc3 marked as unsafe code,
// testfunc2 should be marked so too
{
b = testfunc3(a+1, a-1): num;
(b==0);
}
/*cl
find6 = function: bool
{
x = [1, 2, 3, 4, 5, 6, 7]: [num]; //эффективная инициализация
y = map (x) [el]-> {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);
}
}
*/

Event Timeline