Starting Erlang

Joe Armstrong <>
Thu Apr 25 10:22:00 CEST 2002


On Wed, 24 Apr 2002, Mikael Pettersson wrote:

> On Wed, 24 Apr 2002 14:50:01 +0200 (CEST), Joe Armstrong wrote:
> >	2) An application is (usually) three files.
> >
> >	   foo.bat  (windows launcher)
> >	   foo.sh   (unix launcher)
> >	   foo.ear  (Erlang archive)
> >
> >           foo.bar and foo.sh would be one liners
> >           containing just
> >
> >	   erlRun foo.ear -s Mod Func Arg1 Arg2 ... ArgN
> >
> >	   foo.ear is assumed to be a Mod x Code archive -
> >	   The code in this is loaded (lazily)
> 
> Please please please make .ear be a standard (e.g. POSIX) archive
> format, usable by standard tools (e.g. tar/cpio/pax).
> The world doesn't need Yet Another Pointless Archive Format(TM).
> 
> /Mikael
> 

  Ummm - It's not clear to me the advantages of following a standard
format outweigh the advantages of using a non-standard format....

  Since I expect an Erlang program to produce the YAPAF file and
another Erlang program to consume the YAPAF I don't see why it matters
what the format is. A symmetric pair of term_to_binary and
binary_to_term calls is all that is needed - not exactly complex code.

  Using a YAPAF file means the standard tools like tar/cpio/... cannot
work on these formats - and this you can view as either an advantage
or a disadvantage depending upon your perspective. I think it's an
advantage since other people cannot (easily) mess around with your
files :-)

  In my experience doing things in pure Erlang is usually quicker than
mixing tools (apart from if the non Erlang thing is itself terribly
complex).

  Standard tools seem in my experience not to be so standard (or maybe
I've just been unlucky) - and don't work identically on all platforms
- I know they should - but they often don't.

  Even if they *do* work they are usually not available on all
platforms - I would not, for example, want to have to install the
Cygnus gnu utilities on windows in order to list the contents of a
archive file.

  I would (possibly) agree if unpacking the archive file occurred late
in the boot sequence - the problem is that the *first* file read in
the boot sequence *is* the archive file. So basically all I want to do
is execute a minimal bit of code that says, something like:

	{ok, Bin} = prim_file_read(BootFile),
	{Mods, {M,F,A}} = binary_to_term(Bin),
	map(fun({Mod,Bin}) -> load_code(Mod, Bin) end, Mods),
	apply(M,F,A)

  I don't (at this stage) want to execute complex code to unpack a tar
file format before I can get started - remember this happens very
*early* in the boot sequence so I want this to be as fast as possible
(so I can do single line shell scripts for scripting applications)
hopefully much faster than (say) perl.

  I don't mind unpacking tar files etc. *late* in the boot sequence -
since by then all my code for error handling and recovery is loaded -
but not early in the boot sequence.

  /Joe





More information about the erlang-questions mailing list