On Tue, 2009-10-13 at 17:03 -0400, John Cowan wrote:
> Ray Dillinger scripsit:

> IOW, import is like R5RS define-syntax; you can't just put it anywhere
> you please.

I dunno.  I would like to use it like this, treating it simply as 
a binding form and processing it at runtime like any other binding 
form. I feel the same way about define-syntax, BTW.  

(define foo 
   (lambda (arg1 arg2 ...)
      (import "some lib")
      ... code that uses "some lib" ...
   ) ;; end of the lambda and scope of the import
)

If the function is never actually executed, then "some lib" is never
imported and its absence on the system would not be an error.  

Similarly, I would use a runtime form such as 

(if (module-available? "foo") 
    (import foo) 
    (begin
       ..... define a bunch of stuff that foo would otherwise bind .....
    ))

at top level to do a conditional import. 

This approach (import as a runtime binding form) completely 
eliminates the need for additional machinery such as cond-expand 
etc, which can be WG2-only. All WG1 needs is a general, runtime 
import procedure (not syntax) and a module-available? predicate. 

> > > 5) Imports or macros that expand into them anywhere, including
> > > embedded in other forms.
 
> > I think that this was what I proposed; import as a binding form with 
> > lexical scope, usable anywhere a binding form may be used.  

> Yes, that's what you proposed.  However, I think this is too flexible for
> WG2 Scheme, and I strongly want WG2 Scheme to be a superset of WG1 Scheme.

This is a fundamental tension between WG1 and WG2, I think.  For WG1 
we want the ultra-simple language we can get by removing all the 
restrictions and treating everything orthogonally.  For WG2, you want
the restrictions for the sake of static reasoning/discoverability/etc, 
and therefore need a bunch of additional complications not needed in 
(but probably compatible with) WG1.  

So I see it as rather the other way 'round, where the semantics of 
WG2 forms should be a proper subset or restriction of the semantics of 
WG1 forms, but WG2 also provides the additional machinery needed to 
deal with those restrictions.  Any use of the forms compatible with 
WG2's requirements should mean the same thing in a WG1 scheme. EG, 
if I take my ultra-general "import" form and use it only in ways 
WG2 scheme allows, then it should have the same semantics as in WG2. 
But the additional machinery required to deal with the inability 
to use such forms in any *other* way might or might not be implemented
on a WG1 scheme. 

WG2 scheme, with such semantic restrictions, can never be a superset 
of WG1 scheme in the semantic sense.  If the additional machinery
specified by WG2 is implemented, a WG1 scheme could be a superset 
of WG2.  But if the forms are fully general, it would still be a WG1 
scheme, and therefore allow users to use the simple language arising 
from lack of restrictions, ignoring the additonal or redundant
machinery.

                                Bear



_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to