<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.
<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>
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..
<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?
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.
<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]