unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Mikael Djurfeldt" <mikael@djurfeldt.com>
To: "Ludovic Courtès" <ludo@gnu.org>, guile-devel@gnu.org
Subject: Re: SLIB
Date: Sat, 11 Aug 2007 19:00:08 +0200	[thread overview]
Message-ID: <66e540fe0708111000v22662b54sc62a9b297bf6308e@mail.gmail.com> (raw)
In-Reply-To: <878x8icngm.fsf@chbouib.org>

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

2007/8/11, Ludovic Courtès <ludo@gnu.org>:
> 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?

[-- Attachment #2: slib.scm.diff --]
[-- Type: text/x-patch, Size: 2472 bytes --]

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*)
> 

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

  reply	other threads:[~2007-08-11 17:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 11:36 SLIB Ludovic Courtès
2007-08-11 17:00 ` Mikael Djurfeldt [this message]
2007-08-15 23:05   ` SLIB Kevin Ryde
2007-08-16  8:24     ` SLIB Mikael Djurfeldt
2007-08-16 22:43       ` SLIB Kevin Ryde
2007-09-03  0:42         ` SLIB Rob Browning
2007-09-03  7:22           ` SLIB Ludovic Courtès
2007-09-04  5:23             ` SLIB Rob Browning

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=66e540fe0708111000v22662b54sc62a9b297bf6308e@mail.gmail.com \
    --to=mikael@djurfeldt.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@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).