是否有办法界定一条灯塔,允许采取以下形式?
variable identifier identifier variable
例如:
1 equals to 2
我知道如何建立更简单的表格:1 等于(2)
,但我想避免括号。 是否有办法这样做?
是否有办法界定一条灯塔,允许采取以下形式?
variable identifier identifier variable
例如:
1 equals to 2
我知道如何建立更简单的表格:1 等于(2)
,但我想避免括号。 是否有办法这样做?
你们可以请教区:
$ scala -Xprint:parser
Welcome to Scala version 2.9.2 ... blah
scala> variable1 identifier1 identifier2 variable2
// lots of stuff and inside:
val res0 = variable1.identifier1(identifier2).variable2
// this is how the parser sees it.
// if you can make that work (dynamic classes…?), you’re good to go.
然而,存在一个问题: 只有在<代码> 可变2<>代码/代码”时才使用识别符号(因此可以用作方法名称)。 页: 1
scala> 1 equals to 2
市长们已经失败:
<console>:1: error: ; expected but integer literal found.
1 equals to 2
^
父母确实是你唯一的途径(*):
scala> 1 equals to (2)
// ...
val res1 = 1.equals(to(2))
页: 1 a 采用背书的标识
scala> 1 equals to `2`
// ...
val res2 = 1.equals(to).2
......
就我所知,现在不可能像你想要的那样加以执行(我很高兴被证明是错误的)。 我也面临这一问题,当时我正在创建我的小型投放器。 但我已经认识到,即使你在2个识别器之间有2个变量,你仍可以有3个识别器。 它希望:
variable1 method constant method variable2
这与:
variable1.method(constant).method(variable2)
有了这一点,我就能够带着非常 n的DSL提出这样的建议:
by default defaultDb and identified by remote
remote is by default defaultDb
你们可以找到更多例子,说明它是如何利用的。
https://github.com/OlegIlyenko/scaldi/blob/48f777e4186cf744eb1116087003d745f4516ef16e0ac0g6/crc/sc/
这里可以发现:
https://github.com/OlegIlyenko/scaldi/blob/master/src/main/scala/scaldi/Injectable.scala”rel=“nofollow”>https://github.com/OlegIlyenko/scaldi/blob/master/src/main/scala/scaldi/Injectable.scala
我将<代码>ByWord和-IdentisedWord
类别作为方法论。 例如:
def is(by: ByWord) = and(by)
如果有这种可能性,图书馆的用户将延长<条码>By World的班级,并通常提供自己的<条码>By World。 我现在想到这一点,我认为这并不是很.。 更好的解决办法是,为时常话制造ton子,然后使用其类型:
object by
def is(byWord: by.type) = and(by)
这通常将论点限制在只有一种可能的<代码>by 字句上。
如果最后一种是非正常操作者,你可以拥有两个连续的识别资料:
a identifier1 - d
页: 1
a.identifier1(d.unary_-)
注:非正常职能只能是!
如果你不想把你最后的可变名称作为扼杀物处理(例如,你有办法日后从地图或中检索其价值),那么你可以有以下动态:
import scala.Dynamic
import scala.language.dynamics
class I2
class Res(i: I2) extends Dynamic {
def selectDynamic(obj: String): Unit = {
println(obj)
}
}
class V1 { def i1(i2: I2): Res= new Res(i2) }
val v1 = new V1
val i2 = new I2
v1 i1 i2 v2
可见“五2”。
I have 4 elements:List[List[Object]] (Objects are different in each element) that I want to zip so that I can have a List[List[obj1],List[obj2],List[obj3],List[obj4]] I tried to zip them and I ...
I m impressed with Twitter and investigating to use Scala for a new large scale web project with Hibernate and Wicket. What do you think about Scala, and should I use it instead of Java? EDIT: And, ...
I m going to work on comparing around 300 binary files using Scala, bytes-by-bytes, 4MB each. However, judging from what I ve already done, processing 15 files at the same time using java....
The scala type Nothing represents (as I understand it) the bottom of the type hierarchy, also denoted by the symbol ⊥. That is, Nothing is a sub-type of any given type. The requirement for a Nothing ...
When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...
Is it possible to include a jar file run running the Scala interpreter? My code is working when I compile from scalac: scalac script.scala -classpath *.jar But I would like to be able to include a ...
I am trying to use Scala s capabilty of running a class with either JUnit or ScalaTest. I took the example given for FeatureSpec and combined it with the example using JUnitSuite. I am having a ...
There are various answers on Stack Overflow which explain the conditions under which tail recursion is possible in Scala. I understand the limitations and how and where I can take advantage of tail ...