freenode/lisp - IRC Chatlog
Search
19:01:07
stacksmith
Could someone clarify: Bordeaux Threads api states: "Global bindings are shared between threads..." and yet *standard-output* is not usable inside a thread...
19:04:29
|3b|
current value of the thread that started the new thread is frequently a reasonable default
19:04:38
shka_
stacksmith: simply (let ((output *standard-output*)) (bt:make-thread (lambda () (let ((*standard-output* output))
19:05:35
stacksmith
Have you tried *default-special-bindings* or the initial-bindings parameter in make-thread?
19:05:35
|3b|
i think bt:make-thread has an option to specify default bindings so you don't need to do it manually
19:05:43
shka_
and no, i don't know why it is like this, but multithreaded standard-output seems like a bad idea, so this may be design choice
19:06:06
|3b|
more that "dynamic scope" is a bit hard to define when there are multiple stacks involved
19:07:10
stacksmith
I am just trying to make sense of the docs... I suspect that *standard-output* is bound by a let somewhere above and is therefore not a clean global...
19:07:32
|3b|
after (let ((*x* 1)) (make-thread ...)) that binding goes out of scope for calling thread, and make-thread exited, so reasonable to expect that binding to no longer exist
19:09:28
stacksmith
Could you explain the difference between dynamic-extent and special declarations ?
19:14:41
jackdaniel
stacksmith: dynamic-extent means, that you promise that variable won't escape from the function, so it may be allocated on a stack
19:31:09
didi
Weirdly, the name "dynamic-extent" invokes, in my mind, an image of a variable that has infinite scope.
19:31:22
|3b|
stacksmith: note that "dynamic-extent" is a specific declaration, while "dynamic extent" in prose is a slightly different thing
19:33:15
|3b|
"dynamic-extent" declaration applies to the /objects/ stored in a particular binding, while "dynamic extent" in general might apply to the binding itself
19:36:03
|3b|
so all bindings of a special variable have "dynamic extent" (which is the meaning of the "special" declaration), but are not generally restricted to containing /objects/ with a dynamic extent (the meaning of the "dynamic-extent" declaration)
19:45:17
hjudt
what can i do to completely delete a package? i have the problem that i deleted a package but when i try to reload it (ql:quickload :package), i get the error "The name xxxx does not designate any package. (Condition of type sb-kernel:simple-package-error)", backtrace starting with (sb-int:find-undeleted-package-or-lose "xxx")
19:47:52
hjudt
i have loaded the system before, i do not want to delete files, only the packages i created. but i guess i need to delete the "system" too?
19:47:53
dlowe
in lisp, a package is a bag of names, while a system is a set of build rules and source code
19:50:27
|3b|
loading CL code can make arbitrary changes to the state of the lisp image, so hard in general to undo that loading
19:52:18
hjudt
when i e.g. rename or delete a function or symbol, i usually can use fmakunbound/makunbound to get rid of the symbol. that works.
19:52:53
hjudt
i just don't want to do that manually for cleaning up, it is tedious. i thought deleting packages and reloading the system might solve it quickly.
19:54:05
hjudt
i also entered a few statements at the repl to clean up the history, in case it is not garbage collected.
19:54:46
|3b|
(it isn't 100%, since you will probably end up with various references to the old stuff, for example methods on generic functions from other packages specialized on classes from the 'deleted package')
19:56:07
hjudt
ok, that could be the case. i have three packages in my system, which use each other.
19:58:28
ym
Why there is an ability to return multiple values if I cannot directly pass them as function arguments?
19:59:51
hjudt
|3b|: at the moment no. i am unsure i could disclose it and most of it wouldn't be useful for anyone else.
20:01:03
|3b|
ACTION expects (+ 1 (floor 7 2)) being interpreted as (+ 1 3 1) instead of (+ 1 3) would be annoying
20:02:18
|3b|
and having to write (+ 1 (values (floor 7 2))) to just pass the primary value would be worse than having to do multiple-value-call on the rare occasions of actually wanting to add the remainder too for some reason
20:03:41
|3b|
many functions that return multiple values are used mostly for the primary value, and only a few uses need the extra values
20:04:44
|3b|
it seems wasteful having to wrap all of the common case in (values) to get rid of the extra return values, just to simplify the few cases where you want the extra values /and/ want to pass them as adjacent arguments of some function
20:05:39
sjl
ym: the values aren't returned as a list -- they're returned directly. So you don't need to allocate memory
20:06:03
sjl
Having to allocate a fresh cons cell every time you looked up a value in a hash table would be annoying
20:07:45
|3b|
having to pass (lambda (&rest foo) (car (apply 'some-function foo))) instead of just 'some-function would be rather annoying
20:09:29
|3b|
the responsibility to remember that gethash returns extra values, then wrap it in a lambda to call car on it when you want to pass it to something that only wants a single non-list value returned?
20:13:36
ym
Wrapping in lambda to get only needed value from list is work of programmer, optimizing the code - work of compiler.
20:14:05
|3b|
right, my point is that even if the compiler could optimize it, the code would be annoying and error prone
20:18:05
|3b|
because it is useful (and/or because it was in older lisps that were being standardized)
20:32:33
didi
Because of a discussion earlier, TIL (funcall (let ((*x* 42)) (declare (special *x*)) (lambda () *x*))) => UNBOUND-VARIABLE
20:36:41
Bike
i thought the idea was rather than the function doesn't close over the special binding
20:37:06
|3b|
actually, i guess that doesn't help that case, since the local binding exits before the call anyway
20:38:27
|3b|
don't need a declaration in the function, need an enclosing special binding around the call
2:36:22
jeosol_
is anyone running a web application and could show me their setup. Essentially, settings behind nginx, etc. My eventual is plan is to move to AWS where I have an instance with SBCL but I have not done much.
2:37:58
jeosol_
I have a bias for production web application and I want to start understanding what is involved so set this up.
2:39:03
jeosol_
but my question is around configuration and deployment, e.g., on AWS. I am able to run simple problems on my machine but want to start looking in the area of deployment.
2:39:06
onion
parenscript is also nice. i have only looked at erlang and haskell for servers before cl
2:39:28
onion
if its an sbcl image, you can connect emacs or other dev ide to it and develop while its up
2:39:49
rme
learningtouch.com is a CL-backed web site. It's hunchentoot running behind an Apache reverse proxy.
2:41:05
rme
If I was setting it up today, I might use ngnix, but there were already other Apache-hosted sites on the same machine.
2:41:54
jeosol_
why nginx? that would be better because I use that for my simple example, but have problems adding hunchentoot as proxy. I have only been able to get hunchentoot to work with apache2 in the past.
2:42:28
jeosol_
if you recommend, nginx, better then. I will just find a setup with hunchentoot as reverse proxy.
2:44:18
rme
Apache was easy for me to set up. Ensure mod_proxy is loaded, and then two lines in the config: "ProxyPass / http://127.0.0.1:9999/" and "ProxyPassReverse / http://127.0.0.1:9999/" and I was all set.
2:46:19
rme
Then there's a startup script (run from rc.local or something) that runs the ccl in a tmux session and then loads a little lisp file that configures and starts hunchentoot.
4:06:49
sukaeto
jeosol_: unfortunately, I can't show any of the code, but I maintain a Caveman2 application running behind nginx: https://github.com/fukamachi/caveman
4:07:38
sukaeto
in production, we spawn of some number (dependent on the number of CPUs on the host) of FastCGI workers, each in its own docker container
5:12:42
jeosol_
those running CL web applications, what do you framework do you use? Hunchentoot (raw), Weblocks, Caveman, ...?
5:17:31
jeosol_
Thanks @onion, I am assuming these are battle tested and can be used for serious production app?
5:18:27
jeosol_
I have a back end application and want to develop the front end part, also using React (recommended by some frontend guy, not an expert in this space)
5:18:30
onion
i think woo might be, i will be choosing that myself, ive seen it mentioned today or yesterday in some project
5:19:08
jeosol_
I did give a try in the past and it's the one I invested the most time when I was trying things out.
5:19:11
onion
for front end i will be using Parenscript myself. dont need react or anything, just canvas or GL here.
5:19:21
beach
No, I mean, check with Shinmera whether your potential choices are "battle tested, etc".
5:20:33
jeosol_
michaeljforter says he runs CL apps in production but I sent him a message on Reddit a while ago to see his setup but got nothing. I assume he was busy and forgot
6:31:40
didi
Hehe. I'm reading CLTL2 and this came to mind: (my-post-defined-fn (progn (defun my-post-defined-fn (x) x) 42)) => 42
6:55:08
beach
It can't evaluate the argument before looking for the function, because then it would not know whether it IS a function, and hence not know whether the argument should be evaluated.
6:56:10
didi
beach: IIUC, it can, because if it is not a special form nor a macro, it assumes it is a function.