[ANN] RDL 2.2.0 release
Jeff Foster <[email protected]> Sun, 9 Jun 2019 20:37:20 -0400
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
I'm pleased to announce version 2.2.0 of RDL, a lightweight system for
adding types and contracts to Ruby.
NEW: This version of RDL includes support for "type-level
computations" (comp types), which help more precisely type arrays,
hashes, and Rails database queries. Comp types are described more
fully in our recent paper:
https://www.cs.tufts.edu/~jfoster/papers/pldi19.pdf
Note: RDL is a research project from Tufts University and the University
of Maryland, College Park. If you are looking for an industrial
strength Ruby type system, check out Stripe's Sorbet system at
https://sorbet.org
### RDL Basics
RDL does *type checking*, meaning it can "statically" check that a
method body matches its type, as a way of potentially detecting errors
early in development. For example:
```ruby
file.rb:
require 'rdl'
extend RDL::Annotate
type '(Integer) -> Integer', typecheck: :now
def id(x)
"forty-two"
end
```
```
$ ruby file.rb
$ ruby file.rb
.../lib/rdl/typecheck.rb:158:in `error': (RDL::Typecheck::StaticTypeError)
.../file.rb:6:3: error: got type `String' where return type `Integer' expected
.../file.rb:6: "forty-two"
.../file.rb:6: ^~~~~~~~~~~
```
See README.md for a much longer discussion. A full list of changes are
below. Comments, questions, suggestions, and complaints are all
welcome! Email me or post on the forum.
Jeff
### Coordinates
* code/docs: https://github.com/tupl-tufts/rdl <-- note new location
* gem: https://rubygems.org/gems/rdl
* install: gem install rdl
* forum: https://groups.google.com/d/forum/rdl-users
### License
BSD 3-Clause
### Fixed
- Dynamic type checking of initialize method
- Bug with handling constants of certain types
- Broken rdl_attr_* methods
- Bug handling optional annotated/dependent types
- Add RDLAnnotate to rdl_disable
- Type checking of Object class singleton methods
- #52 Kernel.raise annotation
- #42 use grandparent type information for methods
- #43 allow fully qualified calls
- #45 handle local constants
- #62 allow more method names in structural types
- #34 clean up discussion of how type checking works in README
- Reordered list of RDL.* methods in README
- Remove (most) ordering dependencies among test cases
- Undefined identified issue for Rails assocation types
- Type check expressions within casts
- Fix to `var_type` method when called from outside class
- Add `RDL.query` support for nested classes, e.g., `RDL.query "ActiveRecord::Base#id`
### Added
- Support for type-level computations, including new annotations with
type-level computations for Array, Hash, String, Integer, Float, and
database query libraries
- Dynamic type
- `RDL.reset` method
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>