释义 |
scala 基本例句 n.斯卡拉 Have fun with that, and let me know if you find work programming in Scala! 愿您从中找到乐趣,如果发现了用 Scala编程的工作,别忘了告诉我! ibm Much more than in Java, the great power of Scala brings great responsibility to focus on whether you're making the intent of your code easier to read. 用 Scala的时候,你得比用 Java投入更多的精力来让别人更容易理解你的意图。能力越强,责任越大,说的就是这个意思。 infoq And, despite what others may say, don't fear just using Scala as a better Java- without- semicolons in the first few days, weeks or months. 而且,不管别人怎么说,在刚开始的日子里,只管大胆的把 Scala当作无分号的 Java用,用上几天、几星期,或是几个月。 infoq Even if they never factor into a new design, Scala code uses lists extensively throughout its libraries. 即使列表从未形成新的设计,但是 Scala代码在其库中广泛使用了列表。 ibm However, there is one tricky step: For our code to run, it also needs code from the standard Scala library. 但是,此外还有一个较复杂的步骤:要让代码运行,还需要来自标准 Scala库中的代码。 ibm I stumbled across Scala and instantly realized it was what I was looking for. 我无意中碰到了 Scala然后立刻认识到它就是我正在寻找的语言。 infoq I think this is a key difference between Fan and Scala. 我想这就是 Fan和 Scala之间最重要的差异。 yeeyan If I have to do bit manipulation of large amounts of binary data, why is it, that Scala's primitive types are immutable? 如果我需要在大量的二进制数据上进行字节操作,这就有问题了, Scala的基本类型是常量化的吗? cnblogs In fact, Scala’s Enumeration class supports the usual methods for working with collections, so we can easily iterate through the breeds with a for loop and filter them by name. 实际上, Scala的枚举类支持和集合协作需要的一般方法,所以我们可以简单地在循环中遍历这些种类,或者通过名字过滤它们。 yeeyan In most cases, though, Scala behaves like many scripting languages in treating the end of the line as the end of a statement or an expression. 然而在大多数情况下, Scala的行为和许多脚本语言一样把一行的结尾看作是声明或者表达式的结尾。 yeeyan Much of the strange magic you're about to see is due to Scala's functional nature, so a little background on the development and evolution of functional languages is probably in order. 您将看到的许多奇怪的、不可思议的东西都可以归功于 Scala的函数特性,因此,简单介绍一下函数语言开发和演变的背景可能非常有用。 ibm Now let's see what Scala has to offer in the way of a better workaround. 现在,让我们来看看 Scala提供什么样内容来实现更好的变通方法。 ibm Now look at the search function. This function uses one of the most powerful features of Scala, its pattern matching. 现在参看搜索函数,这个函数使用一个功能最强大的 Scala特性:模式匹配。 ibm Numerous other functional features such as pattern matching have made their way into the Scala language, but to list them all would be getting ahead of the story again. 大量的其他函数功能比如模式匹配已经被引入到 Scala语言中,但是将其全部列出超出了本文的范围。 ibm Separate compile and run steps aren’t required for simple programs that have few dependencies on libraries outside of what Scala provides. 单独的编译和运行步骤对于简单的,仅有少量独立于 Scala提供的库之外的程序不是必须的。 yeeyan So with Scala, you get a much more expressive language than Java, but it runs on the JVM and runs as fast as Java. 因此, Scala是一种表达能力比 Java强得多的语言,但是它在 JVM上运行,运行速度与 Java一样快。 ibm This is what the Scala compiler does, so there is nothing too tricky about this. 这是 Scala编译器的工作,所以这方面没什么太复杂的事情。 ibm This is a frequent design in Scala code and in most functional languages, in fact and is one you should be comfortable with if you're going to spend any serious amount of time in this environment. 这是 Scala代码以及大多数函数性语言很常用的设计,而且如果您准备认真地研究这个环境的话,这是您应当掌握的内容之一。 ibm This is another nice feature of Scala. 这是 Scala的另一个很好的特性。 ibm We’ll emphasize how the concise syntax of Scala helps you work better and faster. 我们会着重讨论 Scala简明的语法如何帮助你更好更快地工作。 yeeyan When a statement or expression is too long for one line, Scala can usually infer when you are continuing on to the next line, as shown in this example. 当一个声明或者表达式太长,一行不够的时候, Scala通常可以推断你在什么时候要在下一行继续,就像这个例子中一样。 yeeyan When we were learning new Scala features, we chose whether to use them based on whether the intent of the resulting code was more obvious. 在我们学到 Scala新特性的时候,我们会根据代码是不是能够更明确的体现出实现意图来决定用不用。 infoq With Scala’s pattern matching, your cases can include types, wild-cards, sequences, and even deep inspections of an object’s variables. 而有了 Scala的模式匹配,你的 case可以包含类型,通配符,序列,甚至是对象变量的深度检查。 yeeyan Yet again, you see how similar Scala code is to Java code, at least when it comes to inheritance and class relationships. 您又一次看到了 Scala代码与 Java代码有多么的相似,至少涉及继承和类关系时是这样。 ibm Yet, Scala gives you all the benefits of static typing, a modern object model, functional programming, and an advanced type system. 但是, Scala提供了所有静态类型的优势,一个现代的对象模型,函数式编程,和先进的类型系统。 yeeyan You can see from the above example that Scala allows classes to be declared inside one another, or“ nested”. 你可以从上面的例子中看到, Scala允许在一个类中定义另外一个,或者成为“嵌套”。 yeeyan Scala is compelling because it feels like a dynamically typed scripting language, due to its succinct syntax and type inference. Scala引起众人的兴趣是因为它的简洁语法和类型推断,看起来像动态脚本语言。 yeeyan Scala extends the type system of Java with more flexible generics and a number of more advanced typing constructs. Scala扩展了 Java的类型系统,同时提供了更灵活的类型和一些高级的类型结构。 yeeyan Scala lets you define more than one argument list for a method. Scala可以让你为方法定义一个以上的参数列表。 yeeyan Scala takes a similar approach, but it has some advantages. Scala采取相似的方法,但它有许多优点。 ibm |