Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Our Dev Chat Diary #8

Open
atlas-comstock opened this issue May 23, 2020 · 0 comments
Open

Our Dev Chat Diary #8

atlas-comstock opened this issue May 23, 2020 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@atlas-comstock
Copy link
Member

于是设计点要考虑:

  1. 是不是干脆所有显示要 .(int) 来表明Enum包里所有函数调用后的结果

或者:
我们特地对每个函数的返回类型来做判断,

比如: Enum.Sum([]int{12.,.3 } 我们对sum,就肯定是 参数的类型,非数组
Enum.All([]int{...}, func) 结果肯定是 func的类型,bool这个没问题
Enum.Recuce 也是func的类型
Enum.find([]int{...}, 43) 结果就是 第一个参数的类型。
诸如此类

.(int) 之类的assert是必要的,因为会有 Enum.Sum([]int{1,2,3,4} 或者 Enum.Sum([]float{1.1,2.2,3.3} 这样子的Enum函数,

然后你想想,对于这些函数,是不是我们完全没办法知道里面的类型,除非特地去Sum进行判断。

所以我明确的要求调用方要: Enum.Sum([]int{1,2,3,4}) . (int) 来告诉我,这个函数调用是想得到什么样的结果,不然我完全没办法知道结果是什么

@atlas-comstock atlas-comstock added the documentation Improvements or additions to documentation label May 23, 2020
@z2z23n0 z2z23n0 mentioned this issue Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant