[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Standalone applications

   Date: Thu, 15 Mar 90 15:27:22 cst
   From: bcsaic!huntsai!rodney@beaver.cs.washington.edu (Rodney Daughtrey)

   [stuff deleted]
   Sorry if my message was unclear.  If, upon startup, my standalone
   application loads a file which has the forms

	(setq *my-dialog* (oneof *dialog* ...))


	(defobfun (window-show *my-dialog*)

   then this will work.  My problem with this is that this requires
   separate source code files to be included with the "standalone"
   application, which I would like to avoid if I can.

If you can load source files into a stand-alone application, it's
blind luck.  I wouldn't count on this capability.

   Another way
   might be to have the standalone application run a function like 

      (defun create-a-dialog-at-runtime ()
	(setq *my-dialog* (oneof *dialog* ...))
	(defobfun (window-show *my-dialog*) ...))

Yes, that would work fine.  In addition, this doesn't invoke the
compiler at run-time.  (WINDOW-SHOW is compiled at the same time
that CREATE-A-DIALOG-AT-RUNTIME is compiled.  However, it's not
associated with any object until run-time.  At run time, the
dialog is created, and the DEFOBFUN is run, which associates
the definition of WINDOW-SHOW with the newly created dialog.
All this stuff doesn't involve the compiler).

   (although I think all DEF- forms must be at the top level),

No, they needn't be.  If you don't like the style of this, you
can always use FHAVE and NFUNCTION instead of DEFOBFUN.

    or possibly
      (defun create-a-dialog-at-runtime ()
	(setq *my-dialog* (oneof *dialog*...))
	(eval '(defobfun (window-show *my-dialog*) ...)))

No!  Boo, hiss!  There's absolutely no reason to be calling EVAL
in this situation.  This *will* invoke the compiler at run time
(which ain't good if the compiler isn't around anymore).

   [stuff about not defining methods on instances deleted]

It's nice to set up proper classes for things.  However, this
is a style issue, and doesn't effect the compilation semantics
at all.  Both styles can be compiled in advance.  Adding an
obfun to an object doesn't invoke the compiler.