4 ms·
In Common Lisp, files are in fact "modules" (or "compilation units") also. To treat multiple files as one unit, you have to use the with-compilation-unit macro:
by kazinator 10y ago
In Common Lisp, files are in fact "modules" (or "compilation units") also. To treat multiple files as one unit, you have to use the with-compilation-unit macro:
http://clhs.lisp.se/Body/m_w_comp.htm http://clhs.lisp.se/Body/m_w_comp.htm
The packaging systems people use nowadays over CL are not a part of CL. The whatever subjective suckage they introduce is their own. If you want racket-style modules, hack them up.
The grandparent's observation that "modularization/package management turned out to be too verbose and archaic for my taste" is very ironic --- in particular, the "archaic" part. ASDF is from around the turn of the century (the 21st that is).
The big hurdle in CL modularization is something very trivial: the fact that a file cannot refer to neighboring files easily by a short path. There is no
(load "foo")
which will look for a "foo" in the same directory as the file which is invoking the load form.
This steers package management toward the external mode, whereby some definition exists outside of all the files and handles their inter-dependencies and the manner of actually locating the groups of files.
I fixed this in TXR Lisp, and so simple modularization is a cinch! You load some main file, and that just does (load "foo") (load "bar") ... to load its related files, no matter where they have been located.
I made load a macro, and that macro accesses the source file location at macro-expansion time, imbuing it into the resulting form that actually does the loading when evaluated. If the load path is relative, then the caller's path is used to resolve it, rather than the current working directory.
- ghettoimp 10y ago"The whatever subjective suckage they introduce is their own. If you want racket-style modules, hack them up." I don't think it really makes sense to try to roll your own module system? I mean, the whole point is to be able to easily share code with the community, right?
- armitron 10y agoThere are plenty of module systems already there. If you want racket-style modules you can also have them by implementing them.
- technomancy 10y agoGreat solution if you never want to use code anyone else has written. To be fair this seems like a pretty common mindset in CL-land.
- lispm 10y agoASDF as a system building tool is widely used in CL-land. > To be fair this seems like a pretty common mindset in CL-land. My Lisp Machine has around 60000 functions, and I have only written a tiny fraction of them... Strange. If nobody else has written them, where are they coming from?
- kazinator 10y ago> I don't think it really makes sense to try to roll your own module system? Obviously Fare Rideau thought it was a good idea when he started hacking on ASDF. He could just have used Defsystem or whatever. It's very popular now, but its name stands for "another system definition facility" for Lisp! If you don't like anything, roll your own. Sharing with the community isn't the entire point of a module system; it's also to internally organize the software you're working on, whether you're just one hacker or a team of one hundred. Niklaus Wirth's Modula-2 language has a module system, and so does Ada. The concept of sharing modules with the community didn't even exist. A module system as a hub for sharing is a relatively new thing: it's a fusion of the ideas from open source OS distro package management and language modules.
- lispm 10y agoASDF was originally not written by Fare Rideau. It was developed by Dan Barlow in 2001/2002. He did not use MK-DEFSYSTEM, because he wanted a free/open-source DEFSYSTEM with an implementation using more of CLOS and easier to maintain. ASDF was later developed into ASDF2 and 3 with a lot of work by Fare Rideau and others.
- lispm 10y agoA compilation unit is not a module. > The packaging systems people use nowadays over CL are not a part of CL Packaging systems were never a part of CL. > The big hurdle in CL modularization is something very trivial: the fact that a file cannot refer to neighboring files easily by a short path. There is no (load (merge-pathnames "test1" *load-pathname*)) If that's not short enough, define a function L which does above... > This steers package management toward the external mode, whereby some definition exists outside of all the files and handles their inter-dependencies and the manner of actually locating the groups of files. This is the way how to do it. > I fixed this in TXR Lisp Oh no..., well there have been zillions of similar attempts...