New Custom Function is not deleted when namespace is deletedtest_ns = New Namespace("Test");
add custom functions({
new custom function("Test", "test_function",
function({},
print("hello world!!");
Return(1);
);
);
});
test_ns << Delete Namespace();
custom_functions = get custom functions();
custom_functions = custom_functions[Loc(custom_functions << get namespace, "Test")];
custom_functions << get name;Deleting a namespace will not delete it's associated custom functions as shown above.
The only way I have found to remove the custom function is to use the function "Remove Custom Functions."
Is there a way to delete a namespace and remove all of it's associated custom functions?
Re: New Custom Function is not deleted when namespace is deletedI don't believe there is a builtin way to remove a namespace and all of its associated custom functions. However, you could use something like the following user-defined function:
Delete Namespace and Matching Custom Functions = Function({ns}, {i, mask, fs},
fs = Get Custom Functions();
mask = Loc(fs << Get Namespace, ns << Get Name);
If(N Items(mask),
fs = fs[mask];
For(i = 1, i <= N Items(fs), i++,
fs[i] = ((ns << Get Name) || ":" || (fs[i] << Get Name));
);
Remove Custom Functions(fs);
);
ns << Delete Namespace(Force(1));
);
I'll look into better ways to manage this for future versions of JMP.