libera/#commonlisp - IRC Chatlog
Search
7:57:44
gendl__
Hi, In a source file, I have `#+sbcl (require :sb-posix)` at the top-level. And I was told by a downstream library maintainer: "You can't use that form at the top-level and it would be better expressed in the system definition file." So I'm trying to figure out how to express that in the system definition file.
8:02:04
gendl__
Well. Indeed I would expect asdf to handle them platform-specific. So does asdf search first for matching visible asdf systems, then if not found searches for requirable modules?
8:03:04
pve
I'm not sure how it's done, only that there is a special asdf-system class "require-system" for this purpose
8:07:58
splittist
Perhaps - wild speculation - the information will be recorded in the asdf system object and can therefore be queried and reasoned about, instead of thrown-away at the reader level
8:38:24
jackdaniel
pve: the rationale was that sometimes you may want to analyze the full system definition including feature-conditional inclusions
8:38:52
jackdaniel
if you do #+foo (:file "foo") #-foo (:file "bar") then one of these branches is not read, hence it is not part of the system definition itself
8:40:43
splittist
see https://asdf.common-lisp.dev/asdf.html#Required-features for a brief discussion
8:41:59
jackdaniel
sufficiently smart asdf would define its own reader and parse #+xxx inside the defsystem ,)
11:18:55
parjanya
hayley: formatting is... less complicated, apparently this is decided by 'SB-FORMAT::FORMAT-PRINT-NAMED-CHARACTER, but I couldn’t tweak it...
11:22:33
gilberth
Consider (set-pprint-dispatch '(member #\space) (lambda (s o) (write-string "#\\Space" s) o))
11:26:15
gilberth
I personally also don't like that #\Space must print as "#\ ". But not doing so would not be conforming to ANSI-CL.
11:50:27
mi6x3m
Hey, how can I provide an initial value in "loop as line (find-next-line data line) while line"
11:54:10
jackdaniel
it fell out of grace among many common lisp programmers but it is a good starting point for writing your own iteration macros
11:56:47
pve
On a less serious note, I cleaned up my code name generator. From now on, all my projects will (at least initially) have funny names ;)
11:58:32
yitzi
mi6x3m: LOOP and DO are made with the same special forms, TAGBODY, etc. One isn't better than the other one in that respect.
12:30:54
flip214
pve: what happens on (generate-alliteration pattern 'adjective 'adjective '("Alice") '("Bertrand"))?
12:32:28
splittist
I have a function that acts on a THING. Often, the callers of this function actually have a PART (of which the THING is a component) or a DOCUMENT (of which the PART is a component). Should I turn the function into a (generic) function accepting a DOCUMENT, PART or THING? Or should I leave it to the callers to extract the THING as necessary? Please dicuss. (:
12:34:52
pve
flip214: Tbh I didn't give much thought to what it should do in that case, so I figured just signal an error for now.
12:34:57
flip214
splittist: I've had that last weekend in one of my projects, and ended up with a few DEFMETHODs - this way there's an interface (sorry)
12:40:39
splittist
flip214: yeah. In fact, this is a bit of a common pattern, so I'm also thinking of a macro DEFINE-ROOT-FUNCTION that would define the generic function and the three methods.
12:42:21
splittist
Now - do these methods just wrap one another, or should they be a series of before methods, or am I missing some (other) obvious method-combination?
12:44:18
flip214
splittist: I played around a bit - a DEFUN that SETFs its argument bit by bit via a few (WHEN (TYPEP ...)), DEFMETHODs, and a DEFUN that used LABELS recursively depending on type.
12:45:51
splittist
yeah - I think I was hallucinating an object relationship that didn't exist, channeling my inner ChatGPT
12:46:05
jackdaniel
we are bike shedding, right? so I'll add my own 2gr -- if I have a generic function #'SEAT-POSITION, and I have a car that does not have a position, but its seat has one
12:46:31
jackdaniel
then I'd consider gross to have a SEAT-POSITION specialization on the car that trampolines to its seat
12:47:50
jackdaniel
last time I've tried to rewind the stream more than one character after reading I had some problems, so smh
12:53:07
splittist
jackdaniel: agreed. But I think I'm ok in at least some of the cases I'm considering. It makes sense to ask ALL-FOOTNOTES about a DOCUMENT, a MAIN-DOCUMENT-PART, and a ROOT, since the only places in a document footnotes can appear is in the main-document-part, which has a root. Many of the callers of all-footnotes will be in a context where they have a root rather than one of the enclosing structures, but not all.