【发布时间】:2017-04-04 18:15:36
【问题描述】:
我正在尝试学习打字球拍,但遇到了一些类型注释问题。
#lang typed/racket
(require typed/racket/gui)
(define frame (new frame% [label "test frame"]))
(define tab-panel (new tab-panel% [parent frame] [choices '("One" "Two" "Three")]
[min-height 300] [min-width 300]
(callback
(lambda (tp e)
(case (send tp get-selection)
((0) (send tp change-children (lambda (children) (list a-panel))))
((1) (send tp change-children (lambda (children) (list b-panel))))
((2) (send tp change-children (lambda (children) (list c-panel)))))))))
(define a-panel (new panel% (parent tab-panel)))
(define a-text (new message% (parent a-panel) (label "A-panel")))
(define b-panel (new panel% (parent tab-panel)))
(define b-text (new message% (parent b-panel) (label "B-panel")))
(define c-panel (new panel% (parent tab-panel)))
(define c-text (new message% (parent c-panel) (label "C-panel")))
在 case 语句的行中生成以下错误:
. Type Checker: missing type for identifier;
consider adding a type annotation with `:'
identifier: a-panel in: a-panel
. Type Checker: missing type for identifier;
consider adding a type annotation with `:'
identifier: b-panel in: b-panel
. Type Checker: missing type for identifier;
consider adding a type annotation with `:'
identifier: c-panel in: c-panel
. Type Checker: Summary: 3 errors encountered in:
a-panel
b-panel
c-panel
我一直在研究文档,但似乎无法找出用于解决此问题的类型声明的正确语法。
这不是家庭作业。我只是想学习打字球拍,因为我认为强打字是个好主意。
【问题讨论】:
标签: scheme racket typed-racket