Re: [Scheme-reports] Why define-library requires a explicit begin form?
taylanbayirli@gmail.com 13 May 2013 11:20 UTC
張書瀚 <zrqsmcx@gmail.com> writes:
> Here is a example in r7rs-draft-9.pdf:
> (define-library (example life)
> (export life)
> (import (except (scheme base) set!)
> (scheme write)
> (example grid))
> (begin
> (define (life-count grid i j)
> ...)
> ...))
>
> why not:
> (define-library (example life)
> (export life)
> (import (except (scheme base) set!)
> (scheme write)
> (example grid))
> (define (life-count grid i j)
> ...)
> ...)
>
> The second one (which is more r6rs-alike) looks less verbose, isn't
> it?
> Can anyone please tell me why the first one is preferred, thank you
> very much!
The first one is preferred because it cleanly separates the declarative
library language from the actual Scheme code. What if you have an
`export' or an `import' function in your own code? (You could get
around it by wrapping them in a `begin' (or another such "escape") each
time you want to use them in the top-level of your own code, but that
would be very dirty, obviously if you ask me.)
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports