libera/#commonlisp - IRC Chatlog
Search
10:16:49
dim
hi there! so my latest changes to handling conditions in pgloader worked, thanks all who helped!
10:17:17
dim
now I would like to find if I can capure the compiler notes and choose to output them in debug mode only (see https://paste.debian.net/1249834/)
10:23:19
scymtym
dim: if you just want the textual output and not, say, the individual condition objects, you could bind *STANDARD-OUTPUT*, *ERROR-OUTPUT*, etc. to a string output stream around the COMPILE call to capture the output
10:23:50
dim
scymtym: yeah I think that capturing is something I do in other places in pgloader, and that'd be good enough to get started
10:39:17
dim
I though that would capture the output and return it as a string, but it doesn't (the output still gets printed in the slime buffer, and the return value is an empty string) ; and I can't remember how to do the capturing now, I have forgotten most of my CL it seems... help?
11:26:35
Shinmera
The conditions are not printed inside compile. They escape to slime or whatever else handles the toplevel and then get printed there, escaping your *error-output* binding.
11:34:09
scymtym
there could be two problems: 1) different conditions are printed to different streams 2) calling COMPILE in a SLIME REPL vs. a plain REPL vs. in a non-REPL thread may result in different surrounding compilation unit setups (which can influence when problems are reported). (with-output-to-string (stream) (with-compilation-unit (:override t) (let ((*standard-output* stream) (*error-output* stream) (*trace-output* stream)) (comp
11:35:05
scymtym
the code was supposed to be (with-output-to-string (stream) (with-compilation-unit (:override t) (let ((*standard-output* stream) (*error-output* stream) (*trace-output* stream)) (compile nil '(lambda (x) y)))))
13:00:18
dim
(let* ((fun nil) (notes (with-output-to-string (*error-output*) (setf fun (compile nil '(lambda (x) (+ x "plop"))))))) (values fun notes))
13:09:45
dim
I ended up with https://github.com/dimitri/pgloader/pull/1411/commits/fb63a778fb33c7afea0e7ab98e5580dda5093559 in case someone's curious
13:18:24
scymtym
(multiple-value-bind (function warnings-p failure-p) … is not going to receive a second and third value since (setf fun (compile nil source)) discards any values but the first
13:21:00
dim
I don't have a test env anymore on my local machine, so I have to commit and push and inspect the CI output, sorry
13:21:29
dim
if I wanted to get back seriously on hacking pgloader I would invest some more time and have a local test env of course, but I'm just trying to fix it from a distance, if that makes sense
13:22:15
dim
the link to the current changeset is https://github.com/dimitri/pgloader/pull/1411/files (which now includes a fix to what you mentioned last)
14:33:58
pve
Hi, is the correctable error signalled by make-package if a package already exists going to be of type "error"? So I should do (handler-case (make-package "MY-PACKAGE") (error (c) ...))?
14:42:42
pve
sure, I meant that if I for some reason wanted to access package-error-package then the second handler would be convenient
14:54:20
Bike
oh, yeah, the package errors are both surprisingly specific and surprisingly vague. for clasp i took a while to set up some helpful restarts, but none of them are standard
14:54:35
Bike
(of course how often you'd need to fix package errors programmatically anyway is debatable...)
15:00:44
pjb
pve: the only thing that clhs make-package says is: A correctable error is signaled if the package-name or any of the nicknames is already the name or nickname of an existing package.
15:21:29
pjb
It definitely means an instance of ERROR. At least, it doesn't mean a "direct instance of ERROR".
15:22:06
pjb
You can bet that clhs make-package was written before conditions such as package-error where defined.
15:28:17
beach
There is a lot of that in the standard. It is as if they ran out of time and couldn't go through every page one more time to make sure everything was up to date.
15:32:41
Bike
jcowan: it's actually just one now that i look at it - resolve-conflict. you pass it the symbol you want to keep for whatever operation and that's what's used. e.g. if the A package uses the B package, and you EXPORT B::FOO from B which causes a conflict with A::FOO, you can resolve-conflict with either a::foo or b:foo and the one you pick will be accessible in A
15:33:41
Bike
this is basically cribbed from sbcl, which briefly describes the mechanism in 7.11 of the manual
15:35:45
masinter
it wasn't a matter of running out of time. "is an error" was a way of allowing existing implementations to be compliant
16:22:27
jcowan
Bike: thanks. It's possible to portably refit restarts into Scheme, but I want to provide a list of what restarters should be associated with to various kinds of conditions. For example, (car 32) in sbcl only allows ABORT, whereas a (when a is not bound) provides CONTINUE, USE-VALUE, START-VALUE, and ABORT. None of this seems to be documented anywhere.
16:22:47
jcowan
I know it's implementation-dependent, but I don't especially care which implementation I look at.
16:27:52
pjb
jcowan: indeed, there are very few restarts specified by the standard. Again, conditions and restarts were a late addition to the standard, and they ran out of time to revise and put everything in a consistent state.
16:28:20
jcowan
Right. I just want to use a particular implementation or set of implementations as a guideline.
16:29:05
jcowan
I guess maybe looking at the source code for restart definitions is the Right Thing, though not ideal
16:29:06
pjb
error handling code in general, could easily double or triple the size of any software.
16:30:11
pjb
The best to do, IMO, is to take each of the API (the operators defined in CL, not the internal functions), and to define conditions and restarts for each of them according to the arguments they receive.
17:01:24
cedb
i might be a heretic but id like a tweaked CLOS with dot access syntax for slots, is that possible without a full blown reader macro?
17:05:13
White_Flame
right, (dot obj inside inside field (:aref 3) (:call foo x y z)) => ojb.inside.inside.field[3](x,y,z) ?
17:05:19
cedb
same for hashtables, i use them a lot in scheme for work and (hash-table-ref t k) is a bit verboes (i know i could alias it but still, t.k or somehting like that
17:05:54
White_Flame
but really, across many languages and many tools, it's not the syntax that's a challenge, but the semantic complexity
17:06:21
cedb
oh i hadnt realize you can provided a chain to "dot" (clos noob, spend most of my time in scheme these days)
17:06:27
White_Flame
I personally stopped using a lot of shortcuts like that because they end up being such an infinitesimal portion of my load, and just draw away from standard form
17:10:43
ldb
search SO gives this lib https://github.com/AccelerationNet/access/ https://stackoverflow.com/questions/50621703/accessing-nested-json-fields-in-common-lisp
17:14:50
cedb
doenst look like a very popular project, i was wondering like am thinking about this the wrong way if almost noone seems to be coding like that
17:15:44
cedb
I know its not "lispy" or wtv and im used to sexps, its a not anti-parenthesis thing, its just so verbose to access nested stuff with only functions and no special syntax
17:20:02
ldb
I guess many lisp programmers avoids "other people's library", except for too well known ones like alexandria
17:21:23
cedb
schemers do use a lot of srfis though, but i guess CL kind of has a stdlib builtin in the lang
17:25:14
cedb
well you can always start a nice flame in #scheme with that question if you feel like it :)
17:25:36
White_Flame
ldb: the existence of quicklisp and its quick adoption kinda speaks against people being anti-others'-library
17:27:57
aeth
and then `ln -s` to that in ~/quicklisp/local-projects/ when you need to override the version in quicklisp with the latest (and remove the link when you no longer wish to do so)
17:34:59
Bike
i think i just don't usually write code with deep nested accesses. usually i'll access one layer in and bind that to a name, which i then maybe do some other stuff with.
18:26:05
jcowan
Slot names make sense when creating/initializing/reiniiializing instances, though; that's better than using slot mutators.
18:27:38
jcowan
though you can write OOP Java if you follow three rules: use class names only in constructors, avoid == when comparing objects, and ...
18:27:58
cedb
i meant the whole "attributes have to be private, separate implentation from interface" thing
18:29:43
cedb
also im not talking about a fancy class that has a lot of invariants, i specifically mentionned just accessing nested structures
18:33:44
cedb
meh not my thing, also CLOS has multimethods so the whole "dont couple classes" thing ehhhh