In article news:<ni%Wj.135278$Er2.10925@[EMAIL PROTECTED]
>,
Edward Diener wrote:
> The most obvious case for run-time introspection is RAD programming
> in C++, aka design-time programming for properties and events.
Sorry, I feel I have to but in here ... IMO your view is unsup****table
on a number of different levels:
In the first place, the design-time requirements of a RAD system
should not be confused with the run-time requirements of the
components used. Sure, you need some sort of metadata to describe how
the component looks and behaves but those data do not have to be
obtained by calling one of the components and asking it what it knows
about itself. It is only very occasionally that one wants design-time
behaviour to be present in an application at runtime, and omitting it
can reduce bloat considerably. OTOH it is quite common for a vendor
to wish to be able to supply run-time-only versions of components -
and the logical separation of design-time and run-time features eases
this considerably.
In the second place, the use of language-sup****ted introspection to
provide design-time sup****t in a RAD system limits the RAD tool to
using and generating that language alone. Designers of widget-sets
commonly wish to be able to make their widgets available to developers
using a wide variety of languages and tools, and they will not thank
you for tying the design-time functionality to C++ alone.
In the third place, code in that I have seen in languages that do
sup****t introspection has seldom been clearer for its use. In an
alarming number of cases introspective facilities were clearly being
used only because the designer(s) had been too lazy (or too
incompetent) to design a workable class hierarchy in the first place.
Introspection has become a sort of "get out of gaol free" card for bad
designers. That's not to say that introspection can't be a useful
tool, just that it seems to be used badly more often than it is used
well.
> The obvious success of RAD IDEs built from Java, .Net, and C++
> extensions ( C++ Builder, QT ) in these areas, all with run-time
> introspection, show the im****tance of this facility.
Yes, introspection can be used quite effectively in Java -- but are
the solutions that use it good ones? Pragmatically you may say "yes"
because they generally work, but in many cases they seem to be to be
bodges that have been put in place for want of a well thought-out
design. The use of introspection in Java RAD tools does lead to
usable RAD tools, but I believe that better tools could have been
built with little or no extra effort if a system had been designed
that used external metadata descriptions of components (doubtless
using still more of the impenetrable XML files in which Java
developers seem to revel) rather than saying "hello, what are you?"
I can't speak for .NET because I haven't used it enough, but I don't
consider the tools used by C++ Builder or Qt to constitute extensions
to C++ or to provide what is normally meant by the term
"introspection" -- Qt programs, at least, can be built with a standard
(unextended) C++ compiler. Both use metadata outside the C++ language
to describe component behaviour, much as I recommended above.
For RAD development, what is needed is a standard for publication of
GUI (and other) components in a language-neutral (and if possible
platform-neutral) way. If such a standard were to be adopted by
multiple vendors, with bindings to multiple languages, it would do far
more to ease the process of RAD design, RAD development, and the
provision of RAD tools for C++ than would adding introspection to the
language.
> Unfortunately the standard C++ committee has been nearly oblivious
> to the benefits of run-time reflection so C++ will almost certainly
> continue to do without it, much to C++'s own loss.
Introspection does not come for free (any more than does RTTI), and
there is a principal in C++ that you should only pay for what you use.
Adding introspection to the language would be a violation of that
principal, and as such I'm dead against it.
--
Daniel James | djng
Sonadata Limited | at sonadata
UK | dot co dot uk
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|