freenode/lisp - IRC Chatlog
Search
19:11:08
|3b|
cl-opengl users please test https://github.com/3b/cl-opengl/tree/dev with your code, needs more feedback to decide if recent changes are safe enough to release to quicklisp
19:12:34
|3b|
in particular looking for errors like `:foo is not defined as a keyword for enum type #<...>.`, found a few in the examples already, so a bit wary of releasing it
21:40:01
LdBeth
Shinmera: save only the difference between the old and new image instead of a standalone new image
21:47:40
harovali
While trying, some aparent normal uses yielded some conditions, I wonder how to handle that
21:49:25
LdBeth
I see why SBCL can't do so "The system expects to be loaded into a fixed-at-compile-time location in virtual memory"
21:51:25
_death
LdBeth: you could easily do that.. I saved a core to file "one", then ran sbcl --core one and save a core to file "two".. ran bsdiff one two one-to-two ... this created a 900K diff file.. the only issue is that it takes a bit of time
22:07:43
phoe
LdBeth: it supports dumping incremental updates to heap image, except they are called FASLs
23:05:03
jmercouris
the designer of spicelisp apparently invented :-) and :-( https://en.wikipedia.org/wiki/Scott_Fahlman
1:46:58
no-defun-allowed
You can use a special variable: (defvar *a*) (defun abc () (setf *a* 10)) ... (let ((*a* 5)) ...)
1:48:40
no-defun-allowed
DEFVAR is required so that the function ABC knows it is going to modify a special variable, but you can also (declare (special *a*)) in every use of the special variable.
1:49:56
no-defun-allowed
Another option is to use a box (a small structure with one element, or a 0-dimensional array), but then you have to unbox the value to use it and have to setf the value of the box to modify it.
1:50:38
no-defun-allowed
eg (defun abc (b) (setf (box-value b) 10)) (let ((a (box 5))) (abc a) (print (box-value a)))
1:50:51
no-defun-allowed
(The implementations of BOX, (SETF BOX-VALUE) and BOX-VALUE are left to the reader)
1:58:19
pjb
asdf_asdf_asdf: have a look at: http://informatimago.com/articles/usenet.html#C-like-pointers-in-Lisp
2:16:27
pjb
asdf_asdf_asdf: well, actually the problem is the function call, since it's pass by value.
2:17:15
no-defun-allowed
Another solution would be to create a closure and have the function call that to set the value: (defun abc (c) (funcall c 10)) (let ((a 5)) (abc (lambda (n) (setf a n))) (print a))
2:17:19
pjb
asdf_asdf_asdf: you could kludge it with defining defun defmethod let let* progv etc so that all the variables would be symbol-macrolets to closures.
2:27:01
asdf_asdf_asdf
no-defun-allowed, OK. But I want, that in scope (defun abc (c) value was changed, not in scope (let ((a 5)).
2:28:11
no-defun-allowed
Modifying the binding for C that ABC gets won't affect the binding for whatever is in the LET.
2:29:23
no-defun-allowed
You need to pass the value through some kind of "box" as you would in C, or use a special variable to let ABC modify the binding established by LET.
2:30:55
no-defun-allowed
As I said, (defun abc (b) (setf (box-value b) 10)) (let ((a (box 5))) (abc a) (print (box-value a)))
2:31:23
no-defun-allowed
The box can be a CONS (and the value its CAR), a structure with one value which is the box's value, or a 0-dimensional array whose only value is the box's value.
2:31:32
pjb
asdf_asdf_asdf: you are being dumb. This is lexical, therefore the variables are know to YOU when you write the fucking code! Just use different variable names!
2:32:38
pjb
and since we have pass by value, don't try to mutate the variable in functions, instead get the result!
2:33:12
pjb
(defun abc (a) (let ((x 5)) (if (zerop a) (setf a (abc 1)) (setf a 100)) (values a x))) (abc 0) #| --> 100 ; 5 |#
2:44:04
asdf_asdf_asdf
OK, thanks. Maybe I select option 1. How change local var into global var using declare? I (declare (special x)), not working.
5:50:22
beach
harovali: I don't know the answer, but when you use SLIME, it is probably better to use the SLIME inspector.
6:01:57
no-defun-allowed
harovali: If all else fails in Emacs, usually C-g will get you somewhere that isn't where you are.
6:09:07
emaczen`
Here is the link to the bounty: https://www.bountysource.com/issues/75202399-wanted-by-value-structures-in-sb-alien $365! Surely someone here has a decent status update?
6:17:52
Nilby
It's actually not that hard for x96_64 because structs are passed fairly simply, but there are a bunch of edge cases, and to do it for all architectures is much harder.
6:19:15
Nilby
CCL can pass structs, but CFFI doesn't know how to use it, so I started by developing a patch for that too.
6:20:15
Nilby
The only way I got libffi working on windows was to compile it under cygwin and the use it under non-cygwin.
6:21:55
emaczen`
I can use libffi for other functions, but when it involves a struct, I either defined the C struct for libffi incorrectly or used the C struct incorrectly (probably the definition for libffi since I can use libffi in other cases just fine)
6:23:15
emaczen`
beach: It really is only a little bit of C I need, than a few wrappers and then +95% lisp!
6:24:30
Nilby
I just realized maybe I don't really use anything that passes structs on linux. I think opengl interfaces use it though.
6:26:07
Nilby
Actually I don't even have cffi-libffi loaded on linux, so I must have only been forced to use it on window where you have to for kernel calls.
6:27:09
emaczen`
Nilby: I'm using GNUStep, and just about 10% of the methods use really only 4 structs NSPoint, NSRange NSSize and NSRect
6:27:29
emaczen`
there are like 2 or 3 other structs that I am aware of, but they aren't really even used