When opening a new window where the language is one of the htdp languages (via the

language dialog, not the #lang htdp/* variants), teachpacks are put into the
initial REPL (instead of just having the language primitives).

closes PR 11160
This commit is contained in:
Robby Findler 2010-09-04 19:35:39 -05:00
parent 081fc3bad5
commit 5e04a5c6d9
3 changed files with 20 additions and 5 deletions

View File

@ -1590,7 +1590,8 @@ TODO
(queue-user/wait
(λ () ; =User=, =No-Breaks=
(send (drracket:language-configuration:language-settings-language user-language-settings)
first-opened))))
first-opened
(drracket:language-configuration:language-settings-settings user-language-settings)))))
(define/public (reset-console)
(when (thread? thread-killed)
@ -1686,8 +1687,16 @@ TODO
(queue-user/wait
(λ () ; =User=, =No-Breaks=
(send (drracket:language-configuration:language-settings-language user-language-settings)
first-opened)))
(let ([lang (drracket:language-configuration:language-settings-language user-language-settings)])
(cond
;; this is for backwards compatibility; drracket used to
;; expect this method to be a thunk (but that was a bad decision)
[(object-method-arity-includes? lang 'first-opened 1)
(send lang first-opened
(drracket:language-configuration:language-settings-settings user-language-settings))]
[else
;; this is the backwards compatible case.
(send lang first-opened)]))))
(insert-prompt)
(send context enable-evaluation)

View File

@ -426,6 +426,9 @@
(go "." welcome)
(newline port)))
(define/override (first-opened settings)
(for-each namespace-require/constant (htdp-lang-settings-teachpacks settings)))
(inherit get-module get-transformer-module get-init-code
use-namespace-require/copy?)
(define/override (create-executable setting parent program-filename)

View File

@ -628,8 +628,8 @@ default settings obtained via
}
@defmethod[(first-opened)
void?]{
@defmethod*[([(first-opened [settings settings]) void?]
[(first-opened) void?])]{
This method is called when the language is initialized, but
no program is run. It is called from the user's eventspace's
@ -638,6 +638,9 @@ main thread.
See also
@method[drracket:rep:text% initialize-console].
It does not have to accept both zero and one arguments; the zero argument
version is for backwards compatibility and drracket tests the arity of the
method before invoking it.
}