From: Nicolas Neuss
Subject: Package question
Date: 
Message-ID: <87zncxw9ak.fsf@ortler.iwr.uni-heidelberg.de>
Hello.

I have a question how to organize my application (Femlisp) best.  At the
moment, I have several packages with simple names like "MACROS",
"UTILITIES" etc.  Although this has not lead to problems up to now, I want
to change this to be safe for the future.

At the moment, I have a structure where I have one file,
e.g. "macros-defp.lisp", containing the package definition

(in-package "COMMON-LISP-USER")

(defpackage "MACROS"
  (:use "COMMON-LISP")
  (:export
   "WITH-GENSYMS" "WITH-ITEMS" ...))

and further files, e.g. "macros.lisp", containing code of the form

(in-package :macros)

...

Since I rarely use "::" and ":" it would be rather straightforward to
change those package names to something like "FEMLISP-MACROS" (or
"MACROS.FEMLISP"?).  Nevertheless, I wonder if there is a better way.
Could hierarchical packages help here?  (I am not sure that I really
understand them, so it would be fine if someone could sketch how to apply
them in this case.)  Does their use bring massive portability problems?

Thanks,

Nicolas.
From: Marco Antoniotti
Subject: Re: Package question
Date: 
Message-ID: <z8BLb.315$Nq.74464@typhoon.nyu.edu>
Nicolas Neuss wrote:

> Hello.
> 
> I have a question how to organize my application (Femlisp) best.  At the
> moment, I have several packages with simple names like "MACROS",
> "UTILITIES" etc.  Although this has not lead to problems up to now, I want
> to change this to be safe for the future.
> 
> At the moment, I have a structure where I have one file,
> e.g. "macros-defp.lisp", containing the package definition
> 
> (in-package "COMMON-LISP-USER")
> 
> (defpackage "MACROS"
>   (:use "COMMON-LISP")
>   (:export
>    "WITH-GENSYMS" "WITH-ITEMS" ...))
> 
> and further files, e.g. "macros.lisp", containing code of the form
> 
> (in-package :macros)
> 
> ...
> 
> Since I rarely use "::" and ":" it would be rather straightforward to
> change those package names to something like "FEMLISP-MACROS" (or
> "MACROS.FEMLISP"?).  Nevertheless, I wonder if there is a better way.
> Could hierarchical packages help here?  (I am not sure that I really
> understand them, so it would be fine if someone could sketch how to apply
> them in this case.)  Does their use bring massive portability problems?


I think your organization is just fine.  I would just call the packages
"FEMLISP.MACROS", "FEMLISP.UTILITIES" etc etc.  You could even go the way of

(defpackage "DE.UNI-HEIDELBERG.IWR.FEMLISP.MACROS" (:use "CL")
    (:nicknames "FEMLISP.MACROS")
    ....)

It would make even more sense IMHO. It is up to you.

Hierarchical packages are not standard so you should not worry about 
them and use the naming in a hierarchical way as a useful (self 
documenting) convention.

Cheers
--
Marco