home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / mcl / 1293 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  3.5 KB

  1. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!cfry@MIT.EDU
  2. From: cfry@MIT.EDU (Christopher Fry)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re:  LISP FFI to C
  5. Message-ID: <9208211757.AA10824@MIT.EDU>
  6. Date: 21 Aug 92 18:15:20 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 53
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: moon@cambridge.apple.com (David A. Moon)
  11. Original-Cc: cfry@MIT.EDU (Christopher Fry), Bruce Lester <72110.1107@CompuServe.COM>,
  12.         info-mcl@cambridge.apple.com, kgrant@us.oracle.com, york@lucid.com,
  13.         jonl@lucid.com, swm@scrc.symbolics.com, rwk@crl.dec.com
  14.  
  15. > Date: Fri, 21 Aug 92 11:06:49 EDT
  16. > From: moon@cambridge.apple.com (David A. Moon)
  17. > To: cfry@MIT.EDU (Christopher Fry)
  18. > Subject: Re:  LISP FFI to C
  19. > Cc: Bruce Lester <72110.1107@CompuServe.COM>, info-mcl@cambridge.apple.com,
  20. >         kgrant@us.oracle.com, york@lucid.com, jonl@lucid.com,
  21. >         swm@scrc.symbolics.com, rwk@crl.dec.com
  22. > > Date: Thu, 20 Aug 92 23:37:23 EST
  23. > > From: cfry@MIT.EDU (Christopher Fry)
  24. > > 
  25. > > Could it be arranged such that the CL function LOAD recognized when it was passed
  26. > > a C object file, a C header file, or a lisp file and did the right thing?
  27. > Implementation-dependent, obviously.  On the Macintosh, object files for C (and all 
  28. > other MPW-based static languages) are self-identifying, but on other systems it 
  29. > might not be possible to distinguish a C object file from some other kind of file.  
  30. > At the other extreme, on Symbolics Genera a Lisp object file and a C object file are 
  31. > in identical formats and loaded identically, and I imagine this is true in KCL as 
  32. > well.
  33. > There is no good, portable way to tell a C source file from a Lisp source file, 
  34. > especially if the Lisp user has modified the readtable.  However, there might be 
  35. > some bad ways, such as assuming that "(in-package" not preceded by a { is unlikely 
  36. > to be valid C.
  37. > If you want this additional feature that the programmer doesn't have to know what 
  38. > language things are written in to load them, that would create some additional 
  39. > things that the vendors would need to agree on in order to create a standard.
  40. Proposal: add a keyword to LOAD called :FILE-KIND indicating the possible file
  41. kinds for the file being loaded.
  42. It would take symbols:
  43. :lisp-source, lisp-compiled, c-source, c-compiled, etc.
  44. [note I've avoided the word "object" because of the ambiguity with object-oriented 
  45. programming]
  46. or a list of the same.
  47. We could also have :lisp stand for (:lisp-source :lisp-compiled)
  48. Likewise for other languages.
  49. The default value for the keyword would be :lisp [indicating just the current behavior.
  50. Vendors would be required to support :lisp but not the other lnaguages.
  51. However if they do support he other languages, they would be encouraged to 
  52. conform to this guideline.
  53.  
  54. If kind :c-source file is passed, it could either be a header file or the actual c source. 
  55. If the actual c-source is passed, only the "header" info would be extracted. You'd still 
  56. have to pass in the c-compiled. [Well I suppose some eager hacker could pass the
  57. c-source to a c compiler and generate the .o file then load it.]
  58.  
  59. :FILE-KIND might also take another special value, :GUESS-FROM-NAME
  60. In the C world, I believe types of .h, .c, and .o are at least very common.
  61. .l, .lsp, .lisp, .fasl, .fsl and maybe a few others ought to cover all the lisp
  62. cases. If file names turn out to be unambiguous enough, :GUESS-FROM-NAME could even
  63. be the default value for :FILE-KIND.
  64.