Source.getLines中的默认参数出错(Scala 2.8.0 RC1)
发布时间:2020-12-16 09:52:12 所属栏目:安全 来源:网络整理
导读:假设我运行 Scala 2.8.0 RC1,下面的scala代码应该打印出文件“c:/hello.txt”的内容 for ( line-Source.fromPath( "c:/hello.txt" ).getLines ) println( line ) 但是,当我运行它时,我收到以下错误 console:10: error: missing arguments for method getLin
假设我运行
Scala 2.8.0 RC1,下面的scala代码应该打印出文件“c:/hello.txt”的内容
for ( line<-Source.fromPath( "c:/hello.txt" ).getLines ) println( line ) 但是,当我运行它时,我收到以下错误 <console>:10: error: missing arguments for method getLines in class Source; follow this method with `_' if you want to treat it as a partially applied function Error occured in an application involving default arguments. val it = Source.fromPath("c:/hello.scala").getLines 根据我的理解,Scala应该使用默认参数“compat.Platform.EOL”作为“getLines”.我想知道我是否做错了或者它是scala 2.8中的错误 谢谢 解决方法
编写getLines(),以便使用默认值.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |