3 ms·
A fascinating part about Sorbet is it did not have to introduce any additional syntax to Ruby (unlike TypeScript, for example). This really speaks to the expres
by simplify 7y ago
A fascinating part about Sorbet is it did not have to introduce any additional syntax to Ruby (unlike TypeScript, for example). This really speaks to the expressiveness of Ruby. Very cool.
- est31 7y agoWas that additional syntax in TypeScript actually neccessary for type inferrence? Or is it rather to avoid API hazards when you change some internal code and suddenly the API of your library breaks because the inferred type has changed.
- idle_zealot 7y agoYou can use TypeScript in a mode that only uses type inference and doesn't require type annotations or definitions. It works surprisingly well.
- matt_kantor 7y agoAdditionally, TypeScript will parse JSDoc comments into type annotations: https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#jsdoc-types-are-used-for-type-information https://www.typescriptlang.org/docs/handbook/type-checking-j...
- loxs 7y agoIt is necessary because of some limitations, but IMO it's also a great idea nonetheless. Types' names are a great documentation, one which you can't get with pure inference. Even languages that have (close to) the best possible inference, like OCaml, still have additional syntax for defining types, because it 1. gives you documentation and 2. allows you to do things that are mathematically proven to be impossible via inference. TS is great, and also moving really fast and becoming better every 2-3 months.
- SomeOldThrow 7y agoThe type signatures are pretty noisy to read, though, some syntax can definitely help. Maybe with Ruby 3?