在哪里可以找到 Scala 类型推断的详细信息? [英] Where to find the details of Scala's type inference?

查看:35
本文介绍了在哪里可以找到 Scala 类型推断的详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解类型检查/算法的工作原理.这很复杂,而且有很多情况.是否有任何好的教程/文档(我知道语言规范,但 IMO,太难阅读了).

I want to understand how type checking/algorithm works. It's very complicated and there're a lot of cases. Is there any good tutorial/documentation for this (I am aware of language specification but IMO, it's too hard to read).

我只想了解 Scala 的类型推断是如何在幕后工作的细节.

I simply want the details of how Scala's type inference works under the hood.

推荐答案

其实并不复杂.可以在 Odersky/Spoon/Venners 的书Scala 编程"(第 1 版;在第二版中我认为是第 16.10 节)的第 16.9 节中找到非常简洁的描述:

It's actually not very complicated. A very concise description can be found in section 16.9 of Odersky/Spoon/Venners's book 'Programming in Scala' (1st edition; in the second edition I belief it is section 16.10):

http://www.artima.com/pins1ed/working-with-lists.html#16.9

所以如果这太基础了,也许下面的论文对你有帮助:

So if this is too basic, maybe the following paper helps you:

  • Vincent Cremet、François Garillot、Sergueï Lenglet 和 Martin Odersky,Scala 类型检查的核心微积分",在:计算机科学讲义,2006 年,第 4162/2006 卷,1-23,DOI:10.1007/11821069斯普林格).

您可以通过 Google 学术搜索找到可访问的 PDF 版本.

或者你可能想在 https://github.com/scala/scala/blob/2.12.x/​​src/compiler/scala/tools/nsc/typechecker/Infer.scala.

这篇关于在哪里可以找到 Scala 类型推断的详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆