2007/8/11, Ludovic Courtès <[EMAIL PROTECTED]>:
> I'd like to fix the SLIB issue in 1.8.3.
>
> SLIB 3a4 works perfectly well with 1.8.  The thing is that `(ice-9
> slib)' is of no use.

It's of no use since no-one has added the functions which Aubrey have
added to guile.init when changing slib:s interface to the interpreter.
 Adding those function is, however, an easy thing to do.  I'm not sure
that the diff I've included is appropriate for the latest slib, but it
could very well be.

Apart from providing a more natural division regarding what belongs to
Guile and what belongs to slib, slib.scm makes sure that each time
some module requires new slib code, it will be loaded into the module
(ice-9 slib) and exported from there.  I'm not at all sure that
guile.init does that, and if it doesn't it will lead to strange
behavior:

If Guile module A requires some slib feature F1, and, later, a totally
unconnected Guile module B requires slib feature F2, which depends on
F1, the loading of F2 may or may not lead to a reload of F2 into
module B (depending on how guile.init has been implemented).  If it
leads to a reload, code will be duplicated in modules A and B.  If it
doesn't load to a reload, F2 won't find the feature F1 which it
requires, since it exists in module A.

Are you sure that your suggested slib.scm doesn't have any of the
above two problems?
Index: slib.scm
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ice-9/slib.scm,v
retrieving revision 1.46
diff -r1.46 slib.scm
73a74,145
> ;;; (software-type) should be set to the generic operating system type.
> ;;; UNIX, VMS, MACOS, AMIGA and MS-DOS are supported.
> (define software-type
>   (if (string<? (version) "1.6")
>       (lambda () 'UNIX)
>       (lambda () 'unix)))
> 
> (define (user-vicinity)
>   (case (software-type)
>     ((vms)	"[.]")
>     (else	"")))
> 
> (define vicinity:suffix?
>   (let ((suffi
> 	 (case (software-type)
> 	   ((amiga)				'(#\: #\/))
> 	   ((macos thinkc)			'(#\:))
> 	   ((ms-dos windows atarist os/2)	'(#\\ #\/))
> 	   ((nosve)				'(#\: #\.))
> 	   ((unix coherent plan9)		'(#\/))
> 	   ((vms)				'(#\: #\]))
> 	   (else
> 	    (warn "require.scm" 'unknown 'software-type (software-type))
> 	    "/"))))
>     (lambda (chr) (and (memv chr suffi) #t))))
> 
> (define (pathname->vicinity pathname)
>   (let loop ((i (- (string-length pathname) 1)))
>     (cond ((negative? i) "")
> 	  ((vicinity:suffix? (string-ref pathname i))
> 	   (substring pathname 0 (+ i 1)))
> 	  (else (loop (- i 1))))))
> 
> (define (program-vicinity)
>   (define clp (current-load-port))
>   (if clp
>       (pathname->vicinity (port-filename clp))
>       (slib:error 'program-vicinity " called; use slib:load to load")))
> 
> (define sub-vicinity
>   (case (software-type)
>     ((vms) (lambda
> 	       (vic name)
> 	     (let ((l (string-length vic)))
> 	       (if (or (zero? (string-length vic))
> 		       (not (char=? #\] (string-ref vic (- l 1)))))
> 		   (string-append vic "[" name "]")
> 		   (string-append (substring vic 0 (- l 1))
> 				  "." name "]")))))
>     (else (let ((*vicinity-suffix*
> 		 (case (software-type)
> 		   ((nosve) ".")
> 		   ((macos thinkc) ":")
> 		   ((ms-dos windows atarist os/2) "\\")
> 		   ((unix coherent plan9 amiga) "/"))))
> 	    (lambda (vic name)
> 	      (string-append vic name *vicinity-suffix*))))))
> 
> (define with-load-pathname
>   (let ((exchange
> 	 (lambda (new)
> 	   (let ((old program-vicinity))
> 	     (set! program-vicinity new)
> 	     old))))
>     (lambda (path thunk)
>       (define old #f)
>       (define vic (pathname->vicinity path))
>       (dynamic-wind
> 	  (lambda () (set! old (exchange (lambda () vic))))
> 	  thunk
> 	  (lambda () (exchange old))))))
> 
204a277,278
> (define slib:features *features*)
> 
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to