42.1 DrRacket Language Levels

► |  | Unstable

1 | Guidelines for developing unstable libraries
2 | Bytes
3 | Classes and Objects
4 | Contracts
5 | Definitions
6 | Dictionaries
7 | Directories
8 | Exceptions
9 | Filesystem
10 | Functions
11 | Lists
12 | Net
13 | Path
14 | PLane T Packages
15 | Ports
16 | Pretty-Printing
17 | Regular Expressions
18 | Requiring Modules
19 | Sandboxed Evaluation
20 | Scribble Documentation
21 | Sets
22 | S-Expression Diff
23 | Source Locations
24 | Strings
25 | Structs
26 | Syntax
27 | Planet Package Macros
28 | Text Representations
29 | Multiple Values
30 | XML and CSS
31 | Polymorphic Contracts
32 | Finding Mutated Variables
33 | Find
34 | Interface-Oriented Programming for Classes
35 | Sequences
36 | Hash Tables
37 | Match
38 | Generics
39 | Mark Parameters
40 | Debugging
41 | Contracts for macro subexpressions
42 | GUI libraries

▼ | 42 | GUI libraries

42.1 | Dr Racket Language Levels
42.2 | Notify-boxes
42.3 | Preferences
42.4 | Slideshow Presentations
42.5 | GUI Widgets

On this page:

language-level@
language-level^
make-language-level
simple-language-level%
language-level-render-mixin
language-level-capability-mixin
language-level-no-executable-mixin
language-level-eval-as-module-mixin
language-level-macro-stepper-mixin
language-level-check-expect-mixin
language-level-metadata-mixin

Version: 5.0.1.5
top← prev up next →

#### 42.1`` DrRacket Language Levels

Carl Eastlund <cce@racket-lang.org>

( require unstable/gui/language-level)

This library is unstable; compatibility will not be maintained. See Unstable for more information.

language-level@ : unit?

This unit imports drracket:tool^ and exports language-level^.

language-level^ : signature

> ( make-language-level |  | name |
> |  | path |
> |  | mixin ... |
> | [ | #:number number |
> |  | #:hierarchy hierarchy |
> |  | #:summary summary |
> |  | #:url url |
> |  | #:reader reader]) |

> → ( object-provides/c drracket:language:language<%>)
> name : string?
> path : module-path?
> mixin : (-> class? class?)
> number : integer? = ...
> hierarchy : ( listof ( cons/c string? integer?)) = ...
> summary : string? = name
> url : ( or/c string? #f) = #f

> | reader |  | : |  | (->* [] [ any/c input-port?] ( or/c syntax? eof-object?))
> |  |  | = |  | read-syntax

> Constructs a language level as an instance of drracket:language:language<%> with the given name based on the language defined by the module at path. Applies ( drracket:language:get-default-mixin) and the given mixins to simple-language-level% to construct the class, and uses the optional keyword arguments to fill in the language’s description and reader.

> simple-language-level%

> :

> ( class-provides/c drracket:language:language<%>
> drracket:language:module-based-language<%>
> drracket:language:simple-module-based-language<%>)

> Equal to ( drracket:language:module-based-language->language-mixin ( drracket:language:simple-module-based-language->module-based-language-mixin drracket:language:simple-module-based-language%)).

> ( language-level-render-mixin |  | to-sexp |
> |  | show-void?) |

> → ( mixin-provides/c [ drracket:language:language<%>] [])
> to-sexp : (-> any/c any/c)
> show-void? : boolean?

> Produces a mixin that overrides render-value/format to apply to-sexp to each value before printing it, and to skip void? values (pre-transformation) if show-void? is #f.

> ( language-level-capability-mixin dict)
> → ( mixin-provides/c [ drracket:language:language<%>] [])
> dict : dict?

> Produces a mixin that augments capability-value to look up each key in dict, producing the corresponding value if the key is found and deferring to inner otherwise.

> language-level-no-executable-mixin : ( mixin-provides/c [ drracket:language:language<%>] [])

> Overrides create-executable to print an error message in a dialog box.

> language-level-eval-as-module-mixin

> :

> ( mixin-provides/c [ drracket:language:language<%>
> drracket:language:module-based-language<%>]
> [])

> Overrides front-end/complete-program to wrap terms from the definition in a module based on the language level’s definition module. This duplicates the behavior of the HtDP teaching languages, for instance.

> language-level-macro-stepper-mixin

> :

> ( mixin-provides/c [ drracket:language:language<%>]
> [])

> This mixin enables the macro stepper for its language level.

> language-level-check-expect-mixin : ( mixin-provides/c [ drracket:language:language<%>] [])

> This mixin overrides on-execute to set up the check-expect test engine to a language level similarly to the HtDP teaching languages.

> ( language-level-metadata-mixin |  | reader-module |
> |  | meta-lines |
> |  | meta->settings |
> |  | settings->meta) |

> → ( mixin-provides/c [ drracket:language:language<%>] [])
> reader-module : module-path?
> meta-lines : exact-nonnegative-integer?
> meta->settings : (-> string? any/c any/c)
> settings->meta : (-> symbol? any/c string?)

> This mixin constructs a language level that stores metadata in saved files allowing Drracket to automatically switch back to this language level upon opening them. It overrides get-reader-module, get-metadata, metadata->settings, and get-metadata-lines.

> The resulting language level uses the reader from reader-module, and is recognized in files that start with a reader directive for that module path within the first meta-lines lines. Metadata about the language’s settings is marshalled between a string and a usable value (based on a default value) by meta->settings, and between a usable value for a current module (with a symbolic name) by settings->meta.

top← prev up next →