freenode/#lisp - IRC Chatlog
Search
4:47:46
aeth
Something similar, but with directories instead of files (and the more idiomatic package.lisp in each directory) would probably work more generally.
4:48:53
aeth
beach: it parses the defpackage. If you use prefixes, you have it in an IMPORT-FROM with nothing other than the package name iirc. Otherwise, USE (not recommended in most cases) or manually IMPORT-FROM various symbols.
4:48:58
beach
aeth: Yes, as I said, we have been through this before, and all it would do for me would be to have each file be huge. And you came up with various fixes for that problem that made everything even more complicated.
4:49:24
aeth
Nilby: No, I think it's literally just (:import-from #:alexandria) and now it knows you're using (alexandria:foo)
4:50:08
aeth
beach: it's definitely not for every project, I don't use it in my Scheme-in-CL project
4:50:51
benjamindc
beach, do you have an example of what you mean that I can check out on gitlab or github?
4:51:37
aeth
benjamindc: Idiomatic CL is structured so that there's either a top level package.lisp or a bunch of subdirectories, each with one package.lisp
4:53:04
benjamindc
I'm coming to CL from Clojure and I like the one package per file style as it somewhat maps to clojure's namespaces. But if that's not idiomatic, when I should reasses.
4:53:19
beach
I think it's a silly idea. I mean, setting up a "module" is (or should be) a tiny fraction of the total amount of work on the real code of the module. And if instead package-inferred systems make the code for the module huge and unmanageable, then what's the point?
4:56:28
no-defun-allowed
I have files that average 40LOC or so; should I make a package for each of them?
4:56:59
Nilby
aeth: Some very useful things are impossible in the general case. I don't see it as a problem.
4:57:01
no-defun-allowed
And how do I export symbols from each file, in a way that lets me use symbols inside my "modules", but without the user being able to use them?
4:57:37
no-defun-allowed
There are a fair few things that I need to use between files, which a user could easily use to break the state of the system.
4:58:31
aeth
no-defun-allowed: Well, I mean, for one, I have a file with 5 lines of code, 4 being the defpackage, in one of my projects that doesn't use package-inferred-system. https://gitlab.com/mbabich/airship-scheme/-/blob/master/scheme-boolean.lisp
4:58:33
beach
no-defun-allowed: And I think the answer is that one has to put all the code of the module in one huge file.
4:59:25
aeth
no-defun-allowed: Another thing is, you have no real privacy that's not privacy-by-convention in Common Lisp outside of lexical closures. So you change the expectations of certain packages. That is, you have to have "internal" packages that if the user uses directly, you don't guarantee a stable interface.
4:59:42
no-defun-allowed
beach: It reminds me of when the Java teacher at university told us how having a class Class being in a file Class.java was a good idea. Sure, I know that the definition of stuff in that Class is in that file, but now I just have to find the method I want in a 3kLOC file.
5:00:46
no-defun-allowed
aeth: If you use internal symbols, you're on your own. There are only a few ways you can break my system from exported symbols, which are mutating sequences I can only tell you that you shouldn't mutate.
5:01:11
aeth
no-defun-allowed: And if you use a package in package-inferred-system that's clearly for use by other packages rather than the user, then you're also on your own.
5:01:29
no-defun-allowed
At one point, I wished you could pass out immutable "mirrors" of objects somehow, but it would have to be transitive, and it got too messy in my head.
5:01:40
aeth
Package-inferred-system encourages "internal" packages more than other styles, but that's an issue that can come up in other places.
5:02:41
no-defun-allowed
On the other hand, I have one package with like 100 symbols, and that feels a bit big (here we go again with the disbelief that I wrote 10,000 lines of code and all). But then I remember CLIM defines about a magnitude more symbols, and I don't feel so bad.
5:03:59
aeth
no-defun-allowed: It really depends on the domain you're doing. Java treats everything like it's a big, important project that's full of complexity and importance. Most projects aren't like that. trivial-left-pad doesn't need package-inferred-system.
5:04:32
aeth
But sometimes, you do a project where that sort of organization makes sense. Where there are a *ton* of files, and they all really need their own package because they do their own thing. E.g. I have a file that deals with SDL2. A file. Nothing else needs to know that SDL2 even exists.
5:05:26
no-defun-allowed
I try to do "one file per concept", which leads to a somewhat pleasing LOC distribution.
5:06:12
no-defun-allowed
Yeah, the damned filesystem makes organising code a fair bit harder than it should be.
5:06:56
aeth
Well, files are somewhat useful. If you write a bunch of macros with their own functions, and those functions are elaborate, then you probably want those functions to be in another file so you don't have to wrap them in a gigantic, hundreds-of-lines-long EVAL-WHEN.
5:07:40
jeosol
aeth: I had a conversion with Fare when I was trying to understand the use of :package-inferred-system for a code base. His article seems to suggested it helps compilation for large code bases but I never did a test to verify
5:08:17
aeth
jeosol: It definitely helps CI for very large systems because not everything needs to be tested in the CI. e.g. all of the FFI stuff, if cleanly separated, doesn't need to be loaded.
5:08:18
no-defun-allowed
ACTION uploaded an image: loc-distribution-function.png (41KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/LxrkPifVjClIzILMEKUPbWgl/loc-distribution-function.png >
5:08:23
jeosol
I remember I used it in my code base, but like beach said, it can be difficult to work with sometimes, as in some cases, you'd then define another package.lisp file to aggregate everything later on
5:08:31
no-defun-allowed
For reference, I graphed the cumulative distribution functions of my largest two codebases.
5:10:34
aeth
no-defun-allowed: I tend to prefer 300-1000 lines, but I also have a lot of extremely tiny files, too. Lots of special cases exist as real outliers, too, e.g. tests, which can be 7 lines or infinite.
5:11:16
pyc
Follow up question on our discussion on the importance of backward compatibility in the CL community. How did this breakage happen? "Doesn't work with the current version of Hunchentoot anymore!"
5:12:29
jeosol
aeth: I do have some 1000 loc files. Sometimes I want to break them but it will be more of a hassle as related functions are not together then.
5:14:20
jeosol
ok, let me see if I can pull it up. For context, I had a large system and I was running into issues where I wanted things to load faster and Fare suggested to look into that, and also some and to look at the dependency graph
5:16:02
jeosol
benjamindc: http://fare.tunes.org/files/asdf3/asdf3-2014.html#%28part._asdf-package-system%29
5:16:55
jeosol
The second to last paragraph is the statement about "scaling" but I never verified this
5:20:24
aeth
I do notice that zombie-raptor loads faster than airship-scheme when it's not a from scratch load (so not e.g. a new version of SBCL)
5:24:19
jeosol
I looked at your zombie-raptor link I realized I did something similar, have the separate files, then aggregate with a common package and use-reexport later.
5:25:26
aeth
The only reason I spun off zr-utils is because it would be strange for airship-scheme to either (1) depend on a game engine or (2) actually be hosted in a game engine monorepo
5:26:26
aeth
I'm taking a bit of a break from it now that the reader, which took longer than I had expected, is done
5:26:43
benjamindc
I just keep getting this error when trying to run (asdf:test-system "ramsay") even though the file lexer.lisp is in the test dir. Component "ramsay/test/lexer" not found, required by #<PACKAGE-INFERRED-SYSTEM "ramsay/test">
5:27:04
aeth
I do multiple projects so I can cycle between them when there's a good breaking point so I don't burn out of them
5:27:23
no-defun-allowed
Most of the time, I reload with C-c C-c; only reloading when I replace a macro or something more invasive.
5:28:21
aeth
no-defun-allowed: I'm talking about QL:QUICKLOAD, though. When you have a large project, you could go months without touching 80% of it, and unless you touched the core stuff that everything else depends on, that means you can go months without compiling almost 80% of it... unless you update SBCL monthly.
5:29:45
no-defun-allowed
If I had said "system" or "module" or something, and it was true, then I'd wonder how long (ql:register-local-projects) would take, when scanning SICL takes a good 20 seconds.
5:30:43
jeosol
aeth: 1024 lines is not bad. I once had a component, 3d graphical ray tracing, took me a month to complete for a challenge (circa 2017) - early days. The guys over at comp.lang.lisp helped a lot
5:32:05
jeosol
aeth: I have to work on something with python pandas last few days, dealing with python version hell drove me mad. I wished I could have used some CL library for the data manipulation piece
5:37:23
aeth
jeosol: for me what bothers me with that sort of thing is Jupyter... Everything will be fine until I need to run it again because of the implicit state in the out-of-order evaluation of the cells that I did while programming it.
5:37:38
aeth
That and it's frustratingly missing certain features like a spellchecker or an integrated linter (and you need a linter when you run Python)
5:38:22
no-defun-allowed
Hypothetically, you could use the reads and writes each cell makes to topologically sort them, but that requires hooks in places no real Common Lisp implementation gives you.
5:39:29
aeth
Something based in CL probably could implement a similar literate-programming thing in a smarter way than Jupyter (since CL already expects things to be redefined constantly), where it would make sure that running it from start-to-finish still produces the current results or something.
5:40:33
jeosol
i guess the cl-jupyter is the same issue right? I followed a clml tutorial. It's probably just to show things I suppose, I also tried to use VS code for it. The workflow is certainly not easy
5:40:57
jeosol
The problem with the project if implemented in CL, is that client may complain that they don't understand it if they need to take it over
6:50:07
solideogloria[m]
Why does `cl-json` parse the string "!BFYazLCNOAsYDPxIDn:matrix.org" as the symbol !+BF+-YAZ-+LCNO+-AS-+YD+-PX-I-DN:MATRIX.ORG
6:51:50
no-defun-allowed
cl-json only interns keys, from memory. But if you're using it to parse Matrix events, then the number of keys isn't finite, so you probably want to use another library, like jsown.
6:52:13
no-defun-allowed
But some parsers treat a key a:b as the symbol printed as a:b; I think there was also another XML parser that did that.
6:55:43
saturn2
you can override that by binding json:*json-identifier-name-to-lisp* and json:*identifier-name-to-key* to #'identity
7:01:13
loke[m]
It uses strings as keys, which is better (no risk of intern attacks with untrusted data).
7:07:44
jackdaniel
beach: this image is more complete https://common-lisp.net/project/ecl/static/quarterly/img/vol4/all-hierarchy.png
8:55:14
beach
And if you are not restricted to SBCL, in SICL, I store the entire source text of all the code that has been loaded into the image.
8:56:07
oni-on-ion
no-defun-allowed, i wonder what an 'empty' session would have as live objects? aside from classes, packages, symbols etc.
8:56:07
beach
oni-on-ion: I use the source text for reporting errors and warnings, and for backtraces.
8:57:20
beach
oni-on-ion: Methods and generic functions are objects, and there may be data structures involved for organizing those. Most certainly, you have hash tables in your package objects and such.
8:58:13
oni-on-ion
beach, hmm yes i see. have you played around with Squeak at all? having the source in the image allows for some very useful things. like ChangeSet
8:59:12
beach
I have not used Squeak, but my experience from staring at compiler output from SBCL and trying to match it to source code made me think about other ways of doing it.
8:59:41
oni-on-ion
beach, ahh, never had thought of CLOS. i mistakenly think it is bare knuckles, i had been accustomed to the seperation of FoundationKit and AppKit from other lands
9:00:37
beach
Common Lisp being a dynamic language, lots of stuff must be kept track of to allow for incremental updates to the image.
9:02:22
no-defun-allowed
100 megabits? After compression, a SBCL image is about 100 megabits on disk.
9:03:12
no-defun-allowed
(save-lisp-and-die "foo" :executable t :compression 9) gives me a 96 megabit image.
9:04:19
no-defun-allowed
oni-on-ion: After making sure not to load Quicklisp, (room) tells me I'm using about 25MB of dynamic space, and 12.8MB of immobile space. The rest is negligible.
9:09:39
Nilby
When you compare the size of a CL image to most other program binaries, make sure to add the size of most shared libraries, the compiler tool chain, and the debugger.
9:10:38
no-defun-allowed
No need - appimages and Electron programs blow most CL images out of the water in terms of size.
9:35:28
sauvin
I poked around the nets for a while looking at all kinds of different things regarding lisp, then remembered I wanted quicklisp, so, I fired up sbcl, loaded the quicklisp.lisp file and it just took right off. Slicker than CPAN.
9:37:38
sauvin
I think so. A beginner doesn't need to have to try to wrestle with the language implimentation while he's still trying to figure out how to say "sub stuff { 3.14159 * 2**$_[0]}" or "sub chunk { [ split ] }"
9:40:25
sauvin
I've been perling (strictly on an armchair basis, mind) for about twenty years. Lisp gonna be a new way to think.
9:41:31
saturn2
(defun stuff (x) (* 3.14159 (expt 2 x)) the other one doesn't quite have a direct equivalent
9:42:04
no-defun-allowed
"a new way to think" is the wrong way to approach it, in my opinion. Writing in Lisp is frequently "the way I wanted to think about it", except for the times in which it isn't, but those times are much less frequent.
9:42:06
sauvin
Direct, maybe not, but it's what got me wanting libraries to begin with. I didn't want to have to come up with a BASIC-like equivalent.
9:44:53
VincentVega
so far i just do (... &key (w nil) (width nil)) and check for mutual exclusivity but it's a runtime check
9:48:08
saturn2
you could write your own object making function with a compiler macro for the compile time check
9:50:21
Nilby
Probably emacs w/SLY/SIME, vim w/VLIME or something, vs code with some lisp extension, etc. but I don't know since I use my own thing.
9:50:35
no-defun-allowed
For geometric objects, w, h, x and y can be assumed to be width, height, X and Y positions, but it's usually nicer to use full names when someone else is supposed to look at a lambda-list and guess what they can call your functions with.
9:52:00
no-defun-allowed
That was a recurring theme in a funny Usenet thread I read, in which the verbosity of many Common Lisp libraries is supposed to be a problem (as it apparently is bad for "scripting").
9:53:22
no-defun-allowed
If you write (make-instance 'some-class, then SLIME will pop up with a lambda list like (&key this-initarg that-initarg ...) ;; and because unbalanced parens tick me off )
9:58:04
no-defun-allowed
Here, I have to press C-M-i (or ESC TAB or M-TAB, whatever floats your boat) to complete, unless I'm in the REPL, as TAB indents.
9:58:48
Nilby
Alfr_: I just tried it with no configuration on emacs 25.2 and slime 2.26 from melpa. But I'm probably not the person to ask, since I don't use it. SLIME doesn't come close to working on my real configuration.
10:04:04
Alfr_
Nilby, after removing slime-fuzzy-complete-symbol from slime-completion-at-point-functions it works here as well. Thank you. :)
10:09:58
Nilby
Alfr_: Nice! I've saved myself many hours of pointless work by always trying stuff in a clean setup first.
10:13:14
Alfr_
For that one has to know how it's supposed to work in the first place and until you mentioned it, I didn't.
10:15:36
Nilby
I usually just think what I want it to do, and figure somebody must have already done it.
10:19:51
Nilby
When I used to work on emacs the philosophy was, most of your code that isn't docstring should be written by <tab> completion. Snippets really help with that too.
14:35:36
beach
Xach: Do you still check Quicklisp systems with SICL LOOP? I am asking because Alexandria contains two illegal LOOP forms.
14:43:44
phoe
unless you have a separate alexandria dist, which would be the first time I've seen one!
14:44:00
phoe
anyway - I'd clone alexandria into your local-projects and checkout whatever commit you need
15:01:19
troydm
doesn't seem so, as only variables that are used inside thread is global *server* and local port
15:02:39
troydm
basicly what I'm doing is debugging why https://github.com/cxxxr/cl-lsp is not working on MacOS as expected, as when I start cl-lsp with args tcp 10003
15:04:15
troydm
but it doesn't seems like it's something cl-lsp related, more probably related to jsonrpc and bordeaux-threads
15:45:37
troydm
it seems like jsonrpc is designed this way that when you bind a server on tcp it needs to load (ql:quickload "jsonrpc/transport/tcp" :silent t)
16:26:19
SpaceIgor2075
Hello! Can anybody recommend any resources to learn about modules,packages, asdf and projects? i am a newbie
16:27:23
phoe
once you've absorbed this document and played in the REPL with the knowledge you've gained this way, please come back for a bit more about ASDF, systems, and projects
16:32:33
Xach
i don't like its POV of "isn't this dumb system dumb? well, here's how it works" - I'd prefer an explanation from someone with less contempt for it.
16:33:53
beach
Xach: It's OK. I see Alexandria fixed the incorrect clause order. That's all I need for now.
16:34:33
Xach
beach: whenever i increase strictness (by updating my sbcl), something that is 5-10 years since last maintenance breaks
16:34:58
Xach
the current problem is a widely-used library named "access" which uses function designators wrong
16:35:36
phoe
Xach: is it possible for you to also test on high safety/debug settings? this exposes bugs that are not exposed otherwise, like this cl-unicode bug that I just encountered