加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

功能 – 如何理解句子“或它评估到底部”?

发布时间:2020-12-16 09:53:58 所属栏目:安全 来源:网络整理
导读:我在“ scala中的函数式编程”一书中看到了这些句子: If the evaluation of an expression runs forever or throws an error instead of returning a definite value,we say that the expression does not terminate,or that it evaluates to bottom. A fun
我在“ scala中的函数式编程”一书中看到了这些句子:

If the evaluation of an expression runs forever or throws an error
instead of returning a definite value,we say that the expression does
not terminate,or that it evaluates to bottom. A function f is strict if
the expression f(x) evaluates to bottom for all x that evaluate to
bottom.

抱歉我的英语不好,我发现自己无法理解这句话:

or that it evaluates to bottom

我无法理解的两个部分:

>“它评估到底部”是相同的“表达式不终止”,还是相反?
>“底部”在这里意味着什么?

谢谢

解决方法

“评估到底部”是一种表达方式不能正常返回的方法:它抛出异常,陷入循环或停止程序.使用短语的原因是因为有时候假装所有表达式都计算为值是很方便的.一旦假装非返回表达式产生一个名为bottom的值,您就可以简化表达式交互方式的描述.

底部类型(在Scala中称为Nothing)是相关的:它是只能产生底值的表达式类型(即不能正常终止).在Scala中,表达式“throw new RuntimeException()”具有底部类型(Nothing),在这个术语中我们会说它产生底部值.

“底部”一词的这些用法最初来自形式逻辑,然后通过形式语言语义进入编程.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读