freenode/#lisp - IRC Chatlog
Search
16:26:32
pfdietz
The user has not given an explicit value, but the standard says what the value is. It's NIL.
16:27:28
pfdietz
"3. At the moment the scope of the declaration is entered, the consequences are undefined if the value of the declared variable is not of the declared type. "
16:27:34
spm_
Xach: Thanks. Yes, I figured out how to not have the problem, but am not clear regarding in-what scope the quoted list becomes defined, and what happens on subsequent calls to the function.
16:27:46
pjb
spm_: the init-form is evaluated at call-time, only if no matching keyword argument pair is given.
16:28:06
Bike
spm_: nothing to do with &key. you are editing quoted data, which is always undefined behavior.
16:28:36
pfdietz
"The scope of a bound declaration is the same as the lexical scope of the binding to which it applies; [...]"
16:29:07
pjb
spm_: so the question is whether you want the same list or a new list each time: https://pastebin.com/sz43meDi
16:29:47
Xach
sbcl can be quite helpful with warnings about modifying quoted/literal data, but it doesn't catch everything
16:32:49
spm_
pjb: Yes. new value each time was what I was after, and not what I was seeing. My thinking was that a new quoted list would be created each time the function was entered if it wasn't provided.
16:35:07
Xach
spm_: possibly because someone could pass a keyword and the warning wouldn't apply...not sure.
16:35:57
pjb
(defun f (&key (x (error "You need to pass a :x argument!")) y) (list x y)) (f :y 42) #| ERROR: You need to pass a :x argument! |# (f :x 42) #| --> (42 nil) |#
16:36:31
spm_
Thanks for the assist. I need to do more reading on compile/init of functions as the "why" still isn't fully clear to me, but if the behavior of modified quoted literals is undefined, then I certainly ought not do that. :-)
18:19:32
AeroNotix
each logger within a system/package/function highlights which logger it came from within the slime repl, which then exposes that logger as something you can interact with (forget what slime calls it, the C-c C-v TAB things) that you can then configure right within your REPL.
18:42:25
jackdaniel
having mcclim work on windows requires Xserver run on windows and this is a tedious thing to make it work
18:42:33
epmor
Already tried, it was after libssl32.dll and some other DLLs tht were difficult to get working on windows
18:42:54
dim
jackdaniel: did you try with the Xserver embedded in https://mobaxterm.mobatek.net already?
18:44:36
oni-on-ion
he is more so askin about xplat gui than how to get clim working on windows, imo
18:45:21
jackdaniel
when I'm doing something on windows (usually testing in a VM) I grab cygwin, install emacs and operate from eshell
18:45:37
jackdaniel
I suppose it is lame by windows standards, but I easily get confused how to get thigns working there
18:48:56
dim
jackdaniel: it embeds a full Xwindow server so I think it might be useful for your tests, and also it comes with unix developer tools and an apt-get command, so, it might help…
18:49:07
makomo
i need advice regarding a DSL. i've written it up here as a comment, with an example of the DSL below: http://plaster.tymoon.eu/view/917#917
18:49:27
dim
I'm not sure how much you would improve towards a typical windows user, but if you manage to reduce your environement dependencies to a single app that'd not be too bad
18:53:44
makomo
even if i did use methods for that (instead for example, FUNCALL-ing and creating the functions myself), i still need to use the process' body to create this function
18:54:28
makomo
and the process' body isn't valid Lisp code right away. it requires some analysis to inject proper LETs and such
18:54:52
makomo
shka_: right now it's a normal function. <- being a macro is just one proposed solution
18:55:48
makomo
well, i do too :-), but i need a way to walk the :process bodies and find all of the signals (<- **HERE** <expr>)
18:56:59
makomo
:signals are internal signals of the component. the thing i'm looking for is finding "drivers"
18:57:19
makomo
if a process ever assigns to an internal signal, it counts as a driver for that signal
18:58:25
makomo
yeah. the fact that these are implemented as Lisp functions internally doesn't mean anything
18:59:20
makomo
well actually, i'm not so sure i can go about it that opaquely. the :process' body is arbitrary Lisp code
19:00:11
makomo
because this process attempts to assign to A (even if it never does so within an actual simulation), it counts as a driver for A
19:02:19
makomo
i'm not sure how to do that. either a code walker or making <- a macro and doing it at macroexpansion time (and also arranging for <- to be macroexpanded in the first place)
19:02:57
makomo
shka_: they are, since there isn't really a way for me to restrict that. the DSL assumes that a :process' body will be "well behaved"
19:04:17
makomo
but this is something i don't care about, because the alternative is writing my own language from scratch
19:04:47
makomo
no, it is evaluated and who knows what happens. the condition bubbles up the simulator and aborts it
19:05:16
makomo
i could also modify the simulator's internals within a process for example, which is also insane
19:05:20
_death
using a code walker can make sense.. but even a dumb tree walker approximation may work for a POC
19:05:47
makomo
_death: eventually i want to introduce helper macros and such for patterns that arise in VHDL itself
19:07:41
makomo
so it's as complex as Common Lisp itself. that's why i need a code walker to do it properly
19:08:25
_death
right.. I learned about agnostic-lizard during ELS, and the code looked nice, may want to check it out
19:11:05
shka_
basicly build lambda form with whole body + macrolet for <- that basicly signals symbol passed as first argument, then call compile on it
19:11:36
makomo
yeah, that's almost the same as the macroexpansion solution, except you avoid the manual call to COMPILE
19:12:54
makomo
shka_: i'll already have to do something like that for these internal signals though
19:13:14
makomo
see how there are no LETs within the process? it's implicit that the process can access the local :signals of the component
19:17:14
makomo
shka_: another reason why i want the process' bodies to be arbitrary lisp code is for various reporting functionality and interaction with the simulator itself
19:17:43
makomo
for example, you could imagine a "debugging protocol" that a component could support and implement, that would allow one to debug the defined component
19:20:07
makomo
hm, but the code walker will probably yell at me if i try to walk the incomplete body (as its specified by the user), right?
19:21:25
makomo
so i would have to generate the whole body before i can walk it (which isn't an issue, i think; just mentioning it)
19:24:14
makomo
ideally i would use something portable (although that's hard to achieve for a code walker), but as an initial iplementation, an internal code walker would do as well (sb-walker is the easiest to get)
19:24:40
pfdietz
shka_: thank you for that. There's an issue in Waters' COVER package that might solve (how to get from macroexpanded code back a representation of the source code it came from, to produce useful output). COVER's solution is a bit of a hack that isn't compatible with some macros, like ITERATE.
19:26:49
pjb
Bike: See https://github.com/informatimago/lisp/blob/master/common-lisp/lisp/relative-package.lisp#L106
19:28:16
shka_
it is ironic that it is easier nowadays to read lisp code from stream or string, use eclector.concrete-syntax-tree and walk that then actually deal with lists
19:33:40
Xof
makomo: not really tested, but: https://gist.github.com/csrhodes/8d74a1749a042a780d4c4ef1a42a6752
19:38:31
scymtym
Bike: it's a spec but there is also http://www.sbcl.org/manual/index.html#Package_002dLocal-Nicknames
19:49:37
pfdietz
Just sexprs. It also produces small structures that get stored in the compiled code (more properly, regenerated at load time using CL's mechanics for that so you aren't clobbering constants values) to record when parts are visited.
19:51:04
pfdietz
Richard Waters' portable CL coverage package. It records what part of your code you've executed.
19:52:27
pfdietz
It should be, but I think there may be portability issues? Was thinking of uploading it to github anyway (I think it's off on an ancient CMU lisp archive site.)
19:53:39
pfdietz
At one point I modified COVER for my own use to allow some extensions, like recording of coverage information in a file (so it could be combined from separate test runs) and checkpoint/rollback of coverage (useful for minimizing test cases under the constraint they still increase coverage.)
20:00:01
scymtym
eclector and concrete-syntax-tree would probably allow producing sb-cover-style annotated sources as output
20:25:23
AeroNotix
It requires that you compile your files with certain declaims active and then deactivate those declaims when you want to compile other files.
20:26:14
aeth
oni-on-ion: #'foo is the function object foo, 'foo looks up foo so if foo is redefined the 'stale' object isn't used.
20:31:39
aeth
oni-on-ion: (defun foo () (print "Hello")) (defun bar (f) (funcall f)) (let ((a (vector #'foo 'foo))) (bar (aref a 0)) (defun foo () (print "Goodbye")) (bar (aref a 0)) (bar (aref a 1)))
20:45:05
aeth
oni-on-ion: I don't want to say something incorrect, and there are test cases I wrote where even #'foo uses the redefined function (at least in SBCL), such as directly binding #'foo in the let instead of placing it in a vector
20:45:14
aeth
i.e. (defun foo () (print "Hello")) (defun bar (f) (funcall f)) (let ((f1 #'foo) (f2 'foo)) (bar f1) (defun foo () (print "Goodbye")) (bar f1) (bar f2))
20:50:01
aeth
Is there a way to check that object foo implements a method for the generic function quux? More concretely, I have an unwind-protect that is supposed to clean up all of the foreign OpenGL data at the end of the program. This actually would be a good candidate for a generic (and performance is not absolutely an issue since it's run once, at the end).
20:50:28
Bike
You can look up whether a generic function has an applicable method for a given class.
20:51:27
aeth
Bike: I think the user would probably be in for quite a surprise if (cleanup foo) failed because cleanup isn't defined for foo, and it probably would be a good thing to check for before starting instead of letting the user potentially leak memory upon closing the program. (A leak because the REPL will probably keep running.)
20:52:14
Bike
i'd usually like to avoid relying on that kind of introspection in the middle of a program, but that doesn't seem unreasonable.
20:54:07
Bike
because that method couldn't actually do any cleanup, not knowing anything about the object
20:55:14
aeth
pierpa: Even if I made it (error "You need a cleanup") instead of doing nothing, it would still be bad here.
20:56:03
Bike
oh, and you should note that compute-applicable-methods is probably going to be pretty slow.
20:56:19
oni-on-ion
AeroNotix: yes, i know. i assumed you asked because of what the library is for,not that just because its a lisp library.
20:56:37
aeth
pierpa: This is a window object. It is, ideally, run in a with-window or something along those lines, that ultimately has an unwind-protect that calls (cleanup-gl-data gl-data)
20:56:42
oni-on-ion
AeroNotix: so if you needed help with how it works and concepts behind it and whatever. no worries
20:57:02
aeth
pierpa: That's an unnecessary dependency on my gl-data object for something that's incredibly general
20:57:28
aeth
I could replace it with a cleanup generic, where there's a cleanup method implemented for gl-data. Then gl-data depends on window instead of window depending on gl-data
20:58:12
aeth
But if you pass in something else (vk-data?) that doesn't have CLEANUP, it will leak memory
20:59:20
aeth
(This is for 3D games. You're always going to have foreign data to cleanup. The options are essentially OpenGL, Vulkan, DirectX, etc. And if one day you don't need to do this, you can just make it a no-op safely.)
21:01:38
aeth
pierpa, Bike: Generally, I try to get an error early, when it's still entirely in CL, before the CFFI complicates things.
21:03:02
aeth
I guess I could make it (defgeneric cleanup (object &key actually-do-something-p)) but that seems like a big hack
22:55:52
drmeister
Folks, recently sbcl shebang scripts stopped working for me. I wonder if a kind soul with a few minutes could test something on their system.
23:00:01
oni-on-ion
it is too much to swithc workspace and type a few chars. had to do that with URL, sorry i am a bit disabled computer user =)
23:02:57
Colleen
Bike: drmeister said 51 minutes, 39 seconds ago: It just occurred to me - we are also generating a lot of metadata when generating llvm-ir - I wonder if that is costing us a lot of compilation time.
23:21:08
drmeister
Hmm, I upgraded to 1.4.11 and I noticed that the /usr/local/bin/sbcl was a symlink - so I switched to the direct path...
23:22:01
drmeister
Still no love from shebang scripts? Am I going mad? Have my years of wild hedonism taken their toll on my mind and my ability to write and execute unix scripts?
23:22:57
whartung
does sbcl work without the shebang? is shebang any different from sbcl with the code funneled in via stdin? Have you tried that?
23:37:00
drmeister
brew puts a shell script that sets the SBCL_SOURCE_ROOT environment variable and then invokes sbcl
23:43:22
drmeister
Ok - well, thank you everyone - now I don't need to rewrite all of my sbcl scripts for profiling
23:44:07
jasom
drmeister: things like this have caused me to not rely on shebangs at all, but rather use here documents.
23:50:26
drmeister
I was trying to be fancy and have one shebang script that did everything and then symlinked to the shebang script and it did different things based on what the first argument (program name) was.
23:56:37
jasom
drmeister: you can still do that with here scripts, and you can implement the multi-executable idea in either lisp or sh at your choice
23:59:25
drmeister
Here's what I'm trying to accomplish. We use dtrace to profile clasp. I have a script called 'stacks.lisp' that checks the sb-ext:*posix-argv* arguments for the name....
0:08:00
makomo
drmeister: right, but i was wondering what would happen when sbcl dies. looks like the exec builtin *replaces* the shell process
0:09:38
drmeister
The only wrinkle is communicating the arguments - they need to be escaped when they are put into *script-args*
0:13:22
jasom
drmeister: I put them in *script-args* because sbcl leaves all of the toplevel options in, and I didn't want to have to filter
0:14:25
jasom
drmeister: I have a script that puts them all in a list shomewhere so you can use "$@"...
0:14:27
drmeister
--eval "(defvar *script-args* '( $# \"$0\" \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" ))" \
0:15:29
jasom
drmeister: also this assumes that there won't be any #\" characters in the arguments. Fortunately it's an easy fix if you care
0:15:31
drmeister
./count-calls a b c --> (3 "./count-calls" "a" "b" "c" "" "" "" "") I'm printing the *script-args* at the start.
0:16:31
drmeister
No - that's ok - these don't need to bullet proof. They just need to handle argument lists like: -i foo -o bar -s baz
0:17:57
drmeister
These scripts that handle dtrace output parse and query dtrace output full of backtraces - it's stuff that only someone practiced in the art will use.
0:19:01
jasom
something like: "'( $(for item in "$@"; do printf '"%s\"' "$(escape "$item")"; done) )"
0:26:05
jasom
drmeister: IMO the for loop version will be better than a length prefix anyways even if you don't add in the escaping.
0:48:38
aeth
I think I can just take all of the methods and functions I use for freeing and similar things and just make them methods on a generic CLEANUP
0:49:32
aeth
(This code interfaces with foreign libraries so the GC can't be relied on here. Or, more accurately, it's way more complicated to rely on the GC than to just have a bunch of WITH-FOOs built on top of UNWIND-PROTECT calling CLEANUP)
1:34:27
gendl
I know you can intersperse regular Lisp forms like dolist, then drop back into lhtml with (htm ...)
1:35:16
no-defun-allowed
[here](https://gitlab.com/Theemacsshibe/cl-pixelcanvas/blob/master/bot/pages.lisp#L23)
1:37:56
no-defun-allowed
can slime do emacs-style symbol shortening? for example, sa-l-a-d becomes save-lisp-and-die
1:41:04
gendl
within the body of the with-h-o-t-s, I want to call another macro which itself returns valid lhtml.
1:41:39
trn
beach: I have a couple of questions for you about the old Ford network that I'm hoping you can answer in regards to 3270 apps on Multics at Ford .
1:45:07
trn
beach: Specifically, did 3270 users login a 3270-related project that defined a restricted process_overseer_?
1:45:38
trn
beach: Or did they login to a standard project via the answering service as usual users?
1:45:46
gendl
like you said, I just had to wrap (htm ...) around the lhtml which my macro was emitting.
1:46:35
gendl
doing it like that, I can include calls to macros at will within my with-html-output-to-string and similar.
2:38:09
AeroNotix
http://man7.org/linux/man-pages/man2/timer_create.2.html is there a library out there that exposes this?
2:41:24
AeroNotix
I was looking in the sb-* docs. I thought timer related things would be under sb-posix/sb-unix
3:01:17
trn
beach: No problem, thanks anyway. We're trying to see if some behaviour we are seeing is something we are doing wrong, need to fix, or the way it actually was. :)