揭穿 Scala 神话 [英] Debunking Scala myths

查看:46
本文介绍了揭穿 Scala 神话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对 Scala 语言最常见的误解是什么,这些误解有哪些反例?

What are the most commonly held misconceptions about the Scala language, and what counter-examples exist to these?

更新

我更多地考虑了我见过的各种说法,例如Scala 是动态类型的"和Scala 是一种脚本语言".

I was thinking more about various claims I've seen, such as "Scala is dynamically typed" and "Scala is a scripting language".

我承认Scala 是[简单/复杂]"可能被认为是一个神话,但这也是一个非常依赖于上下文的观点.我个人认为,正是 非常相同的特性可以使 Scala 显得简单或复杂,这取决于谁在使用它们.最终,语言只是提供抽象,而正是这些抽象的使用方式塑造了感知.

I accept that "Scala is [Simple/Complex]" might be considered a myth, but it's also a viewpoint that's very dependent on context. My personal belief is that it's the very same features that can make Scala appear either simple or complex depending oh who's using them. Ultimately, the language just offers abstractions, and it's the way that these are used that shapes perceptions.

不仅如此,它还有一定的煽动争论的倾向,而且我还没有看到有人改变对这个话题的坚定观点......

Not only that, but it has a certain tendency to inflame arguments, and I've not yet seen anyone change a strongly-held viewpoint on the topic...

推荐答案

神话:Scala 支持运算符重载.

Myth: Scala supports operator overloading.

实际上,Scala 只是有非常灵活的方法命名规则和方法调用的中缀语法,当中缀语法与operators"一起使用时,还有用于确定方法优先级的特殊规则.与真正的运算符重载(a la C++)相比,这种微妙的区别对于该语言功能的实用性和滥用的可能性具有重要意义,正如 James Iry 对 这个问题.

Actually, Scala just has very flexible method naming rules and infix syntax for method invocation, with special rules for determining method precedence when the infix syntax is used with 'operators'. This subtle distinction has critical implications for the utility and potential for abuse of this language feature compared to true operator overloading (a la C++), as explained more thoroughly in James Iry's answer to this question.

这篇关于揭穿 Scala 神话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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