Opposite of Default Local<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />So, just some syntactical sugar.
It would be really nice if there was an opposite of declaring local variables for functions.
i.e. instead of:
example= function({a,b}, {c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w},
c = a+b;
d = c+a;
//...
x = v+w;
y = x+b;
);
print(x,y);
I could write:
example= function({a,b}, {Default Local, x, y},
c = a+b;
d = c+a;
//...
x = v+w;
y = x+b;
);
print(x,y);
Re: Opposite of Default LocalSame goes with local:x if you'd rather explicitly scope on the fly.
f = function({}, {},
x = "global scope replaced";
local:x = "function scope x";
local:y = "function scope y";
print(::x, local:x, y);
);
f();
You have to remember to call ::x explicitly because of the scoping rules for unscoped variables.

Re: Opposite of Default LocalI've never used here:x before, but that syntax makes total sense. Thanks!
Re: Opposite of Default LocalI've been using explicit locals in functions. I think I'll try Default Local in my next project.
Re: Opposite of Default LocalI think if you scope everything, you may get what you want.. Correct me if I'm not following but....For instance
::x="global scope";
::y="global scope";
Names Default to Here(1);
x="here scope";
y="here scope";
print(::x, here:x, ::y, here:y);
f = function({}, {Default Local},
here:x="here scope replaced";
::x = "global scope replaced";
x = "function scope x";
y = "function scope y";
print(here:x, ::x, x, y);
);
f();
print(x, y); // will be whatever was assigned to these vars in the HERE namespace.
print(::x, ::y); // will be whatever was assigned to these vars in the GLOBAL namespace.
// no way of accessing local vars (actually the point of local).
Re: Opposite of Default LocalAnother example:
x="global scope";
y="global scope";
Names Default to Here(1);
x="here scope";
y="here scope";
print(::x, x, ::y, y);
f = function({}, {Default Local, x},
x="here scope replaced";
y="function scope";
print(x, y);
);
f();
//x != y but it does
print(x, y);