Luc Beaudoin writes:
> I guess I still don't have the hang of sections and rc_graphic. I'm not sure
> why when I define the following bit of code which loads up rc_graphic in the
> section, Foo, and then calls rc_start (which is defined in rc_graphic),
> rc_start is not defined!
The reason is that adding (compiling) a library in a section doesn't mean
that the identifiers of the library are visible there! This may seem daft
when you first encounter it but think of it like this. The purpose of
a section is to avoid accidental sharing of identifiers by making some
identifiers private. The point of libraries is to publish some identifiers
globally (to avoid multiple loadings of the same library.) So it is not
likely that the two work smoothly together.
The problem stems from the fact that there is no separation between the
loading of a library and the accessing of its identifiers. Part of the
reworking of sections that we are doing for Pop9X is to separate these
two roles. In Pop9X I plan that it will be possible to write something like
this
section Alpha
uses Beta
publishes x, y, z;
<CODE>
endsection;
In this context we have loaded section-library Beta but the published
identifiers of Beta are only visible in section Alpha. Thus the developer
does not have their application "polluted" by Beta merely because they
require Alpha. Equally, when another section requires Beta, Beta is not
reloaded -- but its identifiers are imported (shared) by that section.
This approach solves many of the difficulties that the current section
mechanism suffers from, is more in accord with today's software engineering
practice, and (I believe) is easier to learn to use.
Steve
|