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

import suggestion

This page is part of the web mail archives of SRFI 83 from before July 7th, 2015. The new archives for SRFI 83 contain all messages, not just those from before July 7th, 2015.



Instead of having an import bind multiple libraries, e.g.

(import "balloon"
            (only "stack" push! pop!)
            ...)

I suggest that import should work an only a single library at a time. 
The reason is that the <import-set> specifies the library and at most 
single special action (only, rename, add-prefix, etc.) What happens if 
you need to do multiple actions for a library, e.g.

(import (only "stack" push! pop!)
            (add-prefix "stack" stack:)
            (rename "stack" (clear! empty!))

This could have a well-defined meaning (e.g. one gathers all "stack" 
related clauses to process them in aggregation), but it seems 
unnecessary, complex, and confusing to keep respecifying "stack"

What we want to say is "I am importing stack, and that also involves a 
subset, a prefix addition, and a renames". I.e. specify the library 
once, and then the subactions, e.g.

(import "stack" (only push! pop!) (add-prefix stack:) (rename (clear! 
empty!)))

Much cleaner. To import multiple libraries, just have multiple import 
statements:

(import "lib1") ; imports everything
(import "lib2" (except something-secret))

Cheers,
Ray Blaak