|Sorbet - Making Ruby Statically Typed|
|Written by Nikos Vaggalis|
|Wednesday, 04 July 2018|
But let's start with the basics; what's so wrong with dynamically typed systems that statically type ones, full or partial, are so desirable.
What it mostly comes down to is that declaring types leads to fewer runtime errors, but then again that's trading productivity for safety; try to parse an XML file in Java instead of in Perl. You see where this is going, but the truth is that the trend is moving towards mixed or gradual type systems, such as those endorsed by Perl 6, or statically typed systems with type inference, such as those of Haskell.
Sorbet is actually split into two type checker counterparts, dynamic and static. In taking inspiration from RDL, another lightweight system for adding types, type checking and contracts to Ruby, it adopts a hybrid approach, enforcing type checking at runtime with type annotations being represented as a DSL, and statically checking the code and method signatures.
Its difference from Typescript is that in Sorbet there is no compilation phase or transpill and, since Stripe's codebase is huge, Sorbet's type system should had been made compatible with existing code and libraries to allow for gradual adaptation.
Other properties outlined by Dmitry Petrashko, the developer at Stripe who is involved in the core project, are:
At the moment, Sorbet is being used internally at Stripe, with developers optionally joining in, but the long term plans are to open source it. Much is not yet still known, but for the time being the core devs have prepared an online playground to get a feel of what's in stock.
Visit https://sorbet.run/ for more.
or email your comment to: email@example.com
|Last Updated ( Wednesday, 04 July 2018 )|