Modules
Hans-Dieter.Dreier@materna.de
Hans-Dieter.Dreier@materna.de
Tue, 16 Mar 1999 18:19:30 +0100
--6uOxognCoqm13my0fF6b8jNb0VOojfne
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable
>Modules
>-------
>
>...
I agree to all of the above.
#ifs should never be neccessary because the compiler can evaluate the expre=
ssion and remove the code that is inaccessible. IMO the only good thing con=
cerning #ifs is that one can see at first glance that they are there for co=
nditional compilation.
>Modules are a collection of top-level elements, which will usually be
>classes/singular objects/etc. Hence modules are thrown together into
>one program, none having a priveleged status over another. You can
>imagine this as concatenating text files, if the merging were text
>files. Since we are editing ASTs, there is no need for rules
>prohibiting forward references.
Agree to all. One remark however: I would allow to include not only topleve=
l elements but also class members and other nested elements as long as the =
path from root to the element in question touches only classes and name spa=
ces. These would be mixed in. In this way certain aspects of the whole clas=
s system could be isolated in separate modules. Examples: The IDE, profilin=
g, debugging, code generation (compiler version dependent), customised edit=
ing (see GUI builders thread). It's usable for all kinds of "one-way" relat=
ionships (were A knows about B, but B not about A).
>My view of the way the editor should handle this, is to normally not
>show the modules at the top of the hierachy, although it could allow
>this. Hence the modules would normally might be transparent, except for
>perhaps something to indicate you don't have write access to that code. =
>Some facility must exist to move top-level elements between modules.
Agreed. Centura does it exactly as you sketch here. They have a "refresh" f=
acility to re-load a module in case the user has switched off the automatic=
detection of file changes, and a "merge" facility that merges all included=
files. They also have an "includes" section where you can see what you inc=
luded (and also, what was indirectly included) as well as edit/insert/delet=
e the file specs. Included parts are always noneditable, but you may spawn =
another instance of Centura on that include file with a single keystroke an=
d that will open the include's outline at the current position.
>Separate Compilation
>--------------------
>
>I already have allowed multiple elements in a module. For the module
>system to be further independent of the nesting system (ie information
>hiding) we need to allow an element to span multiple modules. We might
>not want the same access control over an entire element, or we might
>want to allow swapping a smaller part with a similar part. This smaller
>part would essentially be a nested class or method.
>
>Hence the language could support some sort of separate compilation
>system similar to that of Ada, where they are called "subunits". =
>Essentially this puts a stub where the nested element would go and
>allows it to be provided separately as a physically top-level element,
>although conceptually still within the other element and hence getting
>private member access rights. From there on it can be moved into
>another module and hence swapped and access controlled separately.
You would make a separate class / name space of the separated part and use =
delegation ("stub") to access it, and a back pointer to the surrounding cla=
ss to access that from within the separated part? (Please forgive my insist=
ing on "how do you" questions, but I need to know how it works, to see what=
it can do and where its limits are :).
>Some issues that might arise in the compilation process would be as
>follows:
>
>(1) Need to typecheck an element in a different module from it's
>surrounding element.
An interface view of the module containing the lacking type should help.
>(2) Could not be optimised well until the modules are linked together.
Maybe not even then.
>(3) Being able to see a top-level element no longer implies you can
>access it.
Don't you mean "access it no longer"? Otherwise please explain.
--
Regards,
Hans-Dieter Dreier
(Hans-Dieter.Dreier@materna.de)=
--6uOxognCoqm13my0fF6b8jNb0VOojfne
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable
IDENTIFIKATIONSANGABEN:
a23203a.txt IA5 DX-MAIL X.400 User Agent=
--6uOxognCoqm13my0fF6b8jNb0VOojfne--