[Ecls-list] Load and filenames.

Gabriel Dos Reis gdr at integrable-solutions.net
Fri May 30 22:55:39 UTC 2008


On Fri, May 30, 2008 at 11:17 AM, Juan Jose Garcia-Ripoll
<jjgarcia at users.sourceforge.net> wrote:
> On Fri, May 30, 2008 at 6:06 PM, Waldek Hebisch
> <hebisch at math.uni.wroc.pl> wrote:
>> Apparently, if file extension is unknown to 'load' it treats file
>> as a Lisp file.  It would be nice if 'load' could decide file type
>> based on content...
>
> Simply put, I do not know how to code this in a portable way. Seems
> like one should track all the magic file IDs of binary files on all
> platforms where ECL could potentially be built.
>
> Hmm, the only serious alternative I can think of is using the Unix
> command "file" and interpreting its output to decide whether the
> binary is executable (and hence fasl) or text (and hence potentially
> lisp source).

Another alternative is to:
  (1) try whether  bar.fas exists.  If yes, load it as FASL.
  (2) otherwise, see if bar.lisp exists, if yes load it as a Lisp source file.
  (3) otherwise load bar as a lisp source file.

-- Gaby




More information about the ecl-devel mailing list