freenode/#lisp - IRC Chatlog
Search
19:27:12
Bike
and how the implementation FFI works is that it defines some operators that the compiler knows to compile down into code with the correct semantics
19:27:41
Bike
for example on sbcl, sb-alien:with-alien will perform C like stack allocation. cffi's operators wrap around that.
19:28:47
Bike
C implementations define an ABI - application binary interface - so stuff that isn't C can interact with C code/programs.
19:29:05
Bike
well, the implementations don't really define the ABI so much as the operating system... whatever
19:40:59
pjb
nij: with ecl, you can insert C lines of code in lisp functions. Since ecl translates lisp to C, it can easily inject your own lines of C code in the generated code, before compiling it with gcc. This allows you to integrate very nicely with C.
19:42:03
pjb
nij: otherwise, CFFI does not translate to C, but use the implementation specific native FFIs, which are CL operators that directly do native code stuff.
19:43:53
pjb
nij: the ideal tool, would be to have a C parser that would produce the C sources in form of alisp S-expressions. So you could edit C code as if it was lisp code. You could even use the CL macro system to generate more C code. Then the inverse operation would translate the S-expressions into "maintainable" C code.
19:50:06
pjb
nij: for new code there would be no problem using such a technique. But when maintaining legacy C code, the big problem is that the cycle of parsing and regenerating the C code would most probably change a lot of superficial things (indentation and line splits, coding style (from the use of lisp macro, the generated code would be way more homogenous and systematic). Parsing legacy C code can also be problematic. Notably heavy
19:51:24
pjb
nij: nonetheless, it would be very cool to have such a set of tools, that would help use to manipulate foreign language code bases as easily as lisp code bases. To solve the Y2K problems, some good tooling for Cobol has been developped in Common Lisp, to detect and correct the Y2K problems. (But public code AFAIK).
20:00:45
edgar-rft
As soon as a new messiah get's born it's only a matter of time until we'll have the y2k problem again.
20:13:42
gendl__
Hi, is there a way to have swank:create-server pick an available port automatically
20:13:51
pjb
edgar-rft: that said, I'm not entirely sure that when Jesus taked about time, it was in this timeline. Since He's used to eternity, time could have been specified in relative terms (personal times).
23:20:51
jcowan
beach: There is a vocal minority that wants to bring arbitrarily-adjustable strings to the Scheme standards. About 2-3 implementations (out of 60-70) presently provide them.
23:31:46
Nilby
If CL didn't have them, I would have had to make them myself. It's better if the implementation does them, for possibly more efficent memory management. Ages ago when I worked on a scheme, we had adjustable strings. String port can effectively have such a thing, but don't fully expose it.
23:34:26
jcowan
THey are easy to do, assuming you have access to the internals, provided there is an indirection pointer in your existing strings (string object that points to bytes). If there isn't (string object contains bytes), then it's hard; you basically have to do a GC every time you change the size of a string.
23:44:01
Nilby
But it's not like it's a big loss not to have another scheme. We were probably most similar to MIT scheme. I'm sad about the IDE we were building with it though.
23:49:06
pjb
jcowan: indirection is not the key to efficient implementation of adjustable arrays. It's the memory allocator that is key. When you allocate an adjustable object, you may allocate more space, in prevision of size increases, so you don't have to move it when it's extended. This is why it's nice to have it in the implementation: it allows the implementation to use internal features of its memory manager.
23:54:03
perdent
no-defun-allowed how would I acquire the traces to analyze through plotting with lisp though? How would the code look?
23:54:37
perdent
With regard to: (13:05:32) perdent: So I captured the embedded device that was used to encrypt the ciphers I am trying to break. How would I be able to recover its Encryption Key? here is the socket_interface: https://pastebin.com/4z0bwjAT and here is the remote lab layout: https://ibb.co/q9j59Mq
0:05:50
jcowan
pjb: Quite so. But if there is no indirection, then you have to find and change all existing references to the string if you are extending it past the original allocation. That is equivalent to GC.
0:24:47
pjb
jcowan: indeed. On Macintosh OS, most heap objects were referenced via Handlers which were indirect pointers. So the Memory Manager could move them updating only the pointer, and not the handle which could be copied in other objects or variables.
0:25:44
pjb
a lisp implementation could easily use handles to refer objects, instead of direct pointers, if that helped the memory manager/garbage collector.
0:26:30
White_Flame
and indirecting through symbols to find values/functions sort of does that already
0:33:45
andreyorst[m]
does anybody know any clever semi-nontrivial yet somewhat short examples of condition system usage? I'm porting CL's condition system to Lua, and wanted to make sure I got everything right. Example from the Practical common Lisp book works, and a bunch from the lisp wiki too, so if anyone can link some more examples it would be helpful. Thanks!
2:21:57
jeosol
Recently discovered C-c x for slime-export-symbol-at-point and it updates the (:export ...) section of the package with the symbol
2:54:01
jeosol
stylewarning: I did use it with postgresql but with comments that it's bit-rotted, I moved away. I didn't have much problems though for my simple use-case
2:56:24
jeosol
btw, I was hoping to have a conversion with you guys about productivity coding with Lisp. It's a beauty working with slime and all. As some of you know, I am working a large physics application for a few years. I once described it to someone during a work meeting, he said there is no way I wrote all that code in the time I said. By the way, he is
3:03:49
jeosol
I have already written the code - using CLOS mostly. Thanks to working though Sonja's book early one.
3:04:52
jeosol
In my case, I was rewriting more robust versions of graduate school codes. Started with matlab, then C++, then finally to lisp
3:08:15
mister_m
Is it possible to use a parameter list like (:a 1 :b 2) as keyword arguments to an invocation of make-instance?
3:38:24
mister_m
hm I am trying to create a property list to use with make-instance by reading input from a file, and using, for example, (list (make-symbol "input") "value") as a property list for the &rest portion of (apply #'make-instance 'my-class ...), but the resulting initarg is invalid. My class has a slot with an :initarg of :input, but the symbol I end up with as a result of make-symbol is #:|input| and doesn't seem to be compatible. How can I
3:42:07
beach
mister_m: You have two problems. First, using make-symbol creates an uninterned symbol, but what you need is a symbol in the keyword package.
3:42:36
beach
mister_m: Second, even though you would write :input, the name of the symbol is in upper-case.
3:42:56
beach
mister_m: So you first have to upcase the string and then intern it in the keyword package.
3:44:13
beach
When you write :input, that means a specific symbol in the keyword package, and trying a completely different one to pass to MAKE-INSTANCE just won't work.
3:44:35
pjb
and you would have the difficulty of using the same uninterned symbol: you'd have to keep a reference of it at compilation time (when the initarg is defined) and at run-time when it's used.
3:45:48
pjb
(let ((k (make-symbol "input"))) #|runtime class:|# (eval `(defclass koo () ((input :initarg ,k :accessor input)))) (let ((o (make-instance 'koo k 42) )) (input o))) #| --> 42 |#