Lisp HUG Maillist Archive

defpackage and defined-package-name

Hello -

In the LW docs it is said for defpackage:

Signature
defpackage defined-package-name [[ option ]] => package 

Where defined-package-name is "a string".

In CLHS it is said that "defined-package-name --- a string designator".

So, should I use strings for package-name or string designators would be ok (what seems to me "the rest of cl world" is using).

Best,
 Art


Re: defpackage and defined-package-name

Unable to parse email body. Email id is 11188

Re: defpackage and defined-package-name

Hello Nick -

Do you know the history behind using string-representation instead of just strings or just symbols? And why do people use non-interned keywords (I see the use of non-interned keywords a lot, and to my eyes it looks strange)?

I'm asking you because as I understand you know a lot about CL and have been around CL quite some time (since its inception?).

Best,
 Art

> It's a matter of individual preference: you'll see quite a
> lot of both
> (in-package "FROB") and (in-package frob). Possibly also
> (in-package #:frob) although personally I have a hearty
> dislike for this one.


Re: defpackage and defined-package-name

.... just my 2c, but using capitalized strings instead of symbol arguments for package names is somewhat fraught with difficulties in the face of variable default character case. 

A good example of this arose in the Qi compiler, where use was made of explicit character case in symbol naming. By using a keyword symbol (interned or not), you allow the Lisp system to perform correct case conversion for you, whatever that happens to be at the time of use. A capitalized string may have to be capitalized everywhere the package name is used. (Allegro opens this Pandora's box too...)

Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750

email: dbm@refined-audiometrics.com
phone: 1.520.529.2437
web: http://refined-audiometrics.com



On Aug 23, 2011, at 09:09, Art Obrezan wrote:

> 
> Hello Nick -
> 
> Do you know the history behind using string-representation instead of just strings or just symbols? And why do people use non-interned keywords (I see the use of non-interned keywords a lot, and to my eyes it looks strange)?
> 
> I'm asking you because as I understand you know a lot about CL and have been around CL quite some time (since its inception?).
> 
> Best,
> Art
> 
>> It's a matter of individual preference: you'll see quite a
>> lot of both
>> (in-package "FROB") and (in-package frob). Possibly also
>> (in-package #:frob) although personally I have a hearty
>> dislike for this one.
> 
> 


Re: defpackage and defined-package-name

On Aug 23, 2011, at 10:09 AM, Art Obrezan wrote:
> [...]  And why do people use non-interned keywords (I see the use of non-interned keywords a lot, and to my eyes it looks strange)?

Hi Art,

For myself, I use non-interned symbols for compatibility with Allegro's case sensitive mode. I could
use interned symbols (in either the current package or the keyword package), but since I there isn't a 
need to intern them, I don't.

I suppose it's a matter of style and taste. Some people prefer setf for all setters 
consistency sake, whereas I prefer using setq when possible to document that the assignment 
doesn't need the additional capabilities of setf.

Kevin


Re: defpackage and defined-package-name

On 23 Aug 2011, at 17:09, Art Obrezan wrote:

> Do you know the history behind using string-representation instead of just strings or just symbols? And why do people use non-interned keywords (I see the use of non-interned keywords a lot, and to my eyes it looks strange)?

One reason may be that Allegro has what they call "modern mode" which is essentially case-sensitive lower-case-preferred (so the default case of symbol names is lower case: (symbol-name 'car) is "car").  If you want to write code which will work seamlessly in CL, as well as this variant of it, the easiest way is to use symbols as for things like package names, because then the reader will create a package with the appropriate name automatically.  Things like that can also be the case if people use weird reader modes in CL.

I think the uninterned-symbol thing is because people get obsessive about package clutter.  I used to do that but now compromise on keyword symbols because it's so ugly (I still feel queasy about leaving lots of detritus in CL-USER which is where it often ends up).  Once there were implementations (Interlisp-D) where it might have been right to worry a bit about using up all the symbols, as it only had 16-bits worth.

Re: defpackage and defined-package-name


On Aug 24, 2011, at 5:21 AM, Marco Antoniotti wrote:

> 
> Why, o why, people decided to have ANSI CL default to uppercase, case-insensitive remains one of the greatest mysteries of all time.
> 

Because that's the way Lisp has been since 1958. There was no lowercase back then.

Sent from my iMac :-)



Re: defpackage and defined-package-name

Unable to parse email body. Email id is 11200

Updated at: 2020-12-10 08:37 UTC