Scala slow builds: development approaches to avoid

后端 未结 2 892
忘了有多久
忘了有多久 2021-02-07 12:50

First of all, incremental builds via SBT are pretty awesome, generally in the < 1sec range. However, sometimes you have to do a full clean/compile, or, in the case of increme

2条回答
  •  旧巷少年郎
    2021-02-07 13:13

    I've noticed that type members can force rebuilds in places you would not expect. For example:

    foo.scala:

    object foo {
        class A {
            type F = Float
        }
        def z: Int = 8
    }
    

    bar.scala:

    object bar {
        def run { println(foo.z) }
    }
    

    Changing the value of z does not force bar to be recompiled. Changing the type of F does, even though bar never refers to F or even to A. Why, I have no idea (Scala 2.9.1).

提交回复
热议问题