Typed Racket
Go to file
Andrew Kent 4bfb101677 use bits for base unions, make unions deterministic
This PR primarily changes how we represent Base types and unions of
Base types. Basically, Base types now contain a bits field, which
contains an exact-nonnegative-integer? with exactly one bit set to
1. This allows us to represent unions of Base types by simply OR-ing
together the various base bits. We store these unions in a new type
called a BaseUnion (which contains a field for numeric Base type bits
and a field for non-numeric Base type bits). We can perform set
operations on BaseUnion types rather quickly (using simple bitwise
arithmetic operations).

To make Union and BaseUnion work together nicely, the Union type now
has a field for non-Base types, and a field which contains any and all
Base types placed directly in the Union ( either as a Base if there is
only one, or as a BaseUnion if there are more than one).

Other changes present in this PR:

Base types are now "closed" -- i.e. Base types are only declared in
base-types.rkt and numeric-base-types.rkt with a special macro that
assigns them their respective bits. The constructor make-Base is no
longer provided for miscellaneous usages.

Some singleton Value types were moved to Base so all of our common
unions of basic types can fit into the new BaseUnion type (namely
Null, Void, One, Zero, and the booleans).

A new Val-able match expander lets us match on singleton types that
used to all be Value types, but, as described above, now some are Base
types.

Unions contain deterministically ordered, duplicate free lists (in
addition to sets for equality and constant time membership checks), so
iterating over Unions can be done deterministically (yay!) -- this
gets rid of some otherwise problematic behavior in areas like type
inference, where the order Unions are iterated over can actually
affect the results (i.e. if two valid type inferences are possible,
nondeterministic ordering means we can sometimes get one and sometimes
get another, which makes for particularly difficult to debug issues
and in general has no immediate solution (both substitutions are
valid, after all!))
2017-01-05 20:45:17 -05:00
source-syntax Remove extra directories. 2014-12-02 00:53:36 -05:00
typed-racket Add syntax for poly structs in require/typed 2016-07-21 12:00:08 -04:00
typed-racket-compatibility Add syntax for poly structs in require/typed 2016-07-21 12:00:08 -04:00
typed-racket-doc Add typed/images/compile-time.rkt (#476) 2017-01-04 17:02:42 -05:00
typed-racket-lib use bits for base unions, make unions deterministic 2017-01-05 20:45:17 -05:00
typed-racket-more Add typed/images/compile-time.rkt (#476) 2017-01-04 17:02:42 -05:00
typed-racket-test use bits for base unions, make unions deterministic 2017-01-05 20:45:17 -05:00
.gitignore Add standard .gitignore file. 2014-12-06 17:46:25 -05:00
.travis.yml Revise Travis tests for 43a8cce3f. 2015-12-29 17:58:00 -05:00
issue_template.md Create issue_template.md 2016-02-17 14:51:06 -05:00
README.md Fix Travis image URL in the README 2015-02-25 15:17:13 -05:00

Typed Racket

Build Status

Typed Racket is Racket's gradually-typed sister language which lets you add statically-checked type annotations to your programs. For more information, see the Typed Racket Guide.

Installation

Typed Racket is bundled in the default Racket distribution, which you can download from Racket's download page.

You can also manually install it from the main package catalog with the following command:

raco pkg install typed-racket

Documentation

The documentation is also bundled in your local copy of Typed Racket.


Copyright (c) 2010-2015 PLT Design Inc.

This package is distributed under the GNU Lesser General Public License (LGPL). This means that you can link this package into proprietary applications, provided you follow the rules stated in the LGPL. You can also modify this package; if you distribute a modified version, you must distribute it under the terms of the LGPL, which in particular means that you must release the source code for the modified software. See http://www.gnu.org/copyleft/lesser.html for more information.