Subject: Re: dynamic redefinition of classes
From: Erik Naggum <erik@naggum.no>
Date: 1998/11/05
Newsgroups: comp.lang.lisp.franz,comp.lang.lisp,comp.lang.clos
Message-ID: <3119296956921513@naggum.no>

* "Mattias Högström" <pt95...@student.hk-r.se>
| When do you want to change a class' behaviour run-time?

  well, I have this application running at a client's that needs 100%
  uptime from 04:00 through 20:00 every working day.  when I make changes
  to the system, I can load new function and class definitions into the
  running system, and pre-existing instances of a class will update
  themselves to the new class definition.  we had 99.994% uptime until last
  week, when a firewall got Alzheimer's and the backup routed croaked, so
  now we're down to 99.96% uptime.  without the ability to make run-time
  changes to class definitions, we would have had to stop and restart the
  system several times a day, usually in response to user requests that
  would probably not have been possible to satisfy at all without this
  feature.

| Why not instanciate a subclass to change the behaviour?

  you're thinking static applications, here.  don't.  think living systems
  that don't believe in reincarnation (reboot).

| How is it possible to avoid comparing to other languages I know?

  just don't do it.  consciously avoid comparing when you feel it coming
  on.  force yourself to start with a clean slate and separate old from new
  like you separate two natural languages you need to learn.  (you never
  learn to speak another language if you keep translating between the two
  or continue to think in one and use grammar and vocabular from another --
  I'm sure you already know this. :)

| Learning object-orientation with C++ was huge a mistake(damn my school)
| Now it's harder than ever to understand true object-oriented languages.

  not really.  the human mind has a demonstrably great capacity to repress
  painful experiences.  it's a basic defense mechanism in any intelligent
  animal with memory.  you don't even need to learn to use it, just do it.
  (and don't think I'm being facetious.)

| I will probably not need it either, I was just interested in when you
| need it, since it doesn't exist in C++.  How does C++ cope without it?

  C++ doesn't cope without it.  therefore, if you think in C++ terms, you
  will need it as much as the average fish will invent hanggliding gear.

  invention is the mother of need.

  a typical example of when you need a meta-class is when you want some
  behavior to apply to all instances of all classes of the meta-class, like
  persistent objects that are going to be stored on disk.  you would code
  the disk-storing properties in one place, only, and use the classes just
  like normal classes.  everything relating to persistency would be taken
  care of automatically.  in a language without this ability to centralize,
  you would need to code the persistence in a lot of places, and perhaps
  expose it via different calling conventions where it is being used.

| Now I am really interested what meta classes really are.

  they define the behavior of classes as classes define the behavior of
  their instances.  it's really no big deal.  instead of being taught "this
  is what being a class means" and having to adapt to whatever the language
  offers, you can now define it yourself if you need more than the language
  designers had in mind at the time.  this is the same argument you would
  use to describe classes (or even structures or simple type definitions).

#:Erik
-- 
  The Microsoft Dating Program -- where do you want to crash tonight?