DevHeads.net

RDL 2.2.0 release

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:

<a href="https://www.cs.tufts.edu/~jfoster/papers/pldi19.pdf" title="https://www.cs.tufts.edu/~jfoster/papers/pldi19.pdf">https://www.cs.tufts.edu/~jfoster/papers/pldi19.pdf</a>

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
<a href="https://sorbet.org" title="https://sorbet.org">https://sorbet.org</a>

### 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: <a href="https://github.com/tupl-tufts/rdl" title="https://github.com/tupl-tufts/rdl">https://github.com/tupl-tufts/rdl</a> <-- note new location
* gem: <a href="https://rubygems.org/gems/rdl" title="https://rubygems.org/gems/rdl">https://rubygems.org/gems/rdl</a>
* install: gem install rdl
* forum: <a href="https://groups.google.com/d/forum/rdl-users" title="https://groups.google.com/d/forum/rdl-users">https://groups.google.com/d/forum/rdl-users</a>

### 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:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>