Stripe, a company specializing in developing online payment platforms, the source code of the project , which has prepared a static type checking system for the Ruby language. The code is written in C++ and under the Apache 2.0 license.
Type information in the code can be computed dynamically, as well as specified in the form of simple , which can be indicated in the code using the sig method (for example, "sig {params(x: Integer).returns(String)}") or placed in separate files with an rbi extension. to perform both initial without its execution, and checking as the code runs ( by adding "require 'sorbet-runtime'" to the code).
There is an option for of projects to use Sorbet — the code can contain both annotated typed blocks and untyped sections that are not covered by checks. Notable features also include very high performance and the ability to scale for codebases containing millions of lines of code.
The project includes a core for static type checking,
a toolkit for creating new projects using Sorbet, a toolkit for gradual migration of existing projects to use Sorbet, runtime with a domain-specific language for writing type annotations, and predefined type definitions for various Ruby gems.
Initially, Sorbet was developed for checking Stripe's internal projects, most of which are written in Ruby, and was open-sourced after a year and a half of development and deployment. Before the code was opened, beta testing was conducted with the participation of over 30 companies. At its current stage, Sorbet supports running most standard Ruby projects, though there may be occasional incompatibilities.
Source: opennet.ru
