guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(


From: Neil Jerram
Subject: Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(
Date: Thu, 14 Aug 2014 20:42:42 +0100
User-agent: Roundcube Webmail/0.9.5

On 2014-08-14 11:27, Taylan Ulrich Bayirli/Kammer wrote:
Neil Jerram <address@hidden> writes:

I wonder about possibly having some magic that would automatically
match certain top-level forms and evaluate them at compile time.  The
case for this for 'define-reader-ctor' feels quite strong.  For the
load path case, it feels too hacky to try to recognize patterns like
(set! %load-path (append %load-path ...))', but perhaps OK if we
defined an 'add-to-load-path' procedure and applied the magic to that.

We already have an 'add-to-load-path' syntax.  That way it doesn't need
any special magic since it can just expand to an `eval-when' usage

Ah, good, thanks for pointing that out.

but
apparently for some reason it doesn't do that at the moment (2.0.11):

scheme@(guile-user)> ,expand (add-to-load-path "foo")
(set! (@@ (guile) %load-path)
      ((@@ (guile) cons) "foo" (@@ (guile) %load-path)))

Taylan

I'm not sure what that demonstrates. add-to-load-path _does_ appear to work for me as hoped (and documented) when used in a situation like that of the recent ossaulib thread - i.e. where a top level script wants to extend the load path and then load modules from there:

-----------ctest.scm------------
(define-module (ctest)
  #:export (square))

(define (square x) (* x x))
-----------ctest.scm------------

-----------ctst.scm------------
(add-to-load-path "/home/neil")
(use-modules (ctest))
(display (square 5))
(newline)
-----------ctst.scm------------


address@hidden:~$ guile -s ctst.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/neil/ctst.scm
;;; compiling /home/neil/ctest.scm
;;; compiled /home/neil/.cache/guile/ccache/2.0-LE-8-2.0/home/neil/ctest.scm.go ;;; compiled /home/neil/.cache/guile/ccache/2.0-LE-8-2.0/home/neil/ctst.scm.go
25

Regards,
     Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]