libera/#commonlisp - IRC Chatlog
Search
9:09:18
pl
Anything particularly noteworthy in changes to common libs, implementations? I feel a bit behind on news
9:10:54
beach
pl: The WSCL effort is well on the way: https://github.com/s-expressionists/wscl/tree/main/wscl-issues/proposed
9:14:01
beach
That's the main idea with WSCL, i.e., do not invent anything that the main existing implementations don't already do.
9:15:40
beach
Bike created some "issues" that don't quire belong in WSCL, and we don't quite know how and where to present those. They don't belong because they discuss extensions and/or radical changes.
9:20:22
lotuseater
pl: another very insteresting and well working project to notice is April by phantomics: https://github.com/phantomics/april
9:21:42
lotuseater
it seems reasonable it even now outruns Dyalog APL which is 500.000 lines of C++ o_O
9:23:04
moon-child
afaik it doesn't even do reference counting, which is necessary to get good-performing apl
9:25:46
pl
The one time I've seen refcounting and "faster than tracing GC" actually work out was I think in Linear Lisp
9:26:25
moon-child
First: apl tends towards small numbers of large objects, so the overhead of reference counting is lessened. Second: in apl, all object have value semantics. A statement such as 'x←y' is semantically a copy; however it can be implemented by making 'x' point to the same memory as that currently pointed to by 'y'. A statement like 'x ← x + y', then, can only be an in-place operation on the
9:27:29
moon-child
*small numbers of large _and homogenous_ objects--an array of fixnums, say--so you don't need to maintain a reference count fo revery element
9:28:58
moon-child
because you might create many references to some object, then delete all but one, at which point you should be able to perform operations on that object in place
9:29:11
lotuseater
getting GC right when implementing a CL is one of the more tricky parts, right? Roger Corman said so in his talk about Corman Lisp.
9:31:46
moon-child
lotuseater: gc is very touchy, yes; and design desiderata for GCs are somewhat application-specific
9:33:08
pl
moon-child: would there be many references, or rather, big space to scan? Or rather, can the array refer suddenly to somewhere else in the middle, or can one optimize by allocating "no outbound refs" arenas?
9:33:41
lotuseater
okay :) I thought about when one starts writing a language kernel in Rust, which does borrow checking and needs no GC, would the CL implementation still need GC? I think yes because of its very dynamic nature.
9:34:20
ecraven
lotuseater: it's not that Rust doesn't *need* a GC, it just doesn't have one.. many programmers might *like* one for some tasks, it just isn't there
9:34:26
pl
lotuseater: Ruat's propaganda doesn't change the fact that it runs a half-baked Linear Lisp GC
9:34:56
ecraven
also, you can write CL code that does not cons ("allocate memory") very much, so the GC would only run very infrequently
9:35:18
pl
And the end result is that when you get into complex data structures, you have to forsake safety
9:35:59
moon-child
pl: in apl we distinguish homogenous arrays (which contain only fixed-size numbers and characters) from nested arrays (which may contain other arrays). (And most arrays fall into the former category, so you do not need to scan very much.) _If_ you were doing tracing gc, it would make sense to allocate the former in a no-outbound-refs arena, but it doesn't make sense to do tracing gc with apl
9:36:05
beach
lotuseater: You can use the host GC only if you have your compiled code executed by the host. But that's not usually how a Common Lisp implementation works. It generates native code with its own ABI, so it needs its own GC.
9:36:35
lotuseater
A Rust enthusiast friend of mine told me the last time he was at my place he doesn't see lisp used or be adapted by industry now that Rust is. i showed him from time to time some magic. and then told him CL is in industry for now a long time, or isn't it?
9:36:40
moon-child
lotuseater: the semantics of lisp require a gc (or to leak memory); this is independent of the language you use to implement it. Rust's gc is not commensurate with lisp's semantics
9:36:42
flip214
QL leaves me with clon-1.0b25; but loading that (via QL) gives me "System "net.didierverna.clon.termio" not found"
9:36:55
pl
lotuseater: "GC" is the colloquiall name - the name of the art is "automatic memory management", and as much as I laud them for bringing half of a single GC design from mid-1990s into common usage, that's where my like ends
9:37:55
moon-child
pl: if steele brought the c++ programmers halfway towards lisp, rust is bringing them halfway towards ocaml/clean? ¯\_(ツ)_/¯
9:38:03
lotuseater
let alone be ACL2 in industry use for proving hardware or this DART system in the gulf war
9:39:05
moon-child
well, yes; as hayley points out, java also dragged the lisp programmers halfway back towards c++
9:39:40
lotuseater
they also find it funny when i say stuff like C and friends are just special purpose langs. or that IDEs seem to converge to emacs
9:41:30
beach
Industry seems determined to use languages with no independent standard, with a few exceptions.
9:42:34
lotuseater
beach: you once said it's not good using things with no or often changing/breaking standard, much more when legacy is needed in the long run
9:42:37
beach
And, as I emphasize in my industry talks, a project leader that chooses such a language should be fired.
9:43:59
pl
beach: to me, its funnier when some languages that get bad rep turn out to have standards XD, it's just not widely known outside of the community
9:44:37
pl
(for example Ruby, which has both an (outdated) ISO standard, and informal standard including test suite that allows existence of interoperable implementations)
9:46:23
lotuseater
or this mess with the C++ standard changing all three years, adapting things that are well known for 20+ years and even the experts don't know/understand everything o_O
9:48:08
moon-child
the existance of a standard is invaluable when making a new implementation of a language, but I think its more important role is as a statement of the values of the designers and community of a language
9:49:40
lotuseater
or when much is depending on that what you do with it. eg in medicine technology every line must be clearly justified
9:52:16
pl
moon-child: PyPy is rife with "this doesn't work, this works" for the last... 15 years or so? I think that's how old the project is
9:52:42
moon-child
ACTION sometimes feels as though his role in this channel is to play devil's advocate to beach
9:55:13
flip214
lotuseater: in the ASD there's a :depends-on with (:feature :net.didierverna.clon.termio net.didierverna.clon.termio)
9:55:35
pl
moon-child: there's simply a big difference between language with a test suite as target, and language with "you have to work exactly like this big hairy C function"
11:16:37
pl
It's not effectively possible to track CPython because the spec is "whatever PyEvalFrameEx is doing"
11:29:13
flip214
so it wasn't the QL update but the QL cleanup of "unused" stuff that broke the setup
11:37:56
gin
is the memory allocation different between these two options -- (push (cons a b) alist) vs. (push '(a . b) alist)? I think (cons a b) will allocate on the heap. what about '(a . b). does it not need to be allocated somewhere?
11:51:55
jackdaniel
from the allocation side, quoted expressions may be stored once in the memory, so single modification may impact all future accesses
12:07:42
pjb
gin: (setf *print-circle* t) (let ((fresh-conses '()) (literals '())) (loop repeat 3 do (push (cons 'a 'd) fresh-conses) (push '(a . d) literals) finally (return (values fresh-conses literals)))) --> ((a . d) (a . d) (a . d)) (#1=(a . d) #1# #1#)
12:08:27
pjb
gin: as you can see, there are semantic differences. That should be enough to decide which to use.
12:15:01
pl
SBCL generally will allocate literals in function header, so while I don't know how it would go with a cons cell, in my experience allocating a short vector resulted in said vector being completely stored in function header
12:16:43
jackdaniel
ECL stores literals in the FASL header, so it may possible collapse equal literals from different functions
17:22:26
Xach
etimmons: i don't see how that system file can be loaded. does asdf do something to suppress package-not-found or something?
18:16:52
etimmons
Xach: Huh, you're right (I haven't actually tried using clon in a while, I just remembered Didier mentioning that issue at ELS)
18:17:28
etimmons
ASDF does nothing with package-not-found, so sb-grovel must have been already loaded by the people that have gotten it to work
18:21:08
etimmons
xach: Anyways, the proper way of doing what he wants is to use `"sb-grovel:grovel-constants-file"` instead of `sb-grovel:grovel-constants-file`.
18:26:34
Xach
etimmons: i tried finding that info in the manual, but failed - is it in there? if so, can you tell me where?
18:36:13
etimmons
Xach: I can't find it either. And the commit that added that feature (50f2420f) didn't touch the manual
18:42:20
etimmons
Xach: Did you figure out a path forward with the UIOP version mismatch at compile vs. load times?
18:43:11
gin
if I want to a push the values of variables a and b into an alist, it is going to be (push `(,a . ,b) alist), am I right? just checking if my coding style is alright.
18:44:42
Xach
gin: i don't find it that common to use backquote to construct conses like that, but preferences vary. I'd do (setf alist (acons a b alist)) or (push (cons a b) alist) instead.
18:47:19
gin
moon-child: The Google CL guide I found online says, "For the Lisp efficiency point, given two options of equivalent complexity, pick the one that performs better. (This is often the same as the one that conses less, i.e. allocates less storage from the heap.)"
18:47:54
gin
moon-child: so I was avoiding (push (cons a b) alist) until now and going for (push `(,a . ,b) alist) but like Xach mentioned, I too did not find this coding style used by others.
18:48:29
gin
that is why I thought of coming to this channel and checking if I am doing the right thing by following the said style guide.
18:48:34
etimmons
Xach: Nice. I worry we're going to have users reporting a whole bunch of similar issues when the latest UIOP is actually released to QL, though.
18:50:04
lisp123
gin: my personal opinion (which is not much) is that you should use acons and not mutate the alist - given how powerful computers are, this very minor inefficiency is fine. UNLESS i guess you actually want to mutate it (there are many valid cases for that, but one should consider coding in a way without side effects wherever possible imo)
18:50:56
etimmons
Xach: This issue was randomly on my mind earlier today, so I opened <https://gitlab.common-lisp.net/asdf/asdf/-/issues/83>. Not sure if anything will come of it, but should be a lively issue thread at the very least.
18:51:07
gin
lisp123: my question isn't about acons vs. push. my question is about (cons a b) vs. `(,a . ,b)
18:51:58
gin
the Google style guide recommends avoiding cons whenever possible. but I never see the `(,a . ,b) coding style in practice. so that made me think if that style guide is followed in reality.
18:52:25
lisp123
gin: oh I see. (cons a b) is easier for me to read, but others who write a lot of macros may prefer the latter approach
18:53:41
etimmons
Xach: I mentioned it in that issue, but I may open a separate issue about this particular local package nickname thing. There might be support for another quick release to mitigate the issue for packages that don't explicitly ask for package local nickname support.
18:58:53
Bike
technically i guess an impl could use the information that modifying it is undefined behavior and do some kind of optimization there, but i doubt any of them do and the gain would be pretty marginal at best
18:58:54
gin
lisp123: by the way, why did you make the point about mutating the list? did you see any code example here in the chat that was mutating the list?
19:03:19
White_Flame
tacking on a new cons cell to the head of hte list does not mutate the old list's cells
19:04:37
White_Flame
(from its perspective. there might be multiple other cons cells that use that list as a shared tail to their list)
19:05:26
gin
lisp123: what do you get when you run this: (let* ((a (list (cons 'x 10))) (b a)) (push (cons 'y 20) a) (format t "a: ~a, b: ~a~%" a b))
19:05:56
White_Flame
so going from (2 3) to (1 2 3) or (1 . (2 3)), that (2 3) sublist is not mutated, and is used as the tail by the new (1 . <cdr>) cell which the place now uses as the first cell of its list
19:07:19
White_Flame
another place might still be pointing at the first cell of (2 3), and is completely unaware and unmutated when that other place now tacks on the (1 . ###)
19:07:32
gin
_death: I think so too that I have misunderstood the style guide. would you please explain what the style guide really meant here?
19:08:00
White_Flame
(1 . cdr), (2 . cdr), and (3 . nil) are 3 different objects on the heap that point to its respective 'next' list cell
19:08:45
_death
gin: assuming you mean https://google.github.io/styleguide/lispguide.xml?showone=Priorities#Priorities the wording there is not as decisive as "avoiding cons whenver possible".. there are ample qualifications, and note that efficiency is last on the priority order.. I don't particular like this style guide, and think the parenthetical remark should've been dropped
19:13:15
_death
gin: from what I heard in a recent talk (probably not recorded?) google's Lisp code is basically "C with parentheses" at this point so I don't think you should take its style guide as exemplary
19:15:25
Devon
gin: ITASoftware aka Google has very specialized needs, they can afford to spend extra work to gain performance.
19:15:50
_death
gin: this may be due to the constraints of their system.. you can read something written 20 years ago about it here: http://www.paulgraham.com/carl.html
19:16:21
White_Flame
pretty sure that naughty dog's GOAL was also mostly C-in-Lisp, but it makes sense there for performance gaming
19:17:32
lisp123
Would it be possible to convert 'usual lisp style' into 'c in lisp' style via macros?
19:18:48
White_Flame
it's like people asking if you can just compile JS to webasm, if you're in that space
19:21:05
pl
lisp123: there's a profile of webassembly that maps 1:1 with JS, which is common compilation target, but that's because Chrome's V8 has (had?) broken webassembly support
19:21:54
pl
White_Flame: GOAL was afaik a stripped down mix of CL and Scheme with liberal access to assembly
19:22:31
pl
White_Flame: no, webassembly. Because for considerable time, Chrome would compile webassembly to JS because it was incapable of JITing it otherwise
19:23:12
pl
the specific issue was that the JS roots of the V8 IR format meant there was no support for any sort of jump