English 中文(简体)
Is there a common lisp package naming convention?
原标题:

I have created some of my own user packages and have run into a name clash.

In Java, the naming convention is to use your domain name in the package name: e.g. import com.example.somepackage;.

Are there any widely used package naming conventions for common lisp packages?

Regards,

Russell

最佳回答

The convention I use is to use a unique word: salza, skippy, zs3, etc. I don t really try to have a direct relationship to the library functionality. I try to avoid generic words that others might use like "zlib" or "zip" or "png".

Edi Weitz uses Frank Zappa-related words to name many of his packages: Hunchentoot, Drakma, etc.

Some people use Java-style org.foo.bar reversed domain naming.

So, the direct answer is no, there isn t a common, agreed-upon convention that everyone uses.

问题回答

One convention that you see sometimes is packages which provide a thin compatibility wrapper over routinely implemented but non-standardized functionality are often called TRIVIAL-SOMETHING.

This leads to some really wonderful names: the library for working with *FEATURES* in a implementation-independent way is called TRIVIAL-FEATURES; even better, the library for interacting with the garbage collector in a standardized way is called TRIVIAL-GARBAGE.

There s no general convention, but there are a few patterns:

  1. When the library is a port from some other language, a wrapper or an interface library it is often prefixed with cl-, like cl-gtk2 or cl-ppcre. Although there was a time, when this prefix got abused, and there are a lot of packages (e.g. cl-who), that implement a unique functionality, but still use it.
  2. If the package is implementation-specific, it s prefixed with implementation shorthand (most notably: sb-), like sb-queue or lw-compat.
  3. If the package is a compatibility layer between implementations, it is often prefixed with trivial-, like trivial-backtrace or trivial-garbage
  4. There s also s- prefix, which may stand for symbolic , like s-xml, but it s rarely used.

These prefixes help making the name of the package unique and thus simplify finding information about it on the web.

Otherwise there are no specific conventions, but the general rule is to favor short, unique and, probably, descriptive names. For the reasons of ease of remembering, usage and finding information.

If the package happens to have a long name it s handy to provide a shorter nickname, because more often, than not people will use package s symbols qualified by their names. For example in my code I add a nickname re to cl-ppcre, and it makes the client code much more understandable and clear. Although caution should be applied, so that nicknames didn t cause name-conflicts.





相关问题
Lisp code called from Java

Long story: I am doing a project for my functional programing class, and I thought of writing an AI controller in Lisp, for the Mario AI competition. I was looking over frameworks/libraries/ways of ...

Emacs, Zen-Coding mode, and Putty

I use emacs via Putty and since Putty doesn t send certain key combinations to the remote console I generally need to re-bind them to other key combinations. After installing the amazing Zen-Coding ...

In Which Cases Is Better To Use Clojure? [closed]

I develop in Lisp and in Scheme, but I was reading about Clojure and then I want to know, in which cases is better to use it than using Lisp or Scheme? Thanks

lambda-gtk negative pointer

I was trying to write my own put-pixel on (Gdk) pixbuf in Lisp. When I finally realized how I can operate on C pointers in CL, new obstacle came along - (gdk:pixbuf-get-pixels pb) returns me negative ...

Is there a common lisp package naming convention?

I have created some of my own user packages and have run into a name clash. In Java, the naming convention is to use your domain name in the package name: e.g. import com.example.somepackage;. Are ...

SOAP request from within an AutoLISP/AutoCAD macro

We have built a webservice for a client that uses AutoCAD. They have a macro that runs in AutoCAD that builds a SOAP request. But they have not figured out how to actually send() the soap request to ...

热门标签