freenode/#lisp - IRC Chatlog
Search
11:50:16
Shinmera
no-defun-allowed: Shoulda watched my streams ;) https://github.com/Shinmera/flow/blob/master/graph.lisp#L131
12:40:43
jonatack
Just realised how good the logs are for this channel. Thank you to the kind people who maintain them!
15:14:04
asdf_asdf_asdf
int = 5; void a(int &n) { n = 2; } std::cout<<i; // 5 a(i); std::cout<<i; // 2
15:16:10
Bike
i think you've been told this before, but if you insist on asking sbcl specific questions instead of using cffi, ask #sbcl. they'll probably tell you to use cffi and you should probably listen
15:37:09
Bike
also, with fixnums, like in your attempt at a C++ analogy, it definitely won't work since they're just immediate and do not have addresses
15:38:30
asdf_asdf_asdf
@Bike; OK. Then how change value variable inside function that will be changed outside function?
15:39:23
Bike
You cannot pass a reference like you can in C++. You can only pass values as arguments.
15:39:51
Bike
You can do things like (let ((x 2)) (print x) (funcall (lambda () (setf x 5))) (print x)), which will print 2 then 5.
15:40:42
Bike
Lisp just does not have references. You can pass objects and modify objects: (let ((x (cons 2))) (print (car x)) (funcall (lambda (c) (setf (car c) 5)) x) (print (car x)))
15:41:16
Bike
But lisp has an entirely different model of things from C. Variables do not "have addresses".
15:42:03
asdf_asdf_asdf
@Bike; Did it mean, that every time variables has different/other/another addresses?
15:45:18
Bike
If you write something like (let ((x 2)) ...) for example, there's nothing stopping the compiler from simply storing 2 in a register, or perhaps using a different register for the same variable in different places, or maybe it will put it on the stack, or maybe it will eliminate the variable entirely and the value won't even exist in a register.
15:47:56
asdf_asdf_asdf
OK. So, why in SBCL are instruction such as get-lisp-obj-address, int-sap, etc?
18:08:12
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=69fe575d will be valid until 18:15 UTC.
18:10:01
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=69fe575d will be valid until 18:15 UTC.
19:13:30
asdf_asdf_asdf
Hi again. (describe (function sb-alien::define-alien-callback)). How it fix?
19:13:50
asdf_asdf_asdf
The :macro name SB-ALIEN::DEFINE-ALIEN-CALLBACK was found as the argument to FUNCTION.
19:18:10
verisimilitude
Based on the message you gave, you're giving an invalid argument to FUNCTION, it seems.
19:18:28
verisimilitude
My suggestion, asdf_asdf_asdf, is to avoid writing C when one is ostensibly writing Common Lisp.
19:22:53
jonatack
asdf_asdf_asdf: http://www.sbcl.org/manual/index.html#Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface
19:29:38
asdf_asdf_asdf
Thanks all for help. Especially kpoeck, it works. Thanks. I thinked, that is a fuction not a symbol.
20:08:03
asdf_asdf_asdf
Hi again. Which function is to definition callback without body? https://cpy.pt/F8nzKM7a
20:13:56
asdf_asdf_asdf
Lambda-list: (SB-ALIEN::NAME SB-ALIEN::RESULT-TYPE SB-ALIEN::TYPED-LAMBDA-LIST)