Quick poll. Do you depend on the laziness of `memo...
# spek
r
Quick poll. Do you depend on the laziness of
memoized
on your tests? https://github.com/spekframework/spek/pull/660 came up to eagerly evaluate
memoized
during the execution phase instead of evaluating on access. Options: 👌, 🚫 and 🙃 if you didn’t know that
memoized
is lazy.
🙃 4
🚫 3
g
I think that memoized should be lazy by default, argument to disable lazyness may be useful but not sure about this
n
i declare them in order anyways.. so as long as they get executed in order of declaration i should be fine
r
@gildor what are the benefits though?
@Nikky yes, that’s roughly the plan. This:
Copy code
val foo by memoized { Foo() }
val bar by memoized { Bar() }

it("do something") { 
  assertEquals(foo.something(), bar.something())
}
is equivalent to (in terms of execution):
Copy code
val foo = Foo()
val bar = Bar()
assertEquals(foo.something(), bar.something())
👍 1