|CL_EQL: use Qt from any CL + CFFI||polos||12/1/12 3:11 AM|
A (maybe a bit crazy) idea which I hade some time ago is now ready:
Using Qt interactively from any CL + CFFI + Slime (no CL threads needed).
It requires only CFFI and a small C++ plugin, and of course "EQL local-server".
See file "CL_EQL/README.txt" for more info:
|Re: CL_EQL: use Qt from any CL + CFFI||thrall||12/13/12 3:52 PM|
I find this very interesting, partly because I had a similar idea (based on the experience that EQL was the most pleasant common lisp gui toolkit, but ECL is rather inferior to e.g. sbcl when it comes to Slime and debugging), but as yet haven't the knowledge or experience with lisp to be able to implement it myself.
I have been trying CL_EQL out with a little experimental GUI application I'm writing. Since I had tried to keep gui code in a separate package from the start, it was quite simple to modify the EQL ui code to work with CL_EQL. Most of it works very well.
I currently have one problem. If I wish to call a CL function from the EQL server side using '?', but wish to use the value of a server-side symbol as an argument, I can't, as the symbol name isn't evaluated until it has been received by the CL client. (It is of course possible that this does work and I simply haven't worked out the correct way to do it, but I can't find an example of a ?(function with args) in any of the examples)
For example, on the CL end, I enter this into sbcl (in case it isn't obvious, with the behaviour I want, this code would print "eql-var:2" from the CL client side):
#q(let ((eql-var 2))
?(format t "eql-var:~a~%" eql-var))
I then see this in the "EQL server":
(let ((eql-var 2))
(local-server::%remote-eval '(FORMAT T "eql-var:~a~%" EQL-VAR)) )
It appears the whole sexp following the '?' is quoted, without having evaluated eql-var on the server side.
Finally, back on the CL side, I get:
The variable EQL-VAR is unbound.
[Condition of type UNBOUND-VARIABLE]
which makes sense, because the symbol eql-var exists on the EQL server side, not the CL client. What I really wanted the server to send for evaluation by the client, was '(FORMAT T "eql-var:~a~%" 2).
I'm not sure what the best way to do this would be. I imagine, either to evaluate all arguments on the server side before sending the expression to the client, or perhaps to introduce some syntax (a bit like ',' in backquoted lists) to allow selective evaluation of symbols in the list before it is sent (It might even be useful to be able to evaluate the first symbol in order to retrieve the function name from somewhere).
|Re: CL_EQL: use Qt from any CL + CFFI||polos||12/14/12 6:30 AM|
2012/12/14, thrall <taha...@gmail.com>:
> #q(let ((eql-var 2))thanks for your suggestion, it was easy to implement using commas for
So, your example would now be:
?(format t "eql-var:~a~%" ,eql-var)) ; use a comma for evaluation in EQL
(You don't need to use a backquote, as this is already done in "q.lisp").
|Re: CL_EQL: use Qt from any CL + CFFI||thrall||12/14/12 11:48 AM|
Thanks for this!
One more issue I've encountered: Sending and receiving an array works, but by printing the array into literal notation, then reading it back in, some information is lost, e.g. element-type. As an example of when this could be important, if one creates and populates an array of type '(unsigned-byte 32) in CL, then sends it to EQL server to be made into a QImage using make-qimage, it produces this error:
MAKE-QIMAGE/BYTES cannot process vectors with an element type of T.
Although the elements in the array should still be within the correct range, they have been read into a new array with assumed element-type of T, so cannot be used by make-qimage.
As far as I'm aware, it is not possible to modify the element-type of an array after creation, so short of introducing a new literal array syntax which includes the element-type, along with an element-type -aware reader macro to read it, I'm not sure how to solve this elegantly. (An obvious workaround is to create a new array with the correct type and copy the elements accross, but this has many disadvantages)
|Re: CL_EQL: use Qt from any CL + CFFI||polos||12/14/12 1:56 PM|
2012/12/14, thrall <taha...@gmail.com>:
> One more issue I've encountered: Sending and receiving an array works, butI have no quick answer here, only a vague idea:
Integrating the nice (Quicklisp installable) "cl-store" library on
both sides (CL and EQL):
I think this could be both convenient and fast.