Improvements to Unit Contracts with Minor Risk of Backwards Incompatibility

20 views
Skip to first unread message

Daniel Feltey

unread,
Aug 11, 2015, 4:41:47 PM8/11/15
to d...@racket-lang.org
I have a pending pull request (https://github.com/plt/racket/pull/1004) that improves unit contracts in the following ways:

1. allowing contracts to protect the result of invoking a unit and
2. checking of initialization dependencies (init-depend clauses)

These changes are in preparation for supporting units in Typed Racket to ensure safe interactions between typed and untyped units.

Unfortunately, these changes introduce a minor backwards incompatibility. For example, the following program will now trigger a contract violation while it previously did not.

    (define-signature a^ ())
    (define/contract u
      (unit/c (import a^) (export))
      (unit (import a^) (export) (init-depend a^)))

Because the contract does not list the initialization dependency on a^ whereas the unit value does, it does not satisfy the contract.

No known Racket code (either on pkgs.racket-lang.org  or PLaneT) is broken by these changes, but in the unlikely event that your code is affected, the solution is to add the initialization dependencies of the unit to its contract.


If you have any questions or if some of your code is affected by these changes please let me know.

Thanks
Dan Feltey
Reply all
Reply to author
Forward
0 new messages