[erlang-questions] where did my code come from?
Jakob Praher
jakob@REDACTED
Tue Sep 13 22:28:56 CEST 2011
Am 13.09.11 21:53, schrieb Joe Armstrong:
> On Tue, Sep 13, 2011 at 9:44 PM, David Goehrig <dave@REDACTED> wrote:
>> This is basically how most real world JavaScript applications already work, so it simply falls to building a nice distributed registry that can be universally queried.
> I was thinking of statically using the information to fetch and
> update the code. But you could do it dynamically by hacking the
> code loader and caching the results. I guess you could just say
>
> -location(mymod,"http://ww.a.b/foo/mymod.erl")
Sorry for my ignorance, I have not written much erlang (unfortunately).
But just to get this concept -location is a clause directing the laoder,
right?
So you have three entities:
a) the exporter site (exporting mymod)
b) the importer site (depending on mymod)
c) the loader (knowing where to find mymod)
Where a) and b) should be transparent of c). So you can plug in
different loders and load code from different sources.
Where is code depended by mymod loaded then?
In Javascript (CommonJS module system) the trick is to interpret a code
site as a closure and pass in a function called require as a parameter
(for hygenic reasons) when evaluating the code loaded from a location,
that has a certain lookup rule for again loading code (relative to that
site).
What about security issues - can you trust www.a.b even if it depends on
some internal modules (that are not sandboxed)?
Where would such a -location annotation typically be placed? Can you
give me an example?
Since you have more deployments than libraries and applications there
needs to be some wiring.
Cheers,
Jakob
More information about the erlang-questions
mailing list