刪除命名空間時不會刪除新的自定義功能test_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;刪除名稱空間不會刪除它的相關自定義函數,如上所示。
我發現刪除自定義功能的唯一方法是使用功能“刪除自定義功能”。
有沒有辦法刪除命名空間並刪除所有與之關聯的自定義函數?
回复:刪除命名空間時不會刪除新的自定義功能我認為沒有內置的方法可以刪除名稱空間及其所有關聯的自定義函數。但是,您可以使用類似以下用戶定義的函數的方法:
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));
);
我將研究更好的方法來管理將來的JMP版本。