{"size": 3115, "ext": "scrbl", "max_stars_repo_path": "htdp-doc/htdp/htdp.scrbl", "max_stars_repo_name": "bdeket/htdp", "max_stars_repo_stars_event_min_datetime": "2015-01-14T20:28:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T04:04:26.000Z", "max_issues_repo_path": "htdp-doc/htdp/htdp.scrbl", "max_issues_repo_name": "bdeket/htdp", "max_issues_repo_issues_event_min_datetime": "2015-01-14T19:50:21.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T21:38:00.000Z", "max_forks_repo_path": "htdp-doc/htdp/htdp.scrbl", "max_forks_repo_name": "bdeket/htdp", "max_forks_repo_forks_event_min_datetime": "2015-01-14T19:11:38.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-24T05:11:39.000Z"}
{"max_stars_count": 85, "max_issues_count": 132, "max_forks_count": 81, "avg_line_length": 41.5333333333, "max_line_length": 109, "alphanum_fraction": 0.7691813804}
#lang scribble/doc

@(require scribble/manual 
          (for-label [except-in racket require]
                     htdp/color-structs
                     [only-in lang/htdp-beginner require]))

@title[#:style 'toc #:tag "htdp"]{Implementing HtDP Teachpacks, Libraries, and Customized Teaching Languages}

DrRacket has two different mechanisms for making available additional functions
and functionality to students using the teaching languages. 


@itemize[
@item{HtDP Teachpacks are added to a student's program by clicking on the
``Language'' menu and selecting ``add Teachpack''. Students can then install a
new Teachpack by clicking ``Add Teachpack to List'' and choosing the Teachpack
file from the filesystem.}

@item{HtDP Libraries are brought into the student's program using a
@racket[require] statement.}]

Under the hood, HtDP Teachpacks and HtDP Libraries are implemented the same way,
using normal Racket @secref[#:doc '(lib "scribblings/guide/guide.scrbl") "modules"]. 

When implementing such an extension for students, pay a special attention
to two aspects: 
@itemlist[#:style 'ordered

@item{@bold{choice of construct}: The teaching languages limit the
expressive power in comparison to plain Racket. One goal is to teach
``design subject to constraints,'' and the other one is to help restrict
the set of explanations for student errors. With regard to the first, we
consider it imperative that new teachpacks and libraries avoid features
intended for upper-level students or professionals.}

@item{@bold{error messages}: The error messages from the teaching languages
go to great length to never confront students messages that uses vocabulary
or phrases outside of the scope of the chosen level. While teachpacks and
libraries can be used at all levels, they should ideally restrict the
vocabulary in error message to the lowest level language in which they are
to be used.}

]


This manual describes library support for authors of HtDP Teachpacks, libraries,
and customized teaching languages. Use the HtDP
@seclink["error-reporting"]{error reporting functions} to create error messages
that integrate smoothly with those of the teaching languages. Before composing
new error messages, we recommend you read the @seclink["error-guidelines"]{error
message composition guidelines} that informed the design of the error messages
of DrRacket's teaching languages.

@local-table-of-contents[#:style 'immediate-only]

@include-section["error-composition.scrbl"]

@include-section["error-reporting.scrbl"]
@include-section["testing.scrbl"]
@include-section["htdp-lib.scrbl"]

@section{Color and Alpha Color Structs}

@defmodule[htdp/color-structs]

@defstruct[color ([red any/c] [green any/c] [blue any/c])]{
  This is the color struct that is also exported by @racketmodname[htdp/image],
  but here it is exported via @racket[(provide (struct-out color))].
}
@defstruct[alpha-color ([alpha any/c] [red any/c] [green any/c] [blue any/c])]{
  This is the color struct that is also exported by @racketmodname[htdp/image],
  but here it is exported via @racket[(provide (struct-out alpha-color))].
}
