Re: [racket-dev] [plt] Push #28930: master branch updated
--- OLD/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt +++ NEW/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/static-contracts/combinators/derived.rkt @@ -6,7 +6,7 @@ (require simple.rkt structural.rkt (for-template racket/base racket/list racket/set racket/promise racket/mpair - racket/class)) + racket/class racket/async-channel)) (provide (all-defined-out)) (define identifier?/sc (flat/sc #'identifier?)) @@ -28,6 +28,7 @@ (define empty-hash/sc (and/sc hash?/sc (flat/sc #'(λ (h) (zero? (hash-count h)) (define channel?/sc (flat/sc #'channel?)) +(define async-channel?/sc (flat/sc #'channel?)) Should this be #'async-channel? Yes, you are right. I'll fix it. Thanks. (define thread-cell?/sc (flat/sc #'thread-cell?)) (define prompt-tag?/sc (flat/sc #'continuation-prompt-tag?)) (define continuation-mark-key?/sc (flat/sc #'continuation-mark-key?)) pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt ~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt +++ NEW/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt @@ -54,6 +54,7 @@ (define -Param make-Param) (define -box make-Box) (define -channel make-Channel) +(define -async-channel make-Async-Channel) (define -thread-cell make-ThreadCell) (define -Promise make-Promise) (define -set make-Set) @@ -169,6 +170,7 @@ (define -HT make-Hashtable) (define/decl -BoxTop (make-BoxTop)) (define/decl -ChannelTop (make-ChannelTop)) +(define/decl -Async-ChannelTop (make-Async-ChannelTop)) (define/decl -HashTop (make-HashtableTop)) (define/decl -VectorTop (make-VectorTop)) (define/decl -MPairTop (make-MPairTop)) pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt ~~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt +++ NEW/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt @@ -424,6 +424,7 @@ [(StructTop: (Struct: nm _ _ _ _ _)) `(Struct ,(syntax-e nm))] [(BoxTop:) 'BoxTop] [(ChannelTop:) 'ChannelTop] +[(Async-ChannelTop:) 'Async-ChannelTop] [(ThreadCellTop:) 'ThreadCellTop] [(VectorTop:) 'VectorTop] [(HashtableTop:) 'HashTableTop] @@ -462,6 +463,7 @@ [(Box: e) `(Boxof ,(t-s e))] [(Future: e) `(Futureof ,(t-s e))] [(Channel: e) `(Channelof ,(t-s e))] +[(Async-Channel: e) `(Async-Channelof ,(t-s e))] [(ThreadCell: e) `(ThreadCellof ,(t-s e))] [(Promise: e) `(Promise ,(t-s e))] [(Ephemeron: e) `(Ephemeronof ,(t-s e))] pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/structural.rkt ~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/structural.rkt +++ NEW/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/structural.rkt @@ -32,6 +32,7 @@ (define-for-syntax structural-reps #'([BoxTop ()] [ChannelTop ()] + [Async-ChannelTop ()] [ClassTop ()] [Continuation-Mark-KeyTop ()] [Error ()] @@ -62,6 +63,7 @@ [Continuation-Mark-Keyof (#:inv)] [Box (#:inv)] [Channel (#:inv)] + [Async-Channel (#:inv)] [ThreadCell (#:inv)] [Vector (#:inv)] [Hashtable (#:inv #:inv)] pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/subtype.rkt ~~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/subtype.rkt +++ NEW/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/subtype.rkt @@ -510,6 +510,7 @@ ;; compared against t* here (subtype* A0 s t*)] [((Channel: t) (Evt: t*)) (subtype* A0 t t*)] + [((Async-Channel: t) (Evt: t*)) (subtype* A0 t t*)] ;; Invariant types [((Box: s) (Box: t)) (type-equiv? A0 s t)] [((Box: _) (BoxTop:)) A0] @@ -517,6 +518,8 @@ [((ThreadCell: _) (ThreadCellTop:)) A0] [((Channel: s) (Channel: t)) (type-equiv? A0 s t)] [((Channel: _) (ChannelTop:)) A0] + [((Async-Channel: s) (Async-Channel: t)) (type-equiv? A0 s t)] + [((Async-Channel: _) (Async-ChannelTop:)) A0] [((Vector: s) (Vector: t)) (type-equiv? A0 s t)] [((Vector: _) (VectorTop:)) A0] [((HeterogeneousVector: _) (VectorTop:)) A0] pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/async-channel.rkt ~~~ --- /dev/null +++ NEW/pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/async-channel.rkt @@ -0,0 +1,16 @@ +#lang s-exp
Re: [racket-dev] [plt] Push #28930: master branch updated
On Tue, Jun 24, 2014 at 3:17 PM, stch...@racket-lang.org wrote: stchang has updated `master' from 49ff6d3c84 to 500745f41b. http://git.racket-lang.org/plt/49ff6d3c84..500745f41b =[ One Commit ]= Directory summary: 7.5% pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/ 4.6% pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/ 6.6% pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/ 7.6% pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/private/ 7.5% pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/ 5.0% pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/ 60.8% pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/ ~~ 500745f Stephen Chang stch...@racket-lang.org 2014-06-24 18:16 : | add typed/racket/async-channel : A pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/async-channel.rkt A pkgs/typed-racket-pkgs/typed-racket-more/typed/racket/private/async-channel-wrapped.rkt A pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/async-channel-contract.rkt C pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/{events.rkt = events-with-async-channel.rkt} (86%) C pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/{threads-and-channels.rkt = threads-and-async-channels.rkt} (50%) M .../scribblings/reference/libraries.scrbl | 1 + M .../static-contracts/combinators/derived.rkt| 3 ++- M .../typed-racket/base-env/base-types.rkt| 2 ++ M .../typed-racket/infer/infer-unit.rkt | 3 +++ M .../typed-racket-lib/typed-racket/rep/type-rep.rkt | 6 ++ M .../typed-racket-lib/typed-racket/types/abbrev.rkt | 2 ++ M .../typed-racket-lib/typed-racket/types/printer.rkt | 2 ++ M .../typed-racket-lib/typed-racket/types/subtype.rkt | 3 +++ M .../typed-racket/private/type-contract.rkt | 1 + M .../typed-racket/scribblings/reference/types.scrbl | 18 +- M .../typed-racket/succeed/make-top-predicate.rkt | 1 + M .../typed-racket/types/structural.rkt | 2 ++ =[ Overall Diff ]=== pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl ~~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl +++ NEW/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/libraries.scrbl @@ -71,6 +71,7 @@ The following libraries are included with Typed Racket in the @defmodule/incl[typed/openssl/md5] @defmodule/incl[typed/openssl/sha1] @defmodule/incl[typed/pict] +@defmodule/incl[typed/racket/async-channel] @defmodule/incl[typed/rackunit] @defmodule/incl[typed/srfi/14] @defmodule/incl[typed/syntax/stx] pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl ~~ --- OLD/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl +++ NEW/pkgs/typed-racket-pkgs/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl @@ -4,7 +4,8 @@ numeric-tower-pict.rkt scribble/eval racket/sandbox) - (require (for-label (only-meta-in 0 [except-in typed/racket for])))] + (require (for-label (only-meta-in 0 [except-in typed/racket for]) + racket/async-channel))] @(define the-eval (make-base-eval)) @(the-eval '(require (except-in typed/racket #%top-interaction #%module-begin))) @@ -412,6 +413,21 @@ corresponding to @racket[trest], where @racket[bound] @ex[(lambda: ([x : Any]) (if (channel? x) x (error not a channel!)))] } +@defform[(Async-Channelof t)]{An @rtech{asynchronous channel} on which only @racket[t]s can be sent. +@ex[ +(require typed/racket/async-channel) +(ann (make-async-channel) (Async-Channelof Symbol)) +] +} + +@defidform[Async-ChannelTop]{is the type of an @rtech{asynchronous channel} with unknown + message type and is the supertype of all asynchronous channel types. This type typically + appears in programs via the combination of occurrence typing and + @racket[async-channel?]. +@ex[(require typed/racket/async-channel) +(lambda: ([x : Any]) (if (async-channel? x) x (error not an async-channel!)))] +} + @defform*[[(Parameterof t) (Parameterof s t)]]{A @rtech{parameter} of @racket[t]. If two type arguments are supplied, the first is the type the parameter accepts, and the second is the type returned.