[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] There are (module)s and there are (declare (unit s))
Re: [Chicken-users] There are (module)s and there are (declare (unit s))...
Fri, 11 Dec 2009 09:19:12 +0100
* Will M. Farr <address@hidden> [091210 19:04]:
> The short summary: modules work on syntax, controlling the mapping between
> symbols and bindings at top-level. Units work at runtime, ensuring that code
> is initialized and top-level statements are executed in the correct order.
> Here's the long explanation:
> * modules: a syntactic construct that associates names (symbols) with
> bindings. In Chicken, all bindings are top-level; a module lets you access
> those top-level bindings with different names (or even
> hide---effectively---some bindings because there is no name existing inside
> the module that refers to them). Purely syntax. Modules are very important
> for macros, because free symbols in the output of a hygenic macro should
> refer to bindings according to the mapping in place *when the macro was
> defined*, not the binding in place when the macro is used.
> * units: a way to designate some code as intended to be included in a larger
> library or program. The issue that units try to solve is that, in general,
> top-level forms in Scheme have side-effects. Consider:
Thanks for your insights they help a bit. So a unit just ensures
that it gets executed first before of all the parts that use it? A
module will do that too...