7 Language-Specific Capabilities

▼ |  | Dr Racket Plugins

1 | Implementing Dr Racket Plugins
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-Specific Capabilities
8 | Check Syntax
9 | Cooperating with Background Check Syntax
10 | Teaching Languages
11 | Signatures
12 | drracket: get/ extend
13 | drracket: unit
14 | drracket: language
15 | drracket: language-configuration
16 | drracket: debug
17 | drracket: rep
18 | drracket: frame
19 | drracket: help-desk
20 | drracket: eval
21 | drracket: modes
22 | drracket: module-language-tools
23 | drracket: module-language
24 | drracket: tracing
25 | Backwards Compatibility
| Index

► | 7 | Language-Specific Capabilities

7.1 | Customizing Dr Racket’s Behavior
7.2 | Customizing Dr Racket’s GUI

On this page:

7.1`` Customizing Dr Racket’s Behavior
7.2`` Customizing Dr Racket’s GUI

top ← prev up next →

### 7`` Language-Specific Capabilities

#### 7.1`` Customizing DrRacket’s Behavior

When using the language declared in the source, DrRacket queries that language via module-compiled-language-info to determine if an expression in the interactions window is ready to be submitted to the evaluator (when the user types return). The info procedure is passed 'drracket:submit-predicate and should return a function with this contract:

> (-> input-port?
> boolean?
> boolean?)

This function’s first argument is a port that contains the interactions window’s data, starting from the prompt position to the end of the editor. The second argument is a boolean indicating if the insertion point is followed only by whitespace. The results should be a boolean indicating if the expression should be evaluated. This function is called in sandbox, but with no filesystem limits.

#### 7.2`` Customizing DrRacket’s GUI

DrRacket’s capability interface provides a mechanism for tools to allow languages to hide their GUI interface, if the tool does not apply to the language. Tools register capabilities keyed with symbols via. drracket:language:register-capability. Once registered, a tool can query a language, via the capability-value method. The result from this method controls whether or not the tool shows this part of the GUI for DrRacket.

See drracket:language:register-capability for a list of the capabilities registered by default.

top ← prev up next →