2.1 Language Declared in Source

► |  | Dr Racket: The Racket Programming Environment

1 | Interface Essentials
2 | Languages
3 | Interface Reference
4 | Extending Dr Racket
| Index

▼ | 2 | Languages

2.1 | Language Declared in Source
2.2 | Legacy Languages
2.3 | How to Design Programs Teaching Languages
2.4 | Other Experimental Languages
2.5 | Output Printing Styles

► | 2.1 | Language Declared in Source

2.1.1 | Initial Environment
2.1.2 | Details Pane of Language Dialog

On this page:

2.1.1 Initial Environment
2.1.2 Details Pane of Language Dialog

Racket
top contents ← prev up next →

### 2.1 Language Declared in Source🔗ℹ

The The Racket Language mode in DrRacket is a kind of meta-language, where the program itself specifies its language, usually through a #lang line.

More generally, when using this mode, the definitions window must contain a module in some form. Besides #lang, a Racket module can be written as (module ...); aside from comments, the definitions window must contain exactly one module.

#### 2.1.1 Initial Environment🔗ℹ

DrRacket initializes the environment before it starts running the program in ways slightly different than the racket command-line binary does to reflect the extra GUI capabilities that it provides. Using the default settings in the language dialog, it initializes the parameters described in this subsection. Changing the defaults can result in additional parameters changing, as described in the next subsection.

DrRacket initializes the pretty-print-size-hook and pretty-print-print-hook to specially recognize

- snip%s, which it just inserts into the editor

- convertible values from pict/convert, which are rendered with padding specified by convert-bounds-padding around the bounding box to reduce edge effects

- convertible values from file/convertible (which it converts to png images)

- numbers that are exact? and real?, but not integer?, which it prints specially to allow showing repeating decimal representations and mixed fractions, and

- values that match the predicates passed to drracket:language:add-snip-value.

It also initializes the global-port-print-handler to use pretty-print instead of just print.

DrRacket initializes the error-display-handler to specially highlight the source locations of the errors and to include icons that provide access to the stacktrace.

#### 2.1.2 Details Pane of Language Dialog🔗ℹ

In the details pane of the language dialog, some of the configuration options correspond to using various libraries and thus can be used without DrRacket. Here’s how, for the ones that are straightforward (the ones not mentioned here require more sophisticated configuration of various libraries).

- Dynamic Properties: The radio buttons corresond to various uses of the errortrace/errortrace-lib library.

  The No Debugging or profiling option means not to use the library at all.

  The Debugging option means (current-compile (make-errortrace-compile-handler)) as well as adding (build-path "compiled" "errortrace") to use-compiled-file-paths.

  The Debugging and profiling option means to use errortrace/errortrace-lib library’s profiling-enabled in conjunction with current-eval.

  The Syntactic test suite coverage option means to use test-coverage-enabled in conjunction with current-eval.

  The other three checkboxes save compiled .zo files and adjust the compiler.

  The populate compiled/ directories option corresponds to

  > (current-load/use-compiled
  > (make-compilation-manager-load/use-compiled-handler))
  > (manager-skip-file-handler
  > (λ (p)
  > (file-date-in-paths
  > p
  > (cons (CACHE-DIR) (current-library-collection-paths)))))

  plus adding either (build-path "compiled" "drracket") or (build-path "compiled" "drracket" "errortrace") to the front of use-compiled-file-paths, depending if the Debugging option is set or not.

  The Preserve stacktrace option corresponds to

  > (compile-context-preservation-enabled #t)

  The Enforce constant definitions (enables some inlining) option corresponds to calling compile-enforce-module-constants; checking it passes #t and leaving it unchecked passes #f.

- Output Syntax: The output syntax options correspond to settings in the racket/pretty library and the mzlib/pconvert library.

- Collection Paths: This corresponds to setting the current-library-collection-paths parameter.

- Command-line arguments: This corresponds to setting the current-command-line-arguments parameter.

- Automatic #lang line: This panel controls the default #lang that DrRacket inserts into new windows (or tabs). If the top option of the radio box is chosen (the default), DrRacket uses the last #lang that was edited in a definitions window. If the lower option of the radio box is chosen, DrRacket always uses the same #lang line, as given in the text field.

top contents ← prev up next →