[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sockets Layer Counter Proposal

(2012/10/11 5:18), John Cowan wrote:
Shiro Kawai scripsit:

If you don't like all-caps names, I'd suggest to use
a *consistent* rule to convert well-established names
to schemey-names.  E.g. SOCK_STREAM -> *sock-stream*

The cl-posix-generalities page on Cliki has this set of mapping rules:

     A symbol name is derived from the C binding's name, by:

         1) uppercasing, then

         2) replacing underscore (#\_) characters with the hyphen (#\-)

         3) where the fields of a C structure all have a common prefix
         (for example, "st_"), we omit it.

         4) constant names get prefix and suffix '+'s.

     No other changes to "Lispify" symbol names are made, so creat()
     becomes CREAT, not CREATE.

Rule 1 would not be relevant to Scheme, of course.  +...+ names are
valid in R7RS but not in R6RS or earlier.
If I apply the rule to constant variables, let's say AF_INET, is this the right result?

 1) donwcasing (schemey way I guess)
    -> af_inet
 2) replacing #\_ to #\-
    -> af-inet
 3) omit common prefix. here comes my question, in this case `af-'
    looks like a prefix, how should we treat?
   3.1) omit it
     -> inet
   3.2) expand it (more precise name)
     -> address-family-inet or address-family-internet
   3.3) keep it
     -> af-inet
 4) add '*' as both prefix and suffix. (+ is not a valid before R6RS so
    use * instead)
    -> *${result-of-3}*

If we keep name consisted with UNIX, then take 3.3 process. I'm not sure what is the best SRFI way or Scheme way. (I believe not 3.1, though)

Takashi Kato
E-mail: ktakashi@xxxxxxxxx