Subject: Re: Obtaining the case preserved name of a macro
From: (Rob Warnock)
Date: 1998/12/02
Newsgroups: comp.lang.lisp
Message-ID: <74370o$>
Erik Naggum  <> wrote:
| * (Rob Warnock)
| | Even better, the macro could invoke (at compile time, of course)
| | a routine that converted the external name to *whatever* your
| | preferred Lisp name was, with rules as complicated as you like,
| | e.g. (defexternal |XtGetMultiClickTime| ...) could define a Lisp
| | name of external::xt-get-multi-click-time, or whatever.
|   I have never quite understood the desire to treat Common Lisp symbols as
|   somehow intrinsically related to symbol names in any foreign language.

Well, the situation that prompted my comment was wanting to automatically
generate a *huge* number of "defexternal"s, without having to manually
invent & type a Lispy name for each external case-sensitive name.

|   in my view, a more Lispy symbol name makes sense while a C-like symbol
|   name (including case hypersensitivity) does not, the latter just being a
|   string to Lisp, so I would prefer something along these lines:
| (defexternal (xt::get-multi-click-time "XtGetMultiClickTime") ...)

That's fine, and I agree that any reasonable "defexternal" *should* require
both a Lisp symbol and a string for the C name.  But if you have a *large*
number of external names that happen to obey some reasonably consistent
construction rule(s), why not save work by creating a macro that constructs
the (case-insenstive) Lisp name from the (case-sensitive) C name for you
automatically? Something like:

    (defmacro defexternal-autotrans (string &rest body)
      `(defexternal (,(my-c-name-to-lisp-name string) ,string) ,@body))
    (defexternal-autotrans "XtGetMultiClickTime" ...)

Saves typing, avoids typos, etc.

You can still use the underlying 2-arg form if/when your name-mangler
runs into trouble...


Rob Warnock, 8L-855
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-964-0811
Mountain View, CA  94043	PP-ASEL-IA