20090327

Maybe a bug? Some considerations.

Hello,

I just bumped into this while trying to load MEL-BASE into LW. The library has a file 'environment.lisp' which contains the following code.

#+openmcl
(defun gethostname ()
  "Returns the hostname"
  (ccl::%stack-block ((resultbuf 256))  
    (if (zerop (#_gethostname resultbuf 256))
      (ccl::%get-cstring resultbuf)
      (error "gethostname() failed."))))
As we know, OpenMCL, its predecessors, and its successors, define #_ as areader macro to call up system functions.

Now, LW (M 5.x) barfs on this, because it tries to READ the DEFUN in order to discard it.

I do not know if this is a bug or not (I have not checked), but it reinforced my preference for code organization, where I relegate implementation dependencies in separate files. I.e., I do not write a file like 'foo.lisp' and pepper it with a lot of #+, #-. I would relegate such system dependencies in a ccl.lisp (or a cmucl.lisp) file, and I would conditionally include the file in the .asd or .system file. This way I feel I have more control over system dependencies, and I do not incur in snag like the #_ one.


(cheers)