Skip to content

Commit e8aa3bb

Browse files
committed
environment-protocols: Replace initialize-application-client
Instead of definiing an open generic function to be called by run-application after instantiating the new <application>, add an initialize-client: keyword argument to run-application for explicitly passing a callback function. * sources/environment/protocols/applications.dylan (run-application): Add an initialize-client keyword argument to the generic function definition. (initialize-application-client): Remove generic definition and default method. (run-application on <project-object>): Add an initialize-client: keyword argument, and call the referenced callback function in place of initialize-application-client. * sources/environment/protocols/module.dylan (module environment-protocols): Remove export of initialize-application-client. * documentation/source/hacker-guide/environment/environment-protocols.rst: Remove entry for initialize-application-client. * sources/environment/dfmc/application/control-protocols.dylan (run-application on <dfmc-application>): Add a do-nothing initialize-client: keyword argument so that the method is congruent with the generic function definition. * sources/environment/commands/application/debugging.dylan (do-execute-command on <start-application-command>): Explicitly pass in a initialize-client: callback. (initialize-application-client): Change method definition to a function.
1 parent db35872 commit e8aa3bb

File tree

5 files changed

+8
-23
lines changed

5 files changed

+8
-23
lines changed

documentation/source/hacker-guide/environment/environment-protocols.rst

-11
Original file line numberDiff line numberDiff line change
@@ -3020,17 +3020,6 @@ Applications
30203020
.. method:: run-application
30213021
:specializer: <project-object>
30223022

3023-
.. generic-function:: initialize-application-client
3024-
:open:
3025-
3026-
:signature: initialize-application-client (client application) => ()
3027-
3028-
:parameter client: An instance of :class:`<object>`.
3029-
:parameter application: An instance of :class:`<application>`.
3030-
3031-
.. method:: initialize-application-client
3032-
:specializer: <object>, <application>
3033-
30343023
.. generic-function:: attach-live-application
30353024
:open:
30363025

sources/environment/commands/application/debugging.dylan

+3-2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ define method do-execute-command
354354
(context,
355355
run-application, project,
356356
client: context,
357+
initialize-client: initialize-application-client,
357358
machine: machine | unsupplied(),
358359
startup-option: case
359360
debug? => #"debug";
@@ -724,7 +725,7 @@ end method parse-next-argument;
724725

725726
/// Application callbacks
726727

727-
define sideways method initialize-application-client
728+
define function initialize-application-client
728729
(context :: <environment-context>, application :: <application>) => ()
729730
register-application-callbacks
730731
(application,
@@ -752,7 +753,7 @@ define sideways method initialize-application-client
752753
application.application-filename);
753754
end,
754755
message-type: <run-application-failed-message>);
755-
end method initialize-application-client;
756+
end function initialize-application-client;
756757

757758

758759
define method start-debugging

sources/environment/dfmc/application/control-protocols.dylan

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ define method run-application
3333
(application :: <dfmc-application>,
3434
#key startup-option :: <symbol> = #"start",
3535
client,
36+
initialize-client,
3637
filename :: false-or(<file-locator>),
3738
arguments :: false-or(<string>),
3839
process :: false-or(<process>) = #f,
@@ -44,6 +45,7 @@ define method run-application
4445
pause-before-termination? :: <boolean> = #f)
4546
=> (application :: <dfmc-application>)
4647
ignore(client);
48+
ignore(initialize-client);
4749

4850
// A couple of conveniences for filename processing stolen from
4951
// the console debugger.

sources/environment/protocols/applications.dylan

+3-9
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ define open generic run-application
108108
(server :: <server>,
109109
#key startup-option,
110110
client,
111+
initialize-client,
111112
filename,
112113
arguments,
113114
pause-before-termination?,
@@ -116,9 +117,6 @@ define open generic run-application
116117
machine)
117118
=> (application :: <application>);
118119

119-
define open generic initialize-application-client
120-
(client :: <object>, application :: <application>) => ();
121-
122120
// There's no NOTE-RUN-APPLICATION-REQUESTED, we just do the relevant
123121
// work in RUN-APPLICATION.
124122

@@ -183,11 +181,6 @@ define method perform-application-transaction
183181
end
184182
end method perform-application-transaction;
185183

186-
define method initialize-application-client
187-
(client :: <object>, application :: <application>) => ()
188-
#f
189-
end method initialize-application-client;
190-
191184
define method note-application-initialized
192185
(project :: <project-object>)
193186
=> ()
@@ -260,6 +253,7 @@ define method run-application
260253
(project :: <project-object>,
261254
#key startup-option = #"start",
262255
client = project,
256+
initialize-client :: <function> = ignore,
263257
filename,
264258
arguments,
265259
working-directory,
@@ -297,7 +291,7 @@ define method run-application
297291
end if;
298292
broadcast($project-channel,
299293
make(<run-application-requested-message>, project: project));
300-
initialize-application-client(client, application);
294+
initialize-client(client, application);
301295
let host-machine? = machine == environment-host-machine();
302296
run-application(application,
303297
startup-option: startup-option,

sources/environment/protocols/module.dylan

-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ define module environment-protocols
387387
find-application-proxy,
388388
application-proxy-id,
389389
run-application,
390-
initialize-application-client,
391390
attach-live-application,
392391
note-run-application-failed,
393392
stop-application,

0 commit comments

Comments
 (0)