issue65: Module scope, or top-level 'let'

Priority: wish Status: resolved
Messages
msg91 (view) Author: nicktastic Date: 2008-10-08.20:08:16
It is useful to place the contents of a module within a block so that 'let' at the top-level can be used
to provide a module scope, reducing pollution of the global namespace, and allowing modules to have
'private' or 'internal' components.

The down-side is that the entire module is indented within the block, which is ugly and wastes a valuable
indentation level.

It would be nice if require() could be modified to automatically place the contents of modules within a
block so that 'let' could be used at the top level, providing an automatic module scope.

My naive suggestion was to read module contents into a string buffer, stick '{' at the beginning and '}'
at the end, and evaluate the buffer, but jbms points out that this eliminates file and line number
information from stack traces.

Come up with a way to do this without sacrificing file and line number data.
msg584 (view) Author: retroj Date: 2010-03-22.23:48:49
new module system provides ability for modules to have their own namespace
History
Date User Action Args
2010-03-22 23:48:49retrojsetstatus: unread -> resolved
messages: + msg584
2008-10-08 20:08:16nicktasticcreate