4 ms·
> most of the things in Crystal are lazy: if you don't invoke a method there are no type checks to be done for it Does this mean that if a library doesn't have
by tatterdemalion 11y ago
> most of the things in Crystal are lazy: if you don't invoke a method there are no type checks to be done for it
Does this mean that if a library doesn't have complete test coverage compile-time errors could be discovered only by clients?
- asterite 11y agoAlmost. You at least need to exercise the code at compile time. For example you could write dummy usage tests like this: typeof(MyClass.new.some_method(1, 2, 3)) That basically says "the above compiles and has some type", so you don't have to test what that method really does, just that it compiles. I don't think it's a big problem, though. In Ruby it's the same: unless you exercise your code you don't know if it works. Now, think of a classically compiled language like C and C++: if it compiles, does it mean that it works? I doubt you'd release your code without at least a few tests (or a small test-app) to try it.