[plt-scheme] SLIB3a4 and DrScheme 360

From: John T. Murphy (jtm at perfectknowledgedb.com)
Date: Tue Dec 5 09:27:18 EST 2006

Hello,

Following John Clements's comments I made a study of how the
slibinit/init.ss file provided with DrScheme differs from the DrScheme.init
file provided with SLIB. Despite a lot of changes in order and formatting,
the DrScheme.init file appears, with only a few small exceptions, to be a
superset of the init.ss file. I'm curious about why the two files have
diverged and whether the plt/DrScheme view would say that there is something
'wrong' with using the DrScheme.init file that SLIB provides. I'm leaning
toward using the DrScheme.init file in lieu of the slibinit/init.ss file; is
there any reason I should not do this?

I've included the results of my comparison below.

Thanks to all (and especially John),
John

Differences between DrScheme.init (provided by SLIB) and slibinit/init.ss
(provided by DrScheme):
----------------------------------------------------------------------------
------------------------------------
Disclaimer: Because of the formating differences, automatic comparison using
windiff wasn't useful; the following relies on my own accuracy with manual
comparison. 

Broadly, the DrScheme.init and slibinit/init.ss files differ in three ways:

1) All of the definitions provided by slibinit/init.ss are duplicated
exactly in DrScheme.init, with only four exceptions:

  a) (define (slib:eval-load <pathname> evl) etc. is not defined in
DrScheme.init; however, a note in DrScheme.init indicates that it is now
defined in require.scm.
  b) (define library-vicinity etc.: the slibinit/init.ss version includes a
directory for RH/Fedora that is commented out in the DrScheme.init file, and
the DrScheme.init file includes a new directory absent from the
slibinit/init.ss file.
  c) (define call-with-input-string is genuinely different in the two files;
I don't understand the code well enough to know if the difference is
significant (I've appended it at the end of this note in case anyone wants
to comment.)
  d) The original problem I encountered: the '*features*' variable in
slibinit/init.ss is redefined to slib:features in DrScheme.init; in
addition, however, the list of features in the DrScheme.init file includes a
few features not found in the slibinit/init.ss file.

2) The DrScheme.init file provides a number of definitions that are not
found in the slibinit/init.ss file at all:

  a) (define vicinity:suffix?
  b) (define (pathname->vicinity pathname)
  c) (define (browse-url url)

3) Finally, the DrScheme.init file closes with:

;;; Previously loaded "/usr/local/lib/plt/collects/slibinit/init.ss"
(cond ((string<? (version) "200")
       (require-library "init.ss" "slibinit"))
      (else
       ;; (load (build-path (collection-path "slibinit") "init.ss"))
       (eval '(require (lib "defmacro.ss")))))

which appears to have once loaded the slibinit/init.ss file, for earlier
versions, but now only requires defmacro.

-----------------------
call-with-input-string differs in the two files slibinit/init.ss and
DrScheme.init:

>From slibinit/init.ss:
(define call-with-input-string
  (lambda (string thunk)
    (parameterize ((current-input-port (open-input-string string)))
      (thunk))))

>From DrScheme.init:
(define call-with-input-string 
  (lambda (string thunk)
    (parameterize ((current-input-port (open-input-string string)))
      (thunk (current-input-port)))))


-----Original Message-----
From: plt-scheme-bounces at list.cs.brown.edu
[mailto:plt-scheme-bounces at list.cs.brown.edu] On Behalf Of John Clements
Sent: Thursday, November 30, 2006 4:35 PM
To: John T. Murphy
Cc: plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] SLIB3a4 and DrScheme 360


On Nov 29, 2006, at 1:07 PM, John T. Murphy wrote:

> Hello,
>
> I am attempting to use SLIB with DrScheme 360. I've downloaded the 
> latest SLIB version, which appears to be 3a4, and installed it as 
> required in my 'collects' directory. I attempt to load it using 
> either:
>
> (require (lib "load.ss" "slibinit"))
>
> or
>
> (load (build-path (collection-path "slibinit") "init.ss"))
>
> or by directly executing the definitions in the file "slibinit/ 
> init.ss"
> which comes with DrScheme. Whatever the method, I receive the 
> following
> error:
>
> ..\..\slib\require.scm::6146: reference to undefined identifier:
> slib:features

The problem is that DrScheme's init.ss file no longer matches the
DrScheme.init file provided with SLIB.

One way to fix this is to change references in slibinit/init.ss to
*FEATURES* into references to 'slib:features'.  Here's the diff:

computer:~/plt/collects/slibinit clements$ svn diff init.ss
Index: init.ss
===================================================================
--- init.ss     (revision 4988)
+++ init.ss     (working copy)
@@ -104,10 +104,10 @@
    (lambda (vic name)
      (path->string (build-path vic name)))) -;;; *FEATURES* should be set
to a list of symbols describing features
+;;; slib:features should be set to a list of symbols describing
features
;;; of this implementation.  Suggestions for features are:
-(define *features*
+(define slib:features
        '(
         source                          ;can load scheme source files
                                         ;(slib:load-source "filename")


... I'm hesitant to commit this change, because it will break compatibility
with earlier versions of SLIB.  One moderately gross solution would be just
to define _both_ of them; I don't know what SLIB's attitude to this would
be.

Caveat: it's certainly possible that other things about SLIB have  
changed since 1997, and that this fix will uncover other problems.   
The larger problem is that the slibinit/init.ss file is not an official part
of SLIB, and is therefore not updated as part of the SLIB project.

Hope this helps,

John Clements




Posted on the users mailing list.