KDB视图是否应包含副作用?

huangapple go评论66阅读模式
英文:

Should KDB views contain side effects or not?

问题

在这篇关于视图的文章(https://code.kx.com/q/learn/views/)中明确指出,视图不应包含副作用。

然而,在这篇文章(https://code.kx.com/q/style/sam/)中提到:"SAM 是 q 应用的抽象模型。将 SAM 视为具有内核和外层的模型。SAM 的内核由视图相互连接的变量和常量组成。所有函数以及所有以它们为基础表达的视图都是完全没有副作用的。内核中的所有副作用都明确定位在视图中。"

这两个陈述似乎存在冲突。哪一个是正确的?

英文:

In this article on views (https://code.kx.com/q/learn/views/) it is explicitly stated that views should not contain side effects.

However, in this article (https://code.kx.com/q/style/sam/) it is stated "SAM is an abstract model of q applications. Think of SAM as having an inner core and an outer layer. The inner core of SAM consists of variables and constants interconnected by views. All functions, and all views expressed in terms of them are completely free of side effects. All side effects in the core are explicitly located in views."

These 2 statements seem to conflict. Which is correct?

答案1

得分: 3

相信有关views的文章。

对于混淆表示抱歉。SAM文章是从1995年Stevan Apter撰写的论文“风格备注”改编而来,应该被省略掉,就像窗口部分一样。风格的“备注”最好由社区托管在GitHub.com/qbists,我会考虑将它们移至那里。

更新 2023.02.10 风格备注现已移至GitHub qbists/style,新增了有关分号的新章节。

虽然这些材料的来源已经在GitHub上开放供贡献,但我希望将其托管在Qbists上能吸引更多的内容。例如,关于表格和IPC的良好风格是什么?

请发送评论至librarian@code.kx.com;有关PR的信息,请参见。

英文:

Trust the article on views.

Apologies for the confusion. The SAM article was adapted from a 1995 paper “Remarks on Style” written by Stevan Apter, and should probably have been omitted, as were sections on windowing. The style ‘remarks’ would be better hosted at GitHub.com/qbists and maintained by the community; I’ll see about moving them there.

Update 2023.02.10 Remarks on Style now moved to GitHub qbists/style, with a new section on trailing semicolons.

While the source for this material has long been on GitHub and open for contribution, I’m hoping hosting it in Qbists will attract more content. For example, what is good style with tables? With IPC?

Comments to librarian@code.kx.com; PRs to

huangapple
  • 本文由 发表于 2023年2月8日 13:52:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75381822.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定