[erlang-questions] where did my code come from?

Joe Armstrong erlang@REDACTED
Tue Sep 13 21:53:31 CEST 2011


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")

and use a regular web server to serve up the code and cache the result.

To implement this you'd just need a parse transform and a small hack
to error_handler.erl and code.erl

I would do this myself but I'm off on holiday tomorrow with no computer

/Joe



>
> Erlang txt fields in DNS anyone?
>
> Also since rebar already allows you to specify your dependencies as git tags, we already have a system that will automatically pull the specific source (or latest if unspecified) and build your application.
>
> Dave
>
> -=-=- dave@REDACTED -=-=-
>
> On Sep 13, 2011, at 3:19 AM, Joe Armstrong <erlang@REDACTED> wrote:
>
>> I had an idea on my way to work ...
>>
>> When you write code, you have *implicit* knowledge of where the
>> external code comes from.
>>
>> When I write the following:
>>
>>     -module(foo).
>>      ...
>>     start() ->
>>          X = lists:reverse(...),
>>          Y = elib1_misc:zap(...)
>>          Z = misultin:request(...)
>>     ...
>>
>> I "know" that lists is part of my local OTP install, elib1_misc is my
>> own library installed
>> in ~/code/elib2_1/ebin and misultin is an imported project stored in
>> ~/imports/misultin
>> I also know that my paths etc are setup so this code will work when I
>> run the program.
>>
>> The problem is the *nobody else* knows this.
>>
>> I could tell the system like this:
>>
>>    -module(foo).
>>
>>    -location(lists,
>> "https://github.com/erlang/otp/blob/dev/lib/stdlib/src/lists.erl").
>>    -location(elib1_misc,
>> "https://github.com/joearms/elib1/blob/master/lib/src/elib1_misc.erl").
>>    -location(misultin,
>> "https://github.com/ostinelli/misultin/blob/master/src/misultin.erl").
>>
>>    ...
>>
>>
>>   The location annotation give a *definitive source" for the module I
>> am using in the module
>>
>>    What could you do with this information?
>>
>>    Answer - a lot - for starters
>>
>>         - automatically check for "latest versions" of libraries
>> download them when they change
>>         - provide "who uses my code" feedback to the authors of the code
>>         - publish (globally) lists of "definitive" versions of code
>>         - recursive track and code dependencies (What do I mean)
>>            when my system discovers that I use misultin - it
>> downloads misultin.erl
>>            misultin.erl will have location dependencies which I can
>> follow, thus the libraries
>>            that misultin calls can be fetched.
>>         - automate code loading
>>
>>    Most often this kind of "additional" information is kept "outside
>> the program" by strictly
>> annotating the program with the location dependencies we bring this
>> information *into* the program
>> in a form where it cannot be detached from the source code.
>>
>>    Comments?
>>
>>   /Joe
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list