[r6rs-discuss] A different take on libraries
 
> > I think there's another way to go, though. Imagine, for example, that
> > libraries were designed the way that records are. Imagine that there 
was a
> > procedural layer, and that the syntax was built on top of the 
procedural
> > layer.
> 
> I don't think that would work.  Libraries are similar to "lambda" in the 
> sense that they have to control compile-time visibility of bindings. 
This 
> cannot be done with procedures, just like "lambda" cannot be simulated 
with 
> procedures.
With syntax-case procedures can run at compile time, and they can 
manipulate objects in the compile-time environment. If you look at 
portable syntax-case you'll see that that's how module bits are 
implemented. For example, here's the map that adds prefixes to the exports 
of a library followed by the definition of the prefix-adding procedure:
        (map (prefix-add (syntax prefix-id)) exports)
        (define prefix-add
          (lambda (prefix-id)
            (let ((prefix (symbol->string (syntax-object->datum 
prefix-id))))
              (lambda (id)
                (datum->syntax-object id
                  (string->symbol
                    (string-append prefix
                      (symbol->string (syntax-object->datum id)))))))))
So it's workable in some sense.
But there are undoubtedly some deeper concepts that would be better 
expressed in primitive forms. That was kind of my point. The design 
philosophy of Scheme is to identify and address such weaknesses. That's 
why the language has tail calls and continuations; they're building blocks 
that can be used to solve more than just one problem.
Received on Wed Nov 15 2006 - 12:46:33 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:00 UTC