From: Raghuram
Subject: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <c08bb3ef.0310150113.be474cd@posting.google.com>
Hi,
   Could anybody tell me what is the difference between defpackage Vs
Makepackage?
       Both the methods are used to create a new package. I found no
difference in both of them, in usage and in parameters.

Thank you in advance......


regards
-Raghuram

From: Kaz Kylheku
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <cf333042.0310150930.2eb5ec3b@posting.google.com>
···············@yahoo.com (Raghuram) wrote in message news:<···························@posting.google.com>...
> Hi,
>    Could anybody tell me what is the difference between defpackage Vs
> Makepackage?

DEFPACKAGE is a macro that provides a unified interface for package
definition. You can think of it as a syntactic abstraction over the
functions MAKE-PACKAGE, IMPORT, SHADOWING-IMPORT, EXPORT and others.

Here is a note from the description of MAKE-PACKAGE:

  In situations where the packages to be used contain symbols
  which would conflict, it is necessary to first create the package
  with :use '(), then to use shadow or shadowing-import to address
  the conflicts, and then after that to use use-package once the
  conflicts have been addressed. 

With DEFPACKAGE, you can write one form with parameters to do this
multi-step package setup in one form.

Also, if a DEFPACKAGE top level form for the same package appears more
than once in the program, this is taken care of, whereas MAKE-PACKAGE
signals an error if you try to make a package that already exists.
This built-in tolerance allows multiple modules of your program to
independently load a common DEFPACKAGE definition, which is a common
way of structuring Lisp programs. The package definition is
centralized in some file, which is loaded by everything else. Loading
that file more than once doesn't create an error situation.
From: james anderson
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <3F8D94E3.657FE951@setf.de>
Kaz Kylheku wrote:
> 
>...
> 
> Also, if a DEFPACKAGE top level form for the same package appears more
> than once in the program, this is taken care of, whereas MAKE-PACKAGE
> signals an error if you try to make a package that already exists.
> This built-in tolerance allows multiple modules of your program to
> independently load a common DEFPACKAGE definition, which is a common
> way of structuring Lisp programs. The package definition is
> centralized in some file, which is loaded by everything else. Loading
> that file more than once doesn't create an error situation.

although i have never see this use to have adverse consequences, i did not
understand the standard to actually specify the consequences of this mode of
use. in particular, the sentence [0]

If defined-package-name already refers to an existing package, the
name-to-package mapping for that name is not changed. If the new definition is
at variance with the current state of that package, the consequences are
undefined; an implementation might choose to modify the existing package to
reflect the new definition. 

never gave me the sense that i could expect that the mode be truly portable.
one consequence was the modPackage macro in cl-xml, which was implemented to
distinctly specify whether aspects fo the definition are assertions, or
additions the the existing state.

...

[0] http://www.lispworks.com/reference/HyperSpec/Body/m_defpkg.htm
From: Raghuram
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <c08bb3ef.0310160157.64a384b2@posting.google.com>
Thank You Guys............ Got a clear idea.
Thank you very much.


james anderson <··············@setf.de> wrote in message news:<·················@setf.de>...
> Kaz Kylheku wrote:
> > 
> >...
> > 
> > Also, if a DEFPACKAGE top level form for the same package appears more
> > than once in the program, this is taken care of, whereas MAKE-PACKAGE
> > signals an error if you try to make a package that already exists.
> > This built-in tolerance allows multiple modules of your program to
> > independently load a common DEFPACKAGE definition, which is a common
> > way of structuring Lisp programs. The package definition is
> > centralized in some file, which is loaded by everything else. Loading
> > that file more than once doesn't create an error situation.
> 
> although i have never see this use to have adverse consequences, i did not
> understand the standard to actually specify the consequences of this mode of
> use. in particular, the sentence [0]
> 
> If defined-package-name already refers to an existing package, the
> name-to-package mapping for that name is not changed. If the new definition is
> at variance with the current state of that package, the consequences are
> undefined; an implementation might choose to modify the existing package to
> reflect the new definition. 
> 
> never gave me the sense that i could expect that the mode be truly portable.
> one consequence was the modPackage macro in cl-xml, which was implemented to
> distinctly specify whether aspects fo the definition are assertions, or
> additions the the existing state.
> 
> ...
> 
> [0] http://www.lispworks.com/reference/HyperSpec/Body/m_defpkg.htm
From: Lars Brinkhoff
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <85d6cyhna2.fsf@junk.nocrew.org>
···············@yahoo.com (Raghuram) writes:
> Could anybody tell me what is the difference between defpackage Vs
> Makepackage?  Both the methods are used to create a new package. I
> found no difference in both of them, in usage and in parameters.

DEFPACKAGE takes many more parameters than MAKE-PACKAGE.
http://clhs.lisp.se/Body/m_defpkg.htm
http://clhs.lisp.se/Body/f_mk_pkg.htm

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/
From: Kalle Olavi Niemitalo
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <87smlud1d8.fsf@Astalo.kon.iki.fi>
Lars Brinkhoff <·········@nocrew.org> writes:

> DEFPACKAGE takes many more parameters than MAKE-PACKAGE.

Also, a top-level DEFPACKAGE has a compile-time effect.  
With MAKE-PACKAGE, you'd need an explicit EVAL-WHEN for that.
From: Kent M Pitman
Subject: Re: What is difference between Defpackage Vs MakePackage....
Date: 
Message-ID: <wkk76f8ft5.fsf@nospam.nhplace.com>
···············@yahoo.com (Raghuram) writes:

>    Could anybody tell me what is the difference between defpackage Vs
> Makepackage?

MAKE-PACKAGE (note the hyphen; CL does not use StudlyCaps).

>        Both the methods are used to create a new package. I found no
> difference in both of them, in usage and in parameters.

Use DEFPACKAGE to declare a package at toplevel, as you would use
DEFUN to declare a function.

Use MAKE-PACKAGE to create a package dynamically within code as
you would use SETF of SYMBOL-FUNCTION to dynamically assign the
function cell of a symbol.  Both of these situations (using 
MAKE-PACKAGE and using SETF of SYMBOL-VALUE) are rare. The most
common case is as a subprimitive to implement DEFPACKAGE and DEFUN,
respectively.  But there are other uses and you'll know them when
you see them.  If you're unsure, you should probably just avoid 
the subprimitive operator MAKE-PACKAGE for now; stick to DEFPACKAGE
until you suddenly find a reason you cannot use it.  You'll know
when you need MAKE-PACKAGE.