[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] closing a function



would it be possible to close functions
automatically when they can be closed?

is this check correct?:

(
x = { arg func;
	func.def.context.sourceCode.postln;
	func.def.context.varNames.isNil
};
)


// false
(
var a = 4;
f = { a + 5 };
x.value(f)
)

// true
(
f = { var a = 4; a + 5 };
x.value(f)
)


// true
(
f = { a + 5 };
x.value(f)
)

// false
(
{ var b=9;
	var a = 4;
	f = { a + 5 + b };
}.value;

x.value(f)
)
--








.