Article View: comp.windows.x
Article #24930X atoms, a poll
From: Fahlman
Date: Fri, 13 Feb 1987 20:27
Date: Fri, 13 Feb 1987 20:27
52 lines
2964 bytes
2964 bytes
So the C symbols named "BitMap",
"PointSize", and "StrikeoutAscent" become ":bitmap", ":pointsize", and
":strikeoutascent". That's a bit ugly, but workable ...
An alternative approach is to automatically insert a hyphen whenever the
C version has an upper-case character that is not at the start of the
word...
The first approach is not only ugly, but doesn't work, and I'm not sure
the second is reversible in the sense I had in mind. Note there is no
static interface between C and Lisp here, as there is in Matchmaker.
When a Lisp programmer wants to store a property, s/he doesn't want to
have to declare a binding to some C programmer's naming convention; the
whole point is to reduce the burden, not increase it. When reading a
list of window properties out of a server, you don't know what language
created them. For an automatic keyword<->atom mapping to work, every
distinct X atom must have a distinct Lisp keyword, and which also means
every distinct Lisp keyword must have a distinct X atom.
I don't understand this. Why does it matter whether the interface is
static or dynamic? When a new "atom" is created, both the Lisp and C
spellings are registered in a hash table somewhere. (Under either of my
proposals, you could register the C spelling and generate the Lisp
spelling automatically from it.) In a Lisp program you will always see
the Lisp version; in a C program, you will always see the C version. If
an "atom" is passed across the Lisp-to-C interface, part of that process
is name-conversion of any atoms.
Are you suggesting that programmers will want to make up new atom-names
on the fly and then pass them back and forth between Lisp and C without
first registering these atoms somewhere? If atoms must be registered
with C (in order to be assigned a canonical identifier), the Lisp
version of the name can be created and registered at that time.
As seen from the Lisp side, it would be something like
(register-x-atom "FooBar" "BiteTheBaggie" "FlyingWombat")
=> (:foobar :bitethebaggie :flyingwombat)
(call-some-x-routine :foobar :bitethebaggie)
=> :flyingwombat
... or ...
(register-x-atom "FooBar" "BiteTheBaggie" "FlyingWombat")
=> (:foo-bar :bite-the-baggie :flying-wombat)
(call-some-x-routine :foo-bar :bite-the-baggie)
=> :flying-wombat
-- Scott
Technical Details
Message-ID:
<FAHLMAN.12278786314.BABYL@C.CS.CMU.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!C.CS.CMU.EDU!FahlmanShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!C.CS.CMU.EDU!Fahlman From: Fahlman@C.CS.CMU.EDU.UUCP Newsgroups: comp.windows.x Subject: X atoms, a poll Message-ID: <FAHLMAN.12278786314.BABYL@C.CS.CMU.EDU> Date: Fri, 13-Feb-87 15:27:00 EST Article-I.D.: C.FAHLMAN.12278786314.BABYL Posted: Fri Feb 13 15:27:00 1987 Date-Received: Sat, 14-Feb-87 14:21:52 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 52