Page 1 of 1

Why is it usual to make everything a "registered system"?

Posted: Tue Jan 09, 2018 4:18 am
by Lispeth
Assuming I want to develop a stand-alone CL application, the usual recommendation is to write an ASD file for it so it can be installed as a "registered system". In my opinion, this makes no sense: Why should it be available like a module?

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 9:30 am
by pjstirling
ASDF serves the same purpose as Make/Maven. It solves the problem of ensuring that files are compiled and loaded in the right order, while rebuilding if dependencies have changed. The primitives supplied by the Common-Lisp standard are all imperative, and offer a lot of scope for users to screw this up. ASDF let's you write declarative descriptions of how your code should load.

It's worth saying that I would not recommend building your C++ code with hand-written shell scripts (beyond toy examples) for many of the same reasons.

When you want to create a application in the modern sense (i.e. something you might double-click in windows), at build time you load your code and the dump an image. When the image is executed all your code will be pre-loaded, and your top-level function will, in-turn, be executed, letting you open GUI windows etc.

Edit, formatting

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 9:39 am
by Lispeth
I understood that ASDF would also add my application into its "registry" though so it can be loaded as a module. That's not desired behavior in this case. Make does not do that.

Or am I missing the point?

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 9:50 am
by pjstirling
Once you dump an image with your code, then you can delete everything else (if you so want).

It's also possible to e.g. have a script that starts your lisp with a modified ASDF configuration so that you have modules that are private to your application.

You are right to say that make doesn't force you to supply meta-data that lives on into the world after compilation, but this turns out to be a defect in make, rather than ASDF. Complicated programs and libraries end up needing things like "llvm-config" to paper over its lack.

Perhaps if you gave a better idea of your use case I would be able to answer better?

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 9:58 am
by Lispeth
Well, my use case is that I want to write and deploy some kind of a web software (a discussion forum like this one here) because the existing solutions are not good enough. I don't want my potential users to spoil their ASDF directory with my bloat.

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 10:09 am
by pjstirling
Well, if you want to distribute essentially binaries, you should go the image route.

If, however, the idea is that you will distribute source-code that will maybe be modified at the other end, then there's no good other choice than providing ASDF systems. If you are concerned about the ASDF namespace then use java-style reverse-domain-name prefix on your ASDF files (you don't need to have the Common-Lisp package named the same as the ASDF system that loads it, it is just the recommendation). And, as I said in my previous post, there's no big problem with re-configuring ASDF for launching a particular application without ruining your default setup.

Re: Why is it usual to make everything a "registered system"

Posted: Tue Jan 09, 2018 11:39 am
by Lispeth
Thank you, I misunderstood ASDF then!