←back to thread

511 points mootrichard | 6 comments | | HN request time: 0.414s | source | bottom
1. stewbrew ◴[] No.23990645[source]
Separate ruby header files with type information? Seriously? What's the rational behind that? Is it just to make clear that the ruby interpreter doesn't really care about the type information and doesn't use it to improve the code's performance?

With all due respect, but IMHO this is too little and much too late.

replies(2): >>23990674 #>>23990677 #
2. learc83 ◴[] No.23990674[source]
"The benefit of having different files is it doesn't require changing Ruby code to start type checking. You can opt-in type checking safely without changing any part of your workflow."
replies(1): >>23990948 #
3. saghm ◴[] No.23990677[source]
Isn't this similar to how TypeScript allows annotations for JavaScript to live in separate files? My (possibly naive) assumption is that the goal is to make it easier for developers to write type annotations for projects they use without necessarily having to convince the maintainers to add them to the project itself. I've heard of people using TypeScript annotations from https://definitelytyped.org/ for dependencies which don't have their own annotations.
replies(1): >>23990757 #
4. TomMarius ◴[] No.23990757[source]
.d.ts files are mostly compilation output, only if the original source is JavaScript you write the definitions by hand. TypeScript developers normally work with types inside their ordinary .ts (JS+types) module file, not in a separate source file.
5. HideousKojima ◴[] No.23990948[source]
TypeScript allows this while also allowing inline type declarations, without breaking existing JavaScript
replies(1): >>23991029 #
6. hombre_fatal ◴[] No.23991029{3}[source]
But it's not Javascript anymore.

Seems reasonable for someone to want types but not have to raise their own entire TypeRuby language + ecosystem + re-tooling.