From 91fea80cb658f002acd7123fc1ac0816c450b258 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Fri, 24 Jun 2011 13:30:59 -0400 Subject: [PATCH] Documented new types and minor corrections. original commit: e4bb1ba7d980e429f45037b4a26860b302394cd1 --- collects/typed-scheme/base-env/base-env.rkt | 79 +++++++++---------- collects/typed-scheme/base-env/base-types.rkt | 1 + .../scribblings/reference/types.scrbl | 34 +++++++- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/collects/typed-scheme/base-env/base-env.rkt b/collects/typed-scheme/base-env/base-env.rkt index 1b957afd..dcb2338d 100644 --- a/collects/typed-scheme/base-env/base-env.rkt +++ b/collects/typed-scheme/base-env/base-env.rkt @@ -644,7 +644,7 @@ [string->number (->opt -String [N] (Un (-val #f) N))] [floating-point-bytes->real (->opt -Bytes [Univ -Nat -Nat] -Flonum)] -[real->floating-point-bytes (->opt -Real (Un (-val 4) (-val 8)) [Univ -Bytes -Nat] -Bytes)] +[real->floating-point-bytes (->opt -Real (one-of/c 4 8) [Univ -Bytes -Nat] -Bytes)] [system-big-endian? (-> B)] [order-of-magnitude (-> -PosReal -Int)] @@ -1054,8 +1054,7 @@ (-values (list -Bytes -Nat - (Un (-val 'complete) (-val 'continues) (-val 'aborts) (-val 'error))))) - + (one-of/c 'complete 'continues 'aborts 'error)))) (->opt -Bytes-Converter -Bytes -Nat @@ -1066,7 +1065,7 @@ (-values (list -Nat -Nat - (Un (-val 'complete) (-val 'continues) (-val 'aborts) (-val 'error))))))] + (one-of/c 'complete 'continues 'aborts 'error)))))] [bytes-convert-end (cl->* @@ -1076,14 +1075,14 @@ (-opt -Nat)] (-values (list -Bytes - (Un (-val 'complete) (-val 'continues))))) + (one-of/c 'complete 'continues)))) (->opt -Bytes-Converter -Bytes [-Nat (-opt -Nat)] (-values (list -Nat - (Un (-val 'complete) (-val 'continues))))))] + (one-of/c 'complete 'continues)))))] [bytes-converter? (make-pred-ty -Bytes-Converter)] @@ -1603,8 +1602,8 @@ [subprocess-kill (-> -Subprocess Univ -Void)] [subprocess-pid (-> -Subprocess -Nat)] [subprocess? (make-pred-ty -Subprocess)] -[current-subprocess-custodian-mode (-Param (Un (-val #f) (-val 'kill) (-val 'interrupt)) - (Un (-val #f) (-val 'kill) (-val 'interrupt)))] +[current-subprocess-custodian-mode (-Param (one-of/c #f 'kill 'interrupt) + (one-of/c #f 'kill 'interrupt))] [subprocess-group-enabled (-Param Univ B)] [shell-execute (-> (-opt -String) -String -String -Pathlike Sym (-val #f))] @@ -1619,7 +1618,7 @@ [process (-> -String (-values (list -Input-Port -Output-Port -Nat -Input-Port (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) @@ -1631,7 +1630,7 @@ (->* (list -Pathlike) (Un -Path -String -Bytes) (-values (list -Input-Port -Output-Port -Nat -Input-Port (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) @@ -1639,17 +1638,17 @@ (-> -Pathlike (-val 'exact) -String (-values (list -Input-Port -Output-Port -Nat -Input-Port (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) (-> (-val 'kill) -Void))))))] [process/ports - (-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -String + (-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (one-of/c #f 'stdout)) -String (-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port) (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) @@ -1657,19 +1656,19 @@ [process*/ports (cl->* - (->* (list (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -Pathlike) + (->* (list (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (one-of/c #f 'stdout)) -Pathlike) (Un -Path -String -Bytes) (-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port) (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) (-> (-val 'kill) -Void))))) - (-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -Pathlike (-val 'exact) -String + (-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (one-of/c #f 'stdout)) -Pathlike (-val 'exact) -String (-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port) (cl->* - (-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error))) + (-> (-val 'status) (one-of/c 'running 'done-ok 'done-error)) (-> (-val 'exit-code) (-opt -Byte)) (-> (-val 'wait) ManyUniv) (-> (-val 'interrupt) -Void) @@ -1821,8 +1820,8 @@ [dynamic-require (let ((mod (Un -Module-Path -Resolved-Module-Path -Module-Path-Index))) (-poly (a) - (cl->* (-> mod (Un (-val #f) (-val 0) -Void) -Void) - (-> mod (Un (-val #f) (-val 0) -Void) (-> a) (Un -Void a)) + (cl->* (-> mod (Un (one-of/c #f 0) -Void) -Void) + (-> mod (Un (one-of/c #f 0) -Void) (-> a) (Un -Void a)) (->opt mod Sym [(-> Univ)] ManyUniv))))] @@ -1834,7 +1833,9 @@ (->opt mod Sym [(-> Univ)] ManyUniv))))] [module->language-info - (->opt (Un -Module-Path -Path -Resolved-Module-Path) [Univ] (-opt (make-HeterogenousVector (list -Module-Path -Symbol Univ))))] + (->opt (Un -Module-Path -Path -Resolved-Module-Path) + [Univ] + (-opt (make-HeterogenousVector (list -Module-Path -Symbol Univ))))] [module->imports (-> -Compiled-Module-Expression @@ -1845,27 +1846,21 @@ (-values (list (-lst (-pair (-opt -Integer) - (-lst (-pair -Symbol - (-pair - (-lst - (Un -Module-Path-Index - (-pair -Module-Path-Index - (-pair (-opt -Integer) - (-pair -Symbol - (-pair (-opt -Integer) - (-val null))))))) - (-val null)))))) + (-lst (-lst* -Symbol + (-lst + (Un -Module-Path-Index + (-lst* -Module-Path-Index + (-opt -Integer) + -Symbol + (-opt -Integer)))))))) (-lst (-pair (-opt -Integer) - (-lst (-pair -Symbol - (-pair - (-lst - (Un -Module-Path-Index - (-pair -Module-Path-Index - (-pair (-opt -Integer) - (-pair -Symbol - (-pair (-opt -Integer) - (-val null))))))) - (-val null)))))))))] + (-lst (-lst* -Symbol + (-lst + (Un -Module-Path-Index + (-lst* -Module-Path-Index + (-opt -Integer) + -Symbol + (-opt -Integer)))))))))))] @@ -1885,7 +1880,7 @@ [make-security-guard (->opt -Security-Guard (-> Sym (-opt -Path) (-lst Sym) ManyUniv) - (-> Sym (-opt -String) (-opt -PosInt) (Un (-val 'server) (-val 'client) ManyUniv)) + (-> Sym (-opt -String) (-opt -PosInt) (Un (one-of/c 'server 'client) ManyUniv)) [(-opt (-> Sym -Path -Path ManyUniv))] -Security-Guard)] [current-security-guard (-Param -Security-Guard -Security-Guard)] @@ -2024,7 +2019,7 @@ ;Section 4.3 (Structure Type Properties) [make-struct-type-property (->opt Sym - [(Un (-val #f) (-val 'can-impersonate) (-> Univ (-lst Univ))) + [(Un (one-of/c #f 'can-impersonate) (-> Univ (-lst Univ))) (-lst (-pair -Struct-Type-Property (-> Univ Univ)))] (-values (list -Struct-Type-Property (-> Univ B) (-> Univ Univ))))] diff --git a/collects/typed-scheme/base-env/base-types.rkt b/collects/typed-scheme/base-env/base-types.rkt index 90ba84a8..f271be34 100644 --- a/collects/typed-scheme/base-env/base-types.rkt +++ b/collects/typed-scheme/base-env/base-types.rkt @@ -109,6 +109,7 @@ [Struct-Type-Property -Struct-Type-Property] [Pretty-Print-Style-Table -Pretty-Print-Style-Table] [UDP-Socket -UDP-Socket] +[TCP-Listener -TCP-Listener] [Custodian -Custodian] [Parameterization -Parameterization] [Inspector -Inspector] diff --git a/collects/typed-scheme/scribblings/reference/types.scrbl b/collects/typed-scheme/scribblings/reference/types.scrbl index 06fdb4fd..13843f33 100644 --- a/collects/typed-scheme/scribblings/reference/types.scrbl +++ b/collects/typed-scheme/scribblings/reference/types.scrbl @@ -120,6 +120,7 @@ default in Racket. @defidform[String] @defidform[Keyword] @defidform[Symbol] +@defidform[Char] @defidform[Void] @defidform[Input-Port] @defidform[Output-Port] @@ -133,20 +134,43 @@ default in Racket. @defidform[Byte-PRegexp] @defidform[Bytes] @defidform[Namespace] +@defidform[Namespace-Anchor] +@defidform[Variable-Reference] @defidform[Null] @defidform[EOF] @defidform[Continuation-Mark-Set] -@defidform[Char] +@defidform[Prompt-Tag] @defidform[Undefined] @defidform[Module-Path] @defidform[Module-Path-Index] -@defidform[Compiled-Module-Expression] @defidform[Resolved-Module-Path] +@defidform[Compiled-Module-Expression] +@defidform[Compiled-Expression] +@defidform[Internal-Definition-Context] @defidform[Pretty-Print-Style-Table] @defidform[Special-Comment] @defidform[Struct-Type-Property] +@defidform[Impersonator-Property] @defidform[Read-Table] -@defidform[Thread])]{ +@defidform[Bytes-Converter] +@defidform[Parameterization] +@defidform[Custodian] +@defidform[Inspector] +@defidform[Security-Guard] +@defidform[UDP-Socket] +@defidform[TCP-Listener] +@defidform[Logger] +@defidform[Log-Receiver] +@defidform[Log-Level] +@defidform[Thread] +@defidform[Thread-Group] +@defidform[Subprocess] +@defidform[Place] +@defidform[Place-Channel] +@defidform[Semaphore] +@defidform[Will-Executor] +@defidform[Pseudo-Random-Generator] +)]{ These types represent primitive Racket data. @ex[ @@ -252,6 +276,10 @@ corresponding to @racket[trest], where @racket[bound] @defform[(Sequenceof t ...)]{A @rtech{sequence} that produces values of the types @racket[_t ...] on each iteration.} +@defform[(CustodianBoxof t)]{A @rtech{custodian box} of @racket[t].} +@defform[(ThreadCellof t)]{A @rtech{thread cell} of @racket[t].} + + @section{Syntax Objects} The following types represent @rtech{syntax object}s and their content.