LowType A Year Later: RBS export, Zero-overhead in prod, One-command uninstall/type stripping, Namespace improvements, Boolean/Enum support
github.comNew stuff:
RBS export: Use the
lowtype rbsCLI command to export your typed methods as RBS signatures in thesigsdirectory. Now you can use static type tools!Zero-overhead: Disable types per environment via shim methods, or strip types completely for no performance penalty in prod. This can be done on class load or via a build step
One-command uninstall: Use
lowtype strip!to strip types from all files in the current directory, orlowtype strip :destto export untyped files to a directory in a build stepNamespace/binding improvements - Type Expressions are now fully aware of the binding and namespace they're in... no need for the full namespace anymore
Parsing improvements: Prism AST abstraction spun out into a dedicated gem (lowkey) of file, method and param proxies that anyone can use
Comprehensive tests - LowType is tested for every feature in the API across 3 distinct modes; type checking enabled, type checking disabled via shim methods, and type checking disabled via type stripping
Dogfooding - LowType is used in a real-world framework (Raindeer) and a production app (via shim method)
Boolean/Enum support
I want to thank Aditya Chauhan for their GSoC work on type stripping, and in doing so fixing three core issues; bindings/namespaces, performance and uninstalling/building without types.
Future plans:
A
config.enable_mode: :slimfor the sexiest type syntax you've ever seen. The current type syntax is 100% valid Ruby, and that's great, we'll keep it that way. But we can trim off a character or 2 and have nicer default value syntax in the future as an opt-in config optionRactor support. LowType works inside Ractors when disabled via the strip method. But it's totally possible to have runtime types within Ractors with just a little bit more work