unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Auto compile from many different languages that interoperates with guile
Date: Fri, 1 Sep 2017 22:45:55 +0200	[thread overview]
Message-ID: <CAGua6m17J=UShF2OqFxZn-1doOK7HoeFV8O0H6SSDx+zMSJ6KA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]

Hi,

I am maintaining a prolog->scheme compiler and a python->scheme compiler.
The nice thing with those implementation is that they work well with the
guile module system and are proper scheme functions and variables etc. So
python objects can be treated as goops objects and prolog predicates can be
used in kanren etc.

There is a headake though. When loading a module from one language to
another language the autocompilation fails. It would be nice to load a
python module and work with it from scheme land and vice versa.

One problem is the following funciton in system base compile

(define* (compile-file file #:key
                       (output-file #f)
                       (from (current-language))
                       (to 'bytecode)
                       (env (default-environment from))
                       (opts '())
                       (canonicalization 'relative))
...)

form is either specified or current-language and what I propose is to add a
knob that enables another version of the default for from e.g. something
like the following.

(define %extension-map '((("py" "python") python) ((("pl" "prolog") prolog)
(("scm") scheme)))
(define %use-extension-map #f)
(define (default-from-file file)
  (define default (current-language))
  (if %use-extension-map
       (let* ((ext   (get-extension file))
               (lang  (find-language ext %extension-map)))
           (if lang lang default))))

(define* (compile-file file #:key
                       (output-file #f)
                       (from (default-from file))
                       (to 'bytecode)
                       (env (default-environment from))
                       (opts '())
                       (canonicalization 'relative))

...)

I think that we already have variables that discovers the source files that
guile can compile and I don't think that we should get name clashes as long
as we use the prefix (languge prolog module) as a prefix for modules in
other languages than scheme.

WDYT

[-- Attachment #2: Type: text/html, Size: 2764 bytes --]

             reply	other threads:[~2017-09-01 20:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 20:45 Stefan Israelsson Tampe [this message]
2017-09-02 13:00 ` Auto compile from many different languages that interoperates with guile Matt Wette
2017-09-02 13:03   ` Matt Wette
2017-09-08  1:39 ` William ML Leslie
2017-09-08  1:52   ` William ML Leslie
2017-09-08 22:25 ` Stefan Israelsson Tampe
2017-09-09  1:33   ` William ML Leslie
2017-09-09 14:24 ` Stefan Israelsson Tampe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGua6m17J=UShF2OqFxZn-1doOK7HoeFV8O0H6SSDx+zMSJ6KA@mail.gmail.com' \
    --to=stefan.itampe@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).