Out of convenience the -e
and the rest of the -p
, -n
, etc. flags will involve some magic manipulation of the S-expression inside -e or inside the script. It also loads some convenient modules. However, sometimes we may wish to convert a command line script to a full application. That’s what the --dump-code=code.spark
flag is for. It dumps the code of the program to a file containing code that can be run with just spark code.spark
.
For example:
$ spark --dump-code=say.spark -pe '(say)' $ cat say.spark (no strict) ; you should probably remove that. (use re) (use cmd-loop) (cmd-loop.set-implicit-print 1) (say) $
Like all examples here, this is just for the sake of the illustration. Until version 1.0.0 comes out, everything can change. But the concepts will remain the same.
We encourage Perl, Ruby and other dynamic languages with rich command line interfaces, to steal the --dump-code
idea. Maybe one day someone will become a multi-millionaire from selling a 300K Lines program that evolved from a simple spark/perl/ruby --dump-code=code…. -e '….\'
invocation (after a successful plain -e
invocation).