freenode/#lisp - IRC Chatlog
Search
20:21:48
wglb
I am using dexador https://github.com/fukamachi/dexador to read web pages from many different sites in the same session. If it runs long enough (accessing many different sites) the process dies with "too many open files". This is verified by running lsof against the process as it progresses. dex:get returns, among other things, a stream associated with the socket. I issue a close on that socket when it returns, but this does not
20:21:48
wglb
appear to actually close the socket and assocaited fd. Any words of experience here would be appreciated.
20:23:53
jkordani_
you'd still prefer for releasing the os resources to happen when or shortly after you ask it to happen as opposed to the next time the gc runs
20:24:50
wglb
Well, if calling close doesn't actually close it, I don't think it will get garbage collected.
20:25:25
jkordani_
wgbl: you may still find that raising the ulimit for open files will be necessary, even once you get file closing to happen successfully
20:28:49
jkordani_
wgl: do you issue a close on the socket, or the stream? oh, because the "burst rate" of open file handles for whatever it is your doing may still be higher than the ulmit imposed default, even after you are confident that you are closing file handles properly
20:39:13
dlowe
hm. there's two interpretations of connection pool, I guess. But you can make multiple requests on a single http connection, so if you're hitting the same site multiple times, it makes sense to keep the line open
20:39:43
dlowe
it could also mean that it just keeps the connection data structures around to avoid reallocation
20:41:37
wglb
jkordani_: Hitting different sites with each query, and not likely to come back to the same one.
22:42:09
jmercouris
beach: do you have the link to the style guide you reccommended me some time ago?
22:42:32
jmercouris
it was some PDF of sorts by some author, the only thing I can remember about the author is that they had a female name
22:46:10
sjl_
jmercouris: maybe it was the book "Lisp Style & Design" by Molly Miller and Eric Benson?
22:47:16
jmercouris
sjl_: I found it, I think, I think maybe I was mistaken about the female author, it's a Norvig conference paper: http://norvig.com/luv-slides.ps
22:47:35
jmercouris
basically I had been using if with a single conditional, and he pointed out to use when instead and linked to some article
23:33:13
elderK
But that isn't the same as saying "This suite must only run if this other suite passed."
2:11:22
trocado
hi! how do I write a function that, if it's going to return nil, lands the user in the debugger with the option to input a value, and then returns that value?
2:13:17
no-defun-allowed
use restart-case with a handler that does (return-from your-function value) somehow
2:30:44
aeth
assert and other ways will work, but check-type is the easiest, if it is easily expressable as a type
2:32:02
aeth
Note that check-type always returns NIL so you need to have foo, your return value, on the next line. foo should also be a place.
2:52:25
aeth
The only difference is that you'd want multiple-value-bind if you put it in something like alexandria (especially with matching the's API because the does accept values)
2:52:38
aeth
(the (values integer integer) (values 1 2)) vs. (ensure-the (values integer integer) (values 1 2))
2:53:59
aeth
SBCL's (the (values integer integer) (values 1 2d0)) doesn't behave like check-type (you cannot provide a new value) so there would be a use for a macro like this
2:56:49
aeth
pillton: I already wrote this macro, actually. Well, I use the same principle to do return type checks in my define-function macro when in check-type mode so the only thing missing is determining if there's one type or a values list and passing it into the function return-type-check.
2:56:54
aeth
https://gitlab.com/zombie-raptor/zombie-raptor/blob/089c7e4382ff2d7bb1e8c1bb40d9708d45f0a46e/util/typed-bindings.lisp#L80-87
2:58:15
aeth
(i.e. If it's a list whose car is VALUES, treat it as a return type list; otherwise, treat it as a type.)
3:01:36
elderK
Guys, what's the point of adding :execute alongside :compile-toplevel and :load-toplevel/
3:01:52
elderK
As far as understand, :execute is only really used when the eval-when is not a top-level form.
3:02:21
elderK
And if the compiler sees a progn, it treats everything in the progn as top-level forms, so, eval-when inside a progn would be treated just as if it were at the top-level.
3:10:07
aeth
pillton: Well, this is how I implemented it: https://gitlab.com/zombie-raptor/zombie-raptor/commit/ae26e8c4f75f565643f53dea51941b3895e6071b
3:10:20
aeth
https://gitlab.com/zombie-raptor/zombie-raptor/blob/ae26e8c4f75f565643f53dea51941b3895e6071b/util/util.lisp#L227-235
3:11:52
aeth
A strange consequence is that it will append nils to the end because of how multiple-value-bind works. Only multiple-value-list and multiple-value-call can actually catch if you don't provide a value when a value is expected.
3:12:01
pillton
aeth: You need to expand the compound type before checking if the car is equal to 'values.
3:12:48
pillton
Someone could do (deftype shonky-values () '(values (and (integer 0) (integer * (0))))).
3:23:17
elderK
:| Hmm. SBCL, stuff that you add to the environment during compilation, seems to stay around after the compile-file.
3:25:11
elderK
Yes, but it's implementation defined whether stuff that enters the environment during compilation, is present in the environment after compilation completes.
3:25:51
elderK
And compile-file, afaiu, the compiler's environment is that which is in effect when compile-file is called.
3:30:43
elderK
At least, that's how I interpret http://www.lispworks.com/documentation/HyperSpec/Body/03_ba.htm
3:33:09
pillton
"The compilation environment inherits from the evaluation environment, and the compilation environment and evaluation environment might be identical."
3:36:17
elderK
" The startup environment is the environment of the Lisp image from which the compiler was invoked."
3:36:59
pillton
Yes, so the evaluation environment might be identical to the startup environment. Thus any processing of eval-when forms will change the startup environment.
3:38:18
elderK
The key is, of course, is that there is no requirement for the startup environment and the compilation environment to be identical. The compilation environment could be a copy of the startup environment, a distinct environment.
3:42:26
pillton
I suspect a lot of things would break though since there isn't much discussion on with-compilation-unit.
3:44:11
elderK
I'm just glad I provided a hook for testing whether metadata instances are "compatible."
3:44:26
elderK
So that if you redefine something, it'll issue an error (or warning) only if they're not "compatible."
4:46:17
romulas
Made with LISP: "We conjure the spirits of the computer with our spells" https://www.youtube.com/watch?v=aHk42kDwesM
4:48:50
beach
So, it would be best to start with making sure your postings conform to the topic and ask some modest questions about the purpose of this channel.
4:50:08
fiddlerwoaroof
pillton: interesting, I didn't realize that with-compilation-unit was in the standard
4:51:02
fiddlerwoaroof
I'd seen something like that in the documentation for implementations, but I never noticed that it was a thing in CLHS
4:51:51
beach
fiddlerwoaroof: That's probably because you have never attempted to write an implementation of Common Lisp.
4:54:28
fiddlerwoaroof
Hmm, does a form with an implicit progn like with-compilation-unit have the same effect as progn wrt. toplevel-ness of the subforms?
4:56:49
beach
Because it is specified that COMPILE-FILE wraps the compilation in WITH-COMPILATION-UNIT.
5:00:18
fiddlerwoaroof
The question I'm asking is, more explicitly, would the defun in (form-specified-to-have-an-explicit-progn ... (defun foo ())) be considered to be a toplevel form?
5:00:38
fiddlerwoaroof
Because, if it's an explicit _progn_, then it should have the semantics of progn
5:01:09
fiddlerwoaroof
Although, I guess one could say that the implicit progn doesn't occur at toplevel.
5:02:15
specbot
Processing of Top Level Forms: http://www.lispworks.com/reference/HyperSpec/Body/03_bca.htm
5:12:31
fiddlerwoaroof
there is no circumstance (at the toplevel, at least), where the subforms will be executed
5:14:03
fiddlerwoaroof
My current project is to figure out if porting sbcl to power9 looks like a feasible project
5:28:24
beach
LdBeth: That's a very general question. Personally, with my favorite coauthor I am working on a paper about bootstrapping, but I fear that it is impossible to explain to anyone who has not already tried to do something like that, at least with the 8-page limitation of an ELS submission.
5:29:23
beach
It could just be that we are unable to describe it, since this is the first time anything like this has been attempted, so there is no existing description of anything similar.
5:29:48
equwal
What are you bootstrapping? I think I'll understand. How difficult is it to get a paper into ELS?
5:30:53
beach
equwal: It depends on the number of submissions. Maybe 50% or so of the submissions are accepted.
5:31:33
beach
The percentage is not given ahead of time. There are a certain number of presentation slots to fill, so that number of papers will be accepted.
5:34:31
beach
Now, if we could make sure that Xof and people like him were the referees, then we would be fairly certain that the referees would understand the technique, but that is not possible, so we need to make sure it could be understood by a more general audience.
5:35:45
beach
Time for a break. I'll be back in 30 minutes or so. It will take you that long to read the draft. :)
5:35:50
LdBeth
It’s particularly interesting seeing how to bootstrap CLOS because so far only more general “call by name lambda calculus” is discussed as the focus
5:47:48
fiddlerwoaroof
LdBeth: from things he's said before to me, I'm pretty sure that's what he's trying to avoid.
5:53:51
|3b|
sicl/cleavir does something like something like CST -> AST -> HIR -> MIR -> ..., where the 'MIR' and '...' parts are still a bit undetermined
5:53:52
equwal
beach: I'm surprised you didn't reference SICP since they did this in scheme. This process (bootstrapping a language onto itself) is called "metacircular evaluation" https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-26.html#%_sec_4.1
5:54:13
|3b|
optimization can happen at any of those steps, though i think it is mostly expected at HIR/MIR levell
5:56:18
equwal
Although I admit I haven't seen anyone try to do it with a Common Lisp, probably because it is so much more of an undertaking than tiny scheme.
6:03:14
beach
LdBeth: The compilation to a subset is only part of the bootstrapping procedure. In the production system, we will compile to machine code.
6:04:09
beach
equwal: Thank you for pointing out the thing about metacircular evaluation, because your remark shows that we have been completely unable to communicate the difficulty of this bootstrapping procedure. I am now more convinced than ever that the paper will be rejected.
6:04:36
|3b|
beach: in 5.2, "the function compute-discriminating function" looks like it should be "the function compute-discriminating-function"
6:04:44
beach
LdBeth: Optimizations are done on the HIR (High-level Intermediate Representation) level.
6:04:45
equwal
No, my mistake is that I have never read the chapter from SICP that I linked, so I didn't know that it wasn't a self-hosting interpreter.
6:10:10
|3b|
beach: in 4.3, "The essence of our technique consists of four phases. " might be nice to specify "and six environments" too