[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Packaging and importing
- From: Chris Marrin <chris@...>
- Date: Wed, 17 Aug 2005 11:20:30 -0700
Rici Lake wrote:
On 17-Aug-05, at 9:27 AM, Chris Marrin wrote:
I am using the wrong term. When I say "locals" I mean properties of
the "local namespace", which is the environment being used by a
particular function. So, if I have module 'a' and I want to import
some or all of its properties into the environment of a function, I
would just copy the property references from the module to the
environment. They are both just tables, right?
You could do that, but it's not easy to see what advantages that would
give you aside from saving a few keystrokes, I suppose. The package
namespace is in effect the public interface to a package; I wouldn't
have thought that importing random names into it would be a good idea.
I see it most often for "standard" things like Math. Rather than
importing each one separately you can bring in all the functions, like
local r = min(1,log(sin(PI*2*fraction)))
which looks a lot nicer than:
local r = Math.min(1,Math.log(Math.sin(Math.PI*2*fraction)))
IMHO. I am writing an app aimed at more casual users, so simplifications
like this are important to me...
chris marrin ,""$,
email@example.com b` $ ,,.
mP b' , 1$'
,.` ,b` ,` :$$'
,|` mP ,` ,mm
,b" b" ,` ,mm m$$ ,m ,`P$$
m$` ,b` .` ,mm ,'|$P ,|"1$` ,b$P ,` :$1
b$` ,$: :,`` |$$ ,` $$` ,|` ,$$,,`"$$ .` :$|
b$| _m$`,:` :$1 ,` ,$Pm|` ` :$$,..;"' |$:
P$b, _;b$$b$1" |$$ ,` ,$$" ``' $$
```"```'" `"` `""` ""` ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'