且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

这些导入后为什么需要分号?

更新时间:2023-09-18 11:33:16

当scala编译器遇到Macintosh行结尾 - \ r 时 - scala编译器将错误地声明需要分号,因为Moritz如此推断。 Scala参考手册的第1.2节描述了正确的换行符。我在参考文献中找不到哪些字符文字被视为换行符。根据经验,Windows( \\\\ n )和Unix( \ n )都可以接受。据推测,scala在这方面与Java严格兼容。

When the scala compiler encounters a Macintosh line ending--being \r--the scala compiler will erroneously declare the need for a semi-colon, as Moritz so deduced. Section 1.2 of the Scala Reference Manual describe correct newline characters. I could not find in the Reference which character literals were considered as newlines. From experience, both Windows (\r\n) and Unix (\n) are acceptable. Presumably scala is strictly compatible with Java in this regard.