[cl-plus-ssl-devel] naming RAND_bytes wrapper

Anton Vodonosov avodonosov at yandex.ru
Sun May 22 23:08:23 UTC 2011


Hello

08.05.2011, 17:32, "David Lichteblau" <david at lichteblau.com>:
> Quoting Anton Vodonosov (avodonosov at yandex.ru):
>
>>  The same will apply any other function we would want to export from cl+ssl.
>>  There will be a lower level FFI binding and a lispy counterpart.
>
> [...]
>
>>  I am not sure what naming convention to use:
>>
>>   (original -> FFI binding -> lispy version)
>>  1. RAND_bytes -> rand-bytes -> rand-bytes-lispy
>>  2. RAND_bytes -> cl+ssl-ffi:rand-bytes -> cl+ssl:rand-bytes (use separate package for the low level bindings)
>>  3. RAND_bytes -> rand-bytes -> random-bytes (i.e. for every new function make this decision every time, and joose some similar, but different name from the low-level bindind)
>
> Just a couple of thoughts on this:
>
>   - Such questions are hard to answer in full generality without
>     looking at a full list of functions that would be exported.  How
>     much more than RAND_bytes will there be?

Potentially many functions may be useful, like working with x509 certificates,
but actually I only need one function, random-bytes.

>   - Definitely (3) for this particular function. I don't care much which
>     package the helper definition rand-bytes is in or how it's written
>     (we didn't need a special package so far though, right?), but
>     exported functions should have lispy names independent of C code,
>     and RANDOM-BYTES is the perfect Lisp name for this function IMHO.

Why I was thinking about a separate package for FFI, it's because the code:

    (defun random-bytes (count)
       ...
        (rand-bytes ..)
       ..)

is a bit tautological. The reader deals with two similar named function with 
similar purpose and must remember which is what.

With separate package it's more clear:

    (defun random-bytes (count)
       ...
        (open-ssl-ffi:rand-bytes ..)
       ..)

Having a separate package for FFI may be also convenient if you will decide 
sometime (as you plan) to rewrite cl+ssl with iolib. 

Anyway, for now I've put RAND-BYTES and RANDOM-BYTES into the same
CL+SSL package.

The code is committed to Git.

Best regards,
- Anton




More information about the cl-plus-ssl-devel mailing list