|
|
|
|
|
by tehjoker
23 days ago
|
|
I played a little bit around with LISP but I was astounded when I saw that you run programs using the live REPL. I thought, how can you reliably deploy a finished program if it can get messed with at any time? Why isn't there a way to compile to a binary? |
|
That's one way, you stopped too early in your investigation though.
You can produce binaries, though the precise mechanism will vary by your implementation. And there's no reason to use the REPL for it. You can create an executable file with something like this:
And then `sbcl --load program.lisp` (or whatever you name it) and it'll produce a binary for you. Other implementations will have other methods of achieving the same thing.Or, if you don't need a binary, you can have something like this:
And then run `sbcl --load program.lisp`. That will compile and execute it without ever invoking the REPL.(NB: Using a function named main isn't strictly necessary, I named it that for the example. Name it whatever you want.)