On 19/05/2010, at 10:49 PM, Manuel Pégourié-Gonnard wrote:

> Another, more paranoid way of importing symbols in modules is to import them 
> as
> locals, eg:
> 
> local pairs, ipairs, format = pairs, ipairs, string.format
> module('foobar')
> 
> Here the goal is not really to shoten names, but to keep a closer control 
> about
> which symbols are available in the scope of the module, and avoid the above
> mentioned funny effect.


This looked interesting, especially after reading more about it in P.I.L., so I 
spent some time converting -nms to use this syntax.

It was a little more work than I bargained for, but in the end I really like 
how it forces you to be more strict about how data is being passed around 
between modules. The more I look into these modules it seems they're rather 
TeX-like in passing around large global variables everywhere.

Take a look:

http://github.com/wspr/luaotfload/tree/module

Comments welcome. Would you be interested in trying this out in the master 
branch?

-- Will


Reply via email to