Skip to content

翻译了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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions typed-racket-doc/typed-racket/scribblings/guide/quick.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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].}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将语言选择为 @racketmodname[typed/racket]。

这里指的应该是 DrRacket 里左下角的选择语言。
注意句号。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不一定是手动「选」语言啊 #lang typed/racket也可以……

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然这样也没错啦= =

将语言修改为 @racketmodname[typed/racket]。

@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[
Expand All @@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 Racket REPL 中使用 Typed Racket

注意大小写,中英文之间应当用空格隔开,标点和英文之间不需要空格。


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时
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多了一个「在」,注意大小写和空格。

使用如下命令行:
@commandline{racket -I typed/racket}