This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Translators/source language detection



> As to source language detection:
> I think two methods of detection that came out make sense.  First,
> looking for a certain kind of string in the first like, like -*- Python
> -*-.  Second, looking at the extension.  The first is necessary when a
> piece of software has a hardcoded file location, like
> ~/.someapp/prefs.scm.  The user should still be able to write this file
> in whatever language they desire.  Second, if a translator ever gets
> that far, it would be nice to take unmodified source from another
> language and load it into Guile, so that (load "somecode.py") would work
> cleanly.

I think the first method shouldn't be necessary.  You should never
have a file with a name ending in .scm that contains Python code;
that's just way too confusing.

Emacs lets you say things like (load "foo"), and it'll pick up
"foo.el", "foo.elc", or whatever's available.  Guile module names
require some similar logic too, since they don't specify the file name
extension: (ice-9 regex) gets you ice-9/regex.scm.

So I think Guile should have a function (generic-load "FOO"), that
tries different extensions and chooses a translator appropriately.
Then we can use that for loading .guile files, ~/.someapp/prefs, and
so on.

Why not just redefine `load'?  Because R5RS says that it loads Scheme
expressions from the named file.  Not a lot of room for searching for
other related filenames, etc.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]