Message91

Author nicktastic
Recipients
Date 2008-10-08.20:08:16
Content
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.
History
Date User Action Args
2008-10-08 20:08:16nicktasticsetmessageid: <1223496496.81.0.922065018813.issue65@servo.cc>
2008-10-08 20:08:16nicktasticlinkissue65 messages
2008-10-08 20:08:16nicktasticcreate