3 ms·
[Ruby] Type annotations
- dkarapetyan 12y agoType annotations are great but how exactly do they fit in? For example, in TypeScript the type annotations actually provide live feedback as you're typing the code. The TypeScript compiler, tsc, will also flag instances where the types don't make sense or it can't infer the type for a function argument which is valuable for the programmer because it means there is some kind of gap in how the data flows from one function to the next. If the type annotations are just going to be for documentation purposes then there is almost no value in making it available. If on the other hand they will be more closely tied with the interpreter during source-to-bytecode compile time to provide feedback then that will be much more valuable but that's actually a lot of work. It's probably also helpful to look at Typed Racket for how they address the type annotation problem.
- DAddYE 12y agoyep, errors will we raised at runtime, so I think it's not possible out of the box to save and get an error. However, most of our tests cover type checks and the documentation as well, so 2 less problem to handle. Then someone could come up with a "tool" that will extend your ide to detect errors "live". That's should be "just" the first step.