I'm probably missing something but what's wrong with importing functions
if you are using them so much? Example.
-import(filename, [join/2]).
Tom.
--
Cloudian KK - http://cloudian.jp/
S3 REST API Compliant Cloud Storage with Cloudian®
%% obviously incomplete, but you get the idea
expand({d, D}) -> filename:dirname(D);
expand(Ds) when list(Ds) -> filename:join([ expand(D) || D <- Ds ]);
expand(F) -> F.
My main gripe with the "expand/1" approach above would be that the resulting caller might look a bit messy. But some experimentation could get the interface right.
(Compiling this into direct calls with a parse transform is left as an exercise.)
Best,
Thomas
I think it is a nice idea that would improve scripting.
But how to agree on module names and content is harder. There is a limited
number of 1 and 2 character module names, and once in OTP they are written
in stone.
For f.erl I miss e.g is_dir from filelib, which would introduce the notion
of merging old module functionality. Using the name 'fl' for filelib
functions would just be hard to remember.
Aliasing filename:basename to fn:base is a bit unintuitive since the
original Unix command is called 'basename' and for e.g file:list_dir
you have aliased it to f:ls (as for many other) to make them more Unix:ish.
I think it would be better to keep to unix command names where possible.
[Wild idea: f:'-d' for filelib:is_dir, or t:'-d', or f:test(d, Path).]
An alternative approach might be to have a helper module named 'es'
containing all scripting aliases...
>
> BR,
> Ulf W
>
> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
> http://feuerlabs.com
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
I love escripts but find myself intuitively avoiding them for a couple reasons:
- In most cases, bash is more portable and solves system level
problems more directly
- I don't have the escript foo required to wrench my program it into a
single script file
Also confusing, Solaris?
Redirect Erlang input and output streams on Solaris®
But mostly because the page you linked has nothing related to how
Garrett uses it.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu