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

Re: A basic question: defining modules and libraries




Scott McKay wrote:
> Neel Krishnaswami wrote in message ...
> >Andreas Bogk <andreas@andreas.org> wrote:
> >> neelk@brick.cswv.com (Neel Krishnaswami) writes:
> >> > I dunno why modules don't nest, though. Maybe there are theoretical
> >>
> >> What do you mean by 'nesting'? It is possible to combine several
> >> modules to a single module.
> >
> >I guess I mean a hierarchical namespace, kind of like the way a
> >filesystem partitions names.
> 
> I'm curious as to what you would do with this.
> 
> Would a name look like 'Dylan/Complex/add'.  If so, couldn't
> you just use 'prefix:' to get this effect?

 I would say that while I am in love with the language and
quite pleased with the module vs. library concept, I would indeed
like to see some support for hierarchical naming.

 I may also want to have libraries that are real units of compilation / optimization,
not just level-2 units of organization.

 In a personal project of mine, I had to split functionality into 7 libraries,
each with 3-4 modules. However I do not _want_ to have 7 libraries, I want
1 executable. I will never replace/upgrade those libraries individually,
so having them as DLL is useless to me (and I indeed would appreciate
having an option to compile those multiple projects into just one executable,
taking advantage of the added optimization capabilities).

 I would also want the freedom to name my modules with "logical" names.
(e.g. macros, extensions, internals). But I cannot do that as it is
a recipe for name collision.

Example: I have a library of miscellaneous language extensions I often use.
How do I name it, so that I can share it with the community without risks ?

 I chose "ego-extensions" with modules "ego-macros", "ego-collections",
"ego-iteration" (I have to say for my defense that "ego" stands for
 _E_ric _GO_uriou and has been my arcade "best-score" name for about 6 years,
and a subtle (?) reference to my former latin lectures rather than
to any egotistical tendency :-) )

 One thing I do _not_ want (I fact I want not to see it) is usage
of the hierarchical namespace capabilities inside a module.
 Please, no com.pobox.ego.collections.map-to-table
         or com/pobox/ego/collections/map-to-table
         or com/pobox/ego/collections::map-to-table
 I would prefer to have these capabilities restricted to the "define module"
level. "prefix:" and "rename:" is really all I want to see for the language
namespace [*].

 What about replacing "define library" with "define project" or similar
to define the unit of compilation/optimization/deliverable, and
expanding the module system to become hierarchical ?
 This would separate two orthogonal concepts that Dylan has mixed.

 To Dylan's defense, I still think that the module/library system
is alreay much better than the C/C++ models (where the unit of
compilation is the file) or Java (where the unit is the file,
with the file mostly restricted to containing only one class).

 It would be interesting to get comments from FO & GD folks. The 10's
of DLLs from FD make me a bit uncomfortable and the move to consolidate
the libraries into a few (IO, System, etc.) may indicate that the
module/library levels are not the be-all end-all of code organization.
 
 OK, enough ramblings for today. I look forward to your comments !

 Eric

 [*] Ok, I am not completely satisfied with "rename:" and co. :
 Another change I would like is the ability to rename on export. I guess I
know why this is not provided (so that 2 different names on import can never
refer to the same "thing" ?), but I wished at some point that I could
rename the content of a library/module once and use this for multiple
imports.

--
Eric Gouriou                             eric_gouriou@pobox.com



Follow-Ups: References: