-
Notifications
You must be signed in to change notification settings - Fork 0
翻译了ts-guide的quick start #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,25 +3,22 @@ | |
@(require "../utils.rkt" (for-label (only-meta-in 0 typed/racket))) | ||
@(provide typed-mod) | ||
|
||
@title[#:tag "quick"]{Quick Start} | ||
@title[#:tag "quick"]{快速开始typed-racket} | ||
|
||
Given a module written in the @racketmodname[racket] language, using | ||
Typed Racket requires the following steps: | ||
在 @racketmodname[racket] 中的模块使用typed racket, 遵循以下的步骤: | ||
|
||
@itemize[#:style | ||
'ordered | ||
@item{Change the language to @racketmodname[typed/racket].} | ||
@item{Change the uses of @racket[(require mod)] to | ||
@item{将language修改为 @racketmodname[typed/racket].} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
这里指的应该是 DrRacket 里左下角的选择语言。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不一定是手动「选」语言啊 #lang typed/racket也可以…… There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 虽然这样也没错啦= =
|
||
@item{将 @racket[(require mod)] 改为 | ||
@racket[(require typed/mod)].} | ||
@item{Annotate structure definitions and top-level | ||
definitions with their types.} ] | ||
@item{给结构和顶层定义加上类型签名} ] | ||
|
||
Then, when the program is run, it will automatically be typechecked | ||
before any execution, and any type errors will be reported. If there | ||
are any type errors, the program will not run. | ||
然后,程序执行前就会自动检查它的类型,如果发生任何类型错误,则报告错误, | ||
停止执行。 | ||
|
||
Here is an example program, written in the @racketmodname[racket] | ||
language: | ||
|
||
这是一个 @racketmodname[racket] 中的例子: | ||
|
||
@(define typed-mod | ||
@racketmod[ | ||
|
@@ -45,12 +42,12 @@ racket | |
(sqr (- (pt-y p2) (pt-y p1)))))) | ||
] | ||
|
||
Here is the same program, in @racketmodname[typed/racket]: | ||
这是相同的用 @racketmodname[typed/racket] 写的例子: | ||
|
||
@|typed-mod| | ||
|
||
@section{Using Typed Racket from the Racket REPL} | ||
@section{在Racket REPL中使用typed racket} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
注意大小写,中英文之间应当用空格隔开,标点和英文之间不需要空格。 |
||
|
||
It is possible to use Typed Racket from the Racket REPL. To do so, start Racket | ||
with the following command line: | ||
我们可以在在Racket REPL中使用Typed Racket,只要在开启racket时 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 多了一个「在」,注意大小写和空格。 |
||
使用如下命令行: | ||
@commandline{racket -I typed/racket} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typed-racket 可以去掉