phoe changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.14, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
dmiles has joined #lisp
sjl has quit [Ping timeout: 244 seconds]
robotoad has joined #lisp
makomo has quit [Ping timeout: 250 seconds]
sjl has joined #lisp
sjl has quit [Ping timeout: 245 seconds]
Guest44017 has joined #lisp
tripty has joined #lisp
Guest44017 has quit [Ping timeout: 252 seconds]
dale has quit [Quit: dale]
pierpal has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
Lycurgus has quit [Quit: Exeunt]
keep_learning_M has quit [Quit: This computer has gone to sleep]
tripty has quit [Ping timeout: 252 seconds]
ebrasca has quit [Remote host closed the connection]
Bike has joined #lisp
scymtym has quit [Ping timeout: 252 seconds]
esrse has joined #lisp
sjl has joined #lisp
dddddd has quit [Remote host closed the connection]
didi has joined #lisp
tripty has joined #lisp
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 244 seconds]
Essadon has quit [Quit: Qutting]
nirved is now known as Guest57884
Guest57884 has quit [Killed (niven.freenode.net (Nickname regained by services))]
nirved has joined #lisp
dale has joined #lisp
robotoad has quit [Quit: robotoad]
keep_learning_M has joined #lisp
robotoad has joined #lisp
keep_learning_M has quit [Quit: This computer has gone to sleep]
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #lisp
keep_learning_M has joined #lisp
didi has quit [Ping timeout: 246 seconds]
terpri has joined #lisp
jcowan has joined #lisp
sjl has quit [Ping timeout: 240 seconds]
robdog has quit [Ping timeout: 250 seconds]
<jcowan> I think I have solved the problem of how to define a function callable only from macros that does not exist at execute time.
iovec has quit [Quit: Connection closed for inactivity]
<jcowan> If you compile this and load the compiled file, poodle will work but noodle will not exist.
<djeis[m]> Can you not just eval-when a defun?
sjl has joined #lisp
<jcowan> No, that doesn't work: NOODLE winds up undefined at compile time for whatever reason
<jcowan> This version works on sbcl, ecl, clisp
<djeis[m]> Well that doesn't sound right... I need to tinker a bit myself now. I mean, I see why yours works, I just don't see why my idea wouldn't.
<Bike> yeah, that should work with defun
Kaisyu has joined #lisp
<djeis[m]> https://pastebin.com/NAP9TzPQ This worked on SBCL at least.
<djeis[m]> I compile-file'd it and then load'd it.
<djeis[m]> poodle was defined, noodle was not.
mrcom has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
sjl has quit [Ping timeout: 240 seconds]
dale has quit [Quit: dale]
<aindilis> hi, I was wondering, I am printing out some data structures and I keep getting an elipses (...) in places instead of the full structure. anyone know the variables to configure or how to eliminate that so I get the full output?
<Bike> clhs print-length
<specbot> Couldn't find anything for print-length.
<Bike> er
<Bike> clhs *print-length*
<Bike> probably that one
<Bike> if not, the other dozen in there
<aindilis> ah perfect, ty!
rumbler31 has joined #lisp
sauvin has joined #lisp
quipa_ has quit [Remote host closed the connection]
<beach> Good morning everyone!
<no-defun-allowed> morning beach!
_whitelogger has joined #lisp
_whitelogger has joined #lisp
rumbler31 has joined #lisp
_whitelogger has joined #lisp
ggole has joined #lisp
atgreen_ has joined #lisp
_whitelogger has joined #lisp
robotoad has quit [Quit: robotoad]
varjag has joined #lisp
varjag has quit [Remote host closed the connection]
Bike has quit []
_whitelogger has joined #lisp
SlashLife has joined #lisp
lisperinmove has joined #lisp
makomo has joined #lisp
notzmv has quit [Ping timeout: 246 seconds]
notzmv has joined #lisp
atgreen_ has quit [Ping timeout: 244 seconds]
msb has quit [Read error: Connection reset by peer]
<LdBeth> good evening
<shka__> LdBeth: hello
<aindilis> hi is there an up to date way to call either Java or Perl from clisp?
<aindilis> or even Emacs Lisp
beach has quit [Disconnected by services]
beach has joined #lisp
<beach> aindilis: This channel is dedicated to Common Lisp.
<beach> aindilis: Perhaps when you said "clisp" you meant Common Lisp? CLISP is a particular implementation of the Common Lisp standard.
<aindilis> I meant CLISP
<aindilis> I have a program written in Common Lisp and I'm trying to get it to talk to my systems
<beach> OK.
amerlyq has joined #lisp
<beach> So if some other implementation, like ABCL is able to call Java, you are not interested?
<beach> Because I think ABCL is meant for that kind of stuff.
<aindilis> well I couldn't compile it for ABCL
<beach> OK.
Necktwi has quit [Remote host closed the connection]
mrcom has quit [Read error: Connection reset by peer]
<LdBeth> aindilis: here's a list of available FFI for lisp https://www.cliki.net/FFI and https://stuartsierra.com/software/perl-in-lisp is one that support Perl 5, however involving JVM is trickier
<LdBeth> I don't think there's a proper Java FFI for CLISP
mrcom has joined #lisp
<aindilis> okay, thanks for now, I tried Perl in Lisp and it couldn't compile against modern perl 5
<aindilis> I'll check out the FFI
<aindilis> I'll be back with more questions later, thanks for your help!
mingus has joined #lisp
zhlyg has joined #lisp
Necktwi has joined #lisp
orivej has joined #lisp
keep_learning_M has quit [Quit: This computer has gone to sleep]
keep_learning_M has joined #lisp
esrse has quit [Quit: happy new year]
<aindilis> ty!
<ogamita> aindilis: notably, ext:run-program, and ext:make-pipe-{input,output,io}-stream.
<aindilis> oh wow
<aindilis> ty again, I think this will do it
<ogamita> aindilis: for an example, have a look at: http://cliki.net/pgl where a lisp program uses a java program to display a GUI.
heisig has joined #lisp
msb has joined #lisp
razzy has joined #lisp
dmiles has quit [Ping timeout: 240 seconds]
dmiles has joined #lisp
robdog has joined #lisp
powerbit has quit [Ping timeout: 250 seconds]
powerbit has joined #lisp
powerbit has quit [Excess Flood]
powerbit has joined #lisp
powerbit has quit [Excess Flood]
Kaisyu has quit [Quit: Connection closed for inactivity]
powerbit has joined #lisp
xrash has joined #lisp
xrash has quit [Excess Flood]
xrash has joined #lisp
xrash has quit [Excess Flood]
makomo has quit [Quit: WeeChat 2.2]
xrash has joined #lisp
quipa has joined #lisp
quipa has quit [Max SendQ exceeded]
quipa has joined #lisp
razzy has quit [Quit: ERC (IRC client for Emacs 26.1)]
ebrasca has joined #lisp
wilfredh has joined #lisp
iovec has joined #lisp
makomo has joined #lisp
rumbler31 has joined #lisp
wanz has joined #lisp
rumbler31 has quit [Ping timeout: 272 seconds]
razzy has joined #lisp
dddddd has joined #lisp
orivej has quit [Ping timeout: 272 seconds]
SaganMan has joined #lisp
atgreen_ has joined #lisp
rozenglass has joined #lisp
neirac has joined #lisp
cage_ has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 246 seconds]
robdog has quit [Remote host closed the connection]
wxie has joined #lisp
random-nick has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 246 seconds]
ggole has quit [Ping timeout: 250 seconds]
LiamH has joined #lisp
makomo has quit [Ping timeout: 246 seconds]
ggole has joined #lisp
wxie has quit [Ping timeout: 250 seconds]
SaganMan has quit [Quit: WeeChat 1.6]
eminhi has joined #lisp
tmokros has joined #lisp
akoana has joined #lisp
tmokros has quit [Remote host closed the connection]
ggole has quit [Ping timeout: 250 seconds]
akoana has left #lisp [#lisp]
bzp has joined #lisp
<bzp> hi all
didi has joined #lisp
warweasle has joined #lisp
<bzp> http://pasteall.org/1443303 How do I make a matrix in this format in lisp?
makomo has joined #lisp
<bzp> please
<beach> So you want a MxN matrix?
<bzp> yes
<beach> (make-array (list m n))
<beach> You can operate on the elements with (loop for i below m do (loop for j below n do ... (aref <matrix> i j)))
<jackdaniel> COS (C Object System) inspired by CLOS (and other implementations): https://arxiv.org/pdf/1003.2547.pdf
<jackdaniel> interesting!
<jackdaniel> it has generic functions and such
<beach> Wow.
ggole has joined #lisp
<jcowan> C, the programmable (with great pain) programming language.
<beach> Yes, I am always amazed about how much energy people are willing to invest in order to avoid learning and using Common Lisp.
<jackdaniel> if someone models an extension after Common Lisp they arguably know the language
<p_l> beach: AFAIK COS happened because a lisper was somehow locked out from using lisp on a project ;)
<ogamita> jackdaniel: Also, I fail to see the point when there's Objective-C.
<p_l> ogamita: different object models
<beach> p_l: Sounds plausible.
pierpal has quit [Quit: Poof]
<p_l> ogamita: and Objective-C is pretty hard to get running outside of Apple/NeXT
pierpal has joined #lisp
<didi> beach: Well, you know how these things go. "Can I use Lisp?" "No." "OK, I'll write Lisp in $LANGUAGE then."
<jackdaniel> so the amazing thing are lengths people go to use lisp ;-)
<didi> :-)
<beach> didi: Yes, it happened to me in my early industry career.
* didi nods
<beach> I had to write a Lisp interpreter in Pascal to make sure I followed company rules.
<didi> Nice.
sjl_ has joined #lisp
<beach> jackdaniel: I wasn't referring to the authors of the paper, but to the potential users.
<p_l> ogamita: also, Objective-C is single dispatch, COS implements multiple dispatch :)
orivej has joined #lisp
elicid has joined #lisp
elicid has left #lisp [#lisp]
<ogamita> p_l: not really. Don't confuse Objective-C with Cocoa.
<ogamita> So, it's a new COS. There was an old COS with usual single inhierting and single dispatch.
<p_l> ogamita: yes really, because the whole setup is much more obscure outside of OSX/NeXT, even if one does not use Cocoa-specific classes
eminhi has quit [Quit: leaving]
<ogamita> p_l: just use gcc -lang=objc ; it's trivial. Of course, you have to implement your own root class…
<p_l> leading up to people needing to write new runtime from scratch at times (in fact, Etoile is based on new runtime because the one included in GCC was shit)
<ogamita> But that's the principe of the IC, so you can buy components and hook them together :-)
acolarh has joined #lisp
makomo has quit [Ping timeout: 250 seconds]
dale_ has joined #lisp
lolimp has joined #lisp
dale_ is now known as dale
Guest44017 has joined #lisp
<jcowan> There is a persistent rumor that the name "CLOS" was chosen to mean "C loss", as in "the thing that makes C lose". Still, most features of Lisp have spread, in original or dumbed-down form, to other languages: why should CLOS be different?
elicid has joined #lisp
pioneer42 has joined #lisp
Essadon has joined #lisp
<ogamita> Indeed.
amerlyq has quit [Ping timeout: 246 seconds]
lolimp has quit [Quit: Leaving]
<jcowan> Well, it's an excellent idea: no separate compiler or preprocessor, strongly statically typed instance slots inside methods but dynamically typed instances outside them. It doesn't have change-class or mutable classes, of course.
<shka__> who works on spycursion?
<didi> How do I set the line ending of a text stream? The file I'm reading uses a different line ending than the convention of my system.
<jcowan> It does have C3, which is better than CLOS-style precedence. (I wonder if C3 could be retrofiited into CL by appropriate (ab)use of the MOP?)
<sjl_> didi: some implementations support that via :external-format. You can also use flexi-streams to handle it.
<didi> sjl_: oic
<didi> I'm already having to use the lovely :external-format :UTF-16LE...
<didi> Who doesn't like a nice game of "Guess the Encoding"?
Necktwi has quit [Quit: leaving]
<sjl_> Yeah, if that's SBCL I don't know if it has a way to explicitly use crlf. Flexi-streams can do it with an external format of something like '(:utf-16 :little-endian t :eol-style :crlf)
<didi> sjl_: Thank you, and it's indeed SBCL.
varjag has joined #lisp
<didi> Ah, this is interesting. Hyperspec says, on WITH-OPEN-FILE, "The consequences are undefined if an attempt is made to assign the stream variable." But the manual for FLEXI-STREAMS has an example that SETQ the stream variable with the following form: (setq out (make-flexi-stream out :external-format :utf-8))
Lord_of_Life_ has joined #lisp
<jcowan> heisig: Thanks
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<jcowan> The link from there to the c3 Chicken egg is borked; it's at http://wiki.call-cc.org/eggref/4/c3 (it has not yet been ported to Chicken 5)
<jcowan> There are some nice simple examples of C3 vs CLOS linearization there.
makomo has joined #lisp
shifty has quit [Ping timeout: 240 seconds]
<sjl_> didi: huh, that's interesting.
<sjl_> presumably it works fine, because closing a fs also closes the underlying stream, and that's the main danger when assigning to the stream var
<sjl_> But yeah, "the consequences are undefined" so an implementation could choose to run nethack or something
Necktwi has joined #lisp
<didi> sjl_: I would run crawl, but still a fine choice.
amerlyq has joined #lisp
<_death> what if there are two variables referring to the stream, and the CLOSE form in the expansion refers to the one inaccessible to the user..
gravicappa has joined #lisp
<sjl_> (defmacro with-settable-open-file ((s &rest args) &body body) `(with-open-file (,s ,@args) (let ((,s ,s)) ,@body)))
<_death> that just demonstrates the issue
<djeis[m]> Depends on what semantics you're expecting out of assignment, I'd say.
<_death> the created stream, assigned to the variable, won't be close on exit.. instead the underlying stream will be closed
<djeis[m]> Which is fine for a flexi-stream, right?
<_death> maybe.. for example it may want to flush before closing
<djeis[m]> Oh fair.
makomo has quit [Ping timeout: 245 seconds]
makomo has joined #lisp
<sjl_> The right way to do the flexi stream example is probably (with-open-file (s "foo" :direction :output :element-type '(unsigned-byte 8)) (with-open-stream (s (flexi-streams:make-flexi-stream s :external-format :utf-8)) (write-line "hello" s)))
<sjl_> Or just with a LET, because flexi-streams specifically says it's fine to just close the underlying stream
robotoad has joined #lisp
makomo has quit [Ping timeout: 244 seconds]
emar has quit [Quit: WeeChat 2.3]
makomo has joined #lisp
bzp has quit [Remote host closed the connection]
shka_ has joined #lisp
Bike has joined #lisp
<shka_> good afternoon
<shka_> stylistic question: how long flet body should be, ideally?
<jcowan> "Long enough to reach the ground".
wanz has quit [Quit: wanz]
pioneer42 has left #lisp [#lisp]
* Inline aims with an arrow at a flying flet
<Inline> lol
marvin2 has quit [Ping timeout: 240 seconds]
rumbler31 has joined #lisp
jinkies has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
marvin2 has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
didi` has joined #lisp
didi has quit [Disconnected by services]
didi` is now known as didi
wigust has quit [Read error: Connection reset by peer]
wigust has joined #lisp
mrcom has joined #lisp
rozenglass has quit [Remote host closed the connection]
pierpal has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
pierpal has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
pierpal has quit [Ping timeout: 250 seconds]
pierpal has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
rozenglass has joined #lisp
amerlyq has quit [Quit: amerlyq]
makomo has quit [Ping timeout: 246 seconds]
makomo has joined #lisp
pierpal has quit [Ping timeout: 272 seconds]
pierpal has joined #lisp
Necktwi has quit [Quit: leaving]
pierpal has quit [Ping timeout: 245 seconds]
sauvin has quit [Read error: Connection reset by peer]
gravicappa has quit [Remote host closed the connection]
<pjb> shka_: as long as a normal function.
<pjb> shka_: ie. not more than a screenful.
resttime has joined #lisp
<pjb> shka_: but most importantly, a function should do only one thing, so it cannot be very big anyway.
pierpal has joined #lisp
quipa has quit [Remote host closed the connection]
<shka_> pjb: fine
heisig has quit [Quit: Leaving]
quipa has joined #lisp
rumbler31 has quit [Remote host closed the connection]
jsjolen has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
quipa has quit [Max SendQ exceeded]
quipa has joined #lisp
<pjb> A "portable" Objective-C application framework: Write apps in Objective C that will run on any platform <https://github.com/ObjFW/ObjFW>
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
quipa has quit [Remote host closed the connection]
quipa has joined #lisp
<shka_> why anyone would want to write in objective C?
<jsjolen> Hi! I'm trying to use the POPCNT instruction in SBCL. I've written this: https://plaster.tymoon.eu/view/1062#1062 but the function only acts as the identity function. Would anyone care to have a look and help me out?
<pjb> shka_: sometimes you want to write in C, and OO is better than plain C :-)
<shka_> objective-C is a monster
<pjb> shka_: but granted, if you want OO, you can use CL or Smalltalk. gst is good.
<pjb> A chimera actually.
quipa has quit [Max SendQ exceeded]
quipa has joined #lisp
<flip214> jsjolen: not sure about the binary API used in SBCL, but perhaps RAX is the input (read at the beginning) and should be the output as well?
<flip214> the POPCNT doesn't use RAX as input, and neither writes to it for output
rjid has joined #lisp
<flip214> jsjolen: you could ask stassats on #sbcl
<jsjolen> flip214: Yeah, I've no idea to be honest.
<jsjolen> That's true, he's not on at the moment though
<flip214> jsjolen: use "minion: memo for stassats: ..." to leave a message
<jsjolen> flip214: https://www.pvk.ca/Blog/2014/08/16/how-to-define-new-intrinsics-in-sbcl/ lol, Paul Khuong saves the day by implementing exactly what I needed :)
rjid has left #lisp [#lisp]
quipa has quit [Max SendQ exceeded]
<pjb> shka_: nope. It has both Smalltalk and C. It's a chimera, not a monster.
quipa has joined #lisp
quipa has quit [Max SendQ exceeded]
trafaret1 has joined #lisp
rozenglass has quit [Remote host closed the connection]
<didi> So... I was a fan of text based data files. I'm not sure I'm anymore. Maybe I'm neutral?
shka_ has quit [Quit: Konversation terminated!]
jsjolen has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 272 seconds]
<didi> My proudest form: (data-data data)
<jcowan> Shi2 shi4 shi1shi4 Shi1 shi4 shi4 shi1, shi4 shi2 shi2 shi1. Shi4 shi2shi2 shi4 shi4 shi4 shi1. Shi2 shi2, shi4 shi4 shi4, shi4 shi2 shi* shi1 shi4 shi4. Shi4 shi2, shi4 shi4 shi4 shi2 shi1, shi3 shi2 shi2 shi3 shi4, shi3 shi4 shi2 shi1 shi4shi4. Shi4 shi2 shi4 shi2 shi1 shi1 shi4 shi2 shi4. Shi2 shi4 shi1, shi3 shi4 shi4 shi3 shi2 shi4. Shi2 shi4 shi4. Shi4 shi3 shi4 shi2 shi4 shi2 shi1 shi1. Shi2 shi2, shi3 shi4 shi4 shi2 shi*
<jcowan> shi1 shi1 shi2 shi2 shi* shi2 shi1 shi1. Shi4 shi2, shi4 shi3 shi4 shi4 shi4shi2. Shi4 shi4 shi4 shi4.
<jcowan> a famous poem in Classical Chinese: that's how it would be pronounced in modern Mandarin.
Mr-Potter has joined #lisp
Zaab1t has joined #lisp
ggole has quit [Quit: ggole]
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
resttime has quit [Quit: Leaving]
Zaab1t has quit [Quit: bye bye friends]
<pjb> didi: I'm still fan: text is smaller than binary.
pierpal has quit [Ping timeout: 245 seconds]
pierpal has joined #lisp
<didi> Is there a straight way to say: give me a new two dimensions array from this old two dimensions array with only these columns?
<pjb> Not in CL. Perhaps in some library.
Guest44017 has quit [Ping timeout: 252 seconds]
Guest44017 has joined #lisp
<jcowan> displaced arrays in CL are very crude by modern standards
elicid has quit [Quit: Quit]
trafaret1 has quit [Remote host closed the connection]
rozenglass has joined #lisp
elicid has joined #lisp
cage_ has quit [Remote host closed the connection]
<drmeister> Printing double-float's in Common Lisp - is there a way to guarantee that no 'd' shows up in the output?
<drmeister> I am dumping JSON and it's complaining about it.
<drmeister> {"_camera_orientation": [62.627064,0,0,0,0,62.627064,0,0,0,0,62.627064,0,-61.0885,-54.538498,-4.899999339613714d-8,1]},"buffer_paths": []}
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
<LiamH> drmeister: I think there's a way to change the exponent letter, e.g. to "e". Would that be better? Or you want no letter at all?
<_death> use ~F?
<drmeister> Yeah - I just found it - it's currently using ~A
<drmeister> I'll do some experiments.
<jcowan> ~E has a parameter exponentchar
evanpeterjones has joined #lisp
<pjb> drmeister: the formats are different, you need to explicitely handle them.
pierpal has quit [Read error: Connection reset by peer]
<pjb> (substitute #\e #\d (format nil "~(~E~)" pi)) #| --> "3.141592653589793e+0" |# could do.
<pjb> but to be sure, check the specifications of both languages.
random-nick has quit [Ping timeout: 245 seconds]
random-nick has joined #lisp
pierpal has joined #lisp
rumbler31 has joined #lisp
<ebrasca> HI
rumbler31 has quit [Ping timeout: 246 seconds]
<nirved> drmeister: (let ((*read-default-float-format* 'double-float)) (format nil "~a" 1d23))
<drmeister> I'm looking at the ~G format - it looks very powerful.
<no-defun-allowed> I couldn't figure out the arguments, but it does sound very useful.
vaporatorius has joined #lisp
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
strelox has joined #lisp
anamorphic has joined #lisp
anamorphic has left #lisp [#lisp]
strelox has quit [Client Quit]
anamorphic has joined #lisp
<anamorphic> Is there a doc or guide somewhere that describes what properties a really good FFI binding should have?
nirved is now known as Guest28396
Guest28396 has quit [Killed (adams.freenode.net (Nickname regained by services))]
nirved has joined #lisp
atgreen_ has quit [Remote host closed the connection]
atgreen_ has joined #lisp
<didi> anamorphic: If I may, it should integrate with the system and not feel "foreign". How to do it? Good luck.
<|3b|> anamorphic: main thing i'd suggest is having multiple layers, so the top can look like comfortable,safe,etc lisp code, but the FFI is accessible if needed for performance etc
<jcowan> anamorphic: It's pretty much a lose-lose situation. If you want an FFI in the language High to provide access to Low, you usually end up writing glue in High that looks like Low, or you end up writing glue in Low that doesn't look like anything much.
<|3b|> so for example one low-level package that exposes the direct C API (but with nicer names, good enum/bitfield/etc definitions, etc) but requires you to deal with pointers and such
<anamorphic> OK I created "foo-cffi" system and a "foo" system which is a bit like that. I hadn't thought much about exporting symbols from "foo-cffi" though
<didi> anamorphic: Oh, it looks like you're at the initial states. You will see. :-P
<|3b|> and high-level package that translates to/from lisp objects (clos classes, vectors, whatever), and has with-foo for any persistent foreign objects needed (like in APIs where you have an 'open' and 'close' function and pass the 'open'ed object to everything else)
<didi> And then you will ask: I can use with-foo to deallocate memory, but it doesn't feel right. Where are the GC hooks?
<anamorphic> For that I've been looking at trivial-garbage
<didi> anamorphic: Yeah. You are on the way.
<|3b|> GC hooks aren't really the right thing, since there is no guarantee any particular object will every be GCd
<anamorphic> But, I think I need to wrap pointers in some lisp object (so that when the lisp object is GCs, so is the foreign object)
<|3b|> particularly for anything that actually allocates scarce resources (FDs, memory on a device, etc)
<didi> |3b|: Agreed. Tho you might want it for in memory objects.
<anamorphic> CL-SDL2 seems to be switching away from trivial-garbage and finalizers recently. Is that why?
<didi> Then there are the callbacks.
<|3b|> even with memory i'd avoid it
<|3b|> anamorphic: even worse for something like SDL, where things are allocated within a transient context
<didi> |3b|: I see. Then I'm with jcowan.
<|3b|> since things might be GCd at any point in the future even when that context is no longer valid
<|3b|> didi: for memory i'd just translate it to CL memory that can be GCd normally if at all possible
<|3b|> and/or with-foo
<anamorphic> For callbacks, I started with cffi:defcallback, but I really wanted to pass things like #"(lambda (foo) ...) instead. I don't think I could funcall a defcallback'ed thing. So what I've been experiementing with is a sort of event queue. defcallback pushes the event onto a queue/list where it's associated with a funcallable Lisp thing
<didi> with-foo sounds like a good compromise, tho not system-like-mine enough for me.
<anamorphic> I have a strong suspicion I'm doing it wrong, or it's been done better elsewhere though
<|3b|> i tend to write a callback that funcalls a normal lisp function in a global
<didi> anamorphic: Ah, I think we talked about it before, didn't we? Use a hash table.
<anamorphic> didi: yes, that what I needed that for
<anamorphic> didi: I ended up using genhash
<didi> Cool cool.
<didi> You can use a global counter too. And have fun with race conditions.
<anamorphic> A global counter?
<didi> anamorphic: Yes. Usually callbacks accept an user data. So you pass, as the user data, an integer, generated by your global counter, and at a central callback, you read this integer and use it to fetch the lambda from the global hash table.
<didi> You probably can't pass addresses as user data because some implementations have moving GCs.
vaporatorius has quit [Quit: Leaving]
<anamorphic> Hmmm cool, I have a couple of callbacks to FFI that involve a "void *userdata" and I kind of glazed over those.
<didi> :-)
<anamorphic> Thanks for that tip! Sounds like you've build a few FFI bindings yourself
<didi> anamorphic: Yeap. Don't do it. ;-)
<didi> Unless you have to. Than Thank God we can.
<didi> Then*
<anamorphic> Do you know if anyone's written quicklisp systems for doing nicer callbacks and user data counters? I'm barely know what I'm doing, and it just feels wrong
<didi> I do not.
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 268 seconds]
wilfredh has quit [Quit: Connection closed for inactivity]
asarch has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Kundry_Wag has quit []
sjl_ has quit [Ping timeout: 246 seconds]
bendersteed has joined #lisp
<pjb> anamorphic: the problem for a good FFI is to have all the required information. When you target C, it is difficult, because the C pre-processor and compilers tend to lose information. This is why we try to process the source headers. But this is imperfect, because it's also C compiler dependent (eg. the handling of #pragma pack in Cocoa headers!). An alternative that could be available is to process the binaries, if they have
<pjb> "debugging" information (dwarf, gdb -g3, etc). Then even preprocessor macro definitions may be available, from the binaries.
<pjb> anamorphic: so, I would say, the first rule for a good FFI, is to target a different language than C.
<pjb> anamorphic: but since the second rule for a good FFI is to be able to use any libraries installed on the target systems, most of them will have a C API, which is contradictory with the first rule.
<pjb> anamorphic: therefore, good FFI is impossible.
<pjb> FFI: just say NO!
<pjb>
<pjb> Friends don't let friends use FFI.
<anamorphic> Yeah I just ran across a nice enum, and then I discovered a function that interprets -1 as something special not listen in the enum :(
<anamorphic> *listed
<pjb> anamorphic: now, there's one part where you could provide something, but not automatically in any case: it's the Linux syscalls.
<pjb> Then we could implement a libcl and use that instead of libc.
<anamorphic> Yeah that is the ultimate interface, I guess
mrcom has quit [Read error: Connection reset by peer]
orivej has joined #lisp
<anamorphic> I wonder if the Linux ABI is in some some machine readable format
<pjb> anamorphic: of course. In Cocoa headers, there is a NS_ENUM(int_type) macro to be used instead of enum so that a typedef with that integer type is used. So you can define an enum with 2 unsigned char values that is actually a 64-bit integer, and stored and passed as such. This is important for ABIs.
<pjb> anamorphic: yes, it is.
<pjb> In linux sources.
sjl has joined #lisp
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
anamorphic has quit [Client Quit]
anamorphic has joined #lisp
anamorphic has quit [Client Quit]
shifty has joined #lisp
<drmeister> no-defun-allowed, nirved, pjb, jcowan: Thank you for the feedback.
<drmeister> I ended up using the ~G format specifier.
<drmeister> (format nil "~,6,,,,,'eG" thing)
<no-defun-allowed> Nice, you did figure ~g out.
<pjb> drmeister: be sure to verify that it works consistenly across implementations. ~F and ~G are known to be partially implemented at best.
<drmeister> Gah - that's horrifying.
<pjb> Yes.
<no-defun-allowed> I got lazy and wrote a helper function that switched between ~e and ~f, reimplementing ~g basically.
<drmeister> Actually - that's the nice thing about implementing your own Common Lisp - I only need to worry about one implementation.
<pjb> Conformity bug reports may be in order if you find a case where it doesn't work as it should.
<pjb> :-)
neirac has quit [Read error: Connection reset by peer]
evanpeterjones has quit [Ping timeout: 246 seconds]
zotan has quit [Ping timeout: 250 seconds]
zotan has joined #lisp
strelox has joined #lisp
vhost- has quit [Quit: WeeChat 2.2-dev]
strelox_ has joined #lisp
sjl has quit [Ping timeout: 246 seconds]
strelox has quit [Ping timeout: 268 seconds]
zotan has quit [Ping timeout: 268 seconds]
zotan has joined #lisp
LiamH has quit [Quit: Leaving.]
zhlyg has quit [Ping timeout: 268 seconds]
strelox_ has quit [Quit: Mutter: www.mutterirc.com]
powerbit has quit [Ping timeout: 268 seconds]
powerbit has joined #lisp
powerbit has quit [Excess Flood]
Mr-Potter has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
rumbler31 has joined #lisp
powerbit has joined #lisp
makomo has quit [Ping timeout: 250 seconds]
rumbler31 has quit [Ping timeout: 240 seconds]
runejuhl has quit [Ping timeout: 244 seconds]
rumbler31 has joined #lisp
robotoad has quit [Quit: robotoad]
runejuhl has joined #lisp