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

199.22



The exp-tagged code in CVS for MzScheme and MrEd is now version 199.22.

The changes are significant:

 * Changed `define-struct' so that it can cooperate with other
   syntactic forms, such as `match' and `shared'.

   In addition to the old bindings,

      (define-struct <id> (<field-id> ...))

   now binds <id> to expansion-time information about the declaration,
   and the sub-typing form is now

      (define-struct (<id> <super-id>) (<field-id> ...))

   where <super-id> is the <id> from a previous `define-struct' ---
   not an expression that produces a structure type descriptor.

   The changes break old code in several ways:

     - The binding for <id> might collide with other definitions.

     - Sub-typing declarations must be changed, usually by deleting
       `struct:'.

   The new `define-struct' is slightly less powerful than the old one,
   though in ways that are unlikely to matter. For example, the new
   form cannot extend a structure type descriptor that is passed into
   a procedure.

   The advantage of the change is that forms like `match' and `shared'
   can work properly with structures. For example, given the
   declarations

     (define-struct a (x y))
     (define-struct (b a) (z))

   The expression

     (match .... [($ a pat) ....])

   is a syntax error, because the structure type `a' has two
   fields. But

     (match .... [($ a pat1 pat2) ....])
     (match .... [($ b pat1 pat2 pat3) ....])

   both work, and the structure types need not be declared as
   "transparent" (through a dummy inspector).
   
   The `struct' module export form exports the <id> binding as well as
   the old ones, so that sub-typing declarations and `match' forms
   work across module boundaries.

   The `struct' signature form for `unit/sig' introduces
   expansion-time information into importing units that immitates that
   of a `define-struct' declaration. The information is currently
   limited, in that subtyping relations are not exposed and the actual
   structure type may have more fields than declared in the
   signature. But `match' works with the partial information, for
   example, matching on as many fields as declared in the signature.

 * Changed loading to distinguish normal loads from module loads.

   When `require' triggers a load to get a module definition, the
   loaded file must contain a single `module' expression with the
   expected name, otherwise a helpful error message is reported. (The
   constraint on the file shape was always specified, but not directly
   enforced.)

   In addition, `module' in the loaded file is always mapped to the
   primitive `module' form, independent of the `module' binding of the
   current namespace. (Thus, loading a file from source reliably
   mimics loading a compiled version of the file, and vice-versa.)

   A load handler or load extension handler now takes two argument
   instead of one: the filename and the expected module name. The
   expected module name is either a symbol, indicating that a module
   declaration is expected, or #f, indicating that the file need not
   contain a module (though it may). If the expected name is a symbol,
   the handler is responsible for checking that the file actually
   contains a `module' declaration, and for mapping the loading
   `module' identifier to the primitive `module' form.

   Inside MzScheme: an extension is now obliged to define
   scheme_module_name(), in addition to scheme_initialize() and
   scheme_reload(). The scheme_module_name() function should return a
   module name symbol if the extension declares a module, #f
   otherwise.

 * `define-syntax' is now allowed within `class' and `unit' bodies,
   analogous to embedded `define-syntax'.  However, local macros in
   `class' cannot currently expand to procedure expressions that serve
   as methods.

 * EXPERIMENTAL: Added `#cs' and `#ci' prefixes for controlling
   case sentivity during `read'. The sequence `#cs' can be used as a
   prefix for any expression to make symbols within the expression
   case-sensitive.  The `#ci' prefix similarly makes symbols
   case-insensitive. For example,

      #cs(Apple #ciBanana Coconut)

    is the same as

     (|Apple| |banana| |Coconut|)

    whether `read-case-sensitive' is set to #f or #t.

    For example, `#cs' can be used in front of a `module' expression
    so that the module body is implemented in a case-sensitive
    variant of MzScheme:

     > #cs(module m mzscheme (define Foo 1) (define foo 2) (provide foo Foo))
     > (require m)
     > foo
     2
     > |Foo|
     1

 * Removed the cursor% constructor that takes a filename (it never
   worked on any platform), and added a constrcutor that takes image
   and mask bitmaps, 16x16 monochrome.

 * `unit/sig' struct type changed to `signed-unit' to aviod conflicts
   (though it's not clear that the structure type needs to be exposed
   anymore, anyway).

 * Changed result of `identifier-binding' in the module case. It's now
   a list of four elements, including the "nominal" source module and
   its export name for the identifier.

 * Changed 'origin tracking so that starts with the empty and adds new
   identifiers to the front of the list. See the manual for details.

 * Added `cons-immutable', `list-immutable', and `list*-immutable', 
   and removed `pair->immutable-pair'.

 * Added `compiled-module-expression?' and `module-compiled-name'.

The MzScheme, MzLib, MrEd, mzc, and Inside MzScheme doc bundles have
been updated. The MzLib documentation now includes complete
documentation for `match'.

Matthew