具有相同签名和相同行为但名称不同的两个函数的技术术语是什么?
What is the technical term for two functions with the same signature and same behavior, but different names?
当我们说程序的一个方面可以完全独立于另一个方面改变时,我们说那些东西正交到彼此。
我正在寻找几乎 相反的 术语。例如,在 C++ 中,如果复制赋值运算符具有与复制构造函数相同的调用签名,并且它们具有相同的效果(或者足够接近而不在意),这是一个好主意。因此,人们可能会说或写:"it is good class design in C++ to make the copy-constructor and assignment operator _______ to each other."
[编辑] 我要询问与以下语句相关的计算机语言概念:"these two functions have separate identities but similar roles, and therefore should have the same argument types, the same return types (if possible), and same (or highly similar) side-effects or behavior."
这个问题不是关于C++的,也不是关于面向对象的。
我在这里寻找更通用的计算机科学或数学概念。
你是说这样的两个函数吗?
f: T -> R
g: T -> R
对于 T 中的所有 x,f(x) == g(x)
并接受同样的副作用(在数学中没有函数的副作用)
g 和 f 只是等价函数。
当我们说程序的一个方面可以完全独立于另一个方面改变时,我们说那些东西正交到彼此。
我正在寻找几乎 相反的 术语。例如,在 C++ 中,如果复制赋值运算符具有与复制构造函数相同的调用签名,并且它们具有相同的效果(或者足够接近而不在意),这是一个好主意。因此,人们可能会说或写:"it is good class design in C++ to make the copy-constructor and assignment operator _______ to each other."
[编辑] 我要询问与以下语句相关的计算机语言概念:"these two functions have separate identities but similar roles, and therefore should have the same argument types, the same return types (if possible), and same (or highly similar) side-effects or behavior."
这个问题不是关于C++的,也不是关于面向对象的。 我在这里寻找更通用的计算机科学或数学概念。
你是说这样的两个函数吗?
f: T -> R g: T -> R
对于 T 中的所有 x,f(x) == g(x)
并接受同样的副作用(在数学中没有函数的副作用)
g 和 f 只是等价函数。