logo
IRC Archive / Freenode / #lisp / 2010 / May / 27 / 4
Andrii_Torba
(setq (nth 2 ddd) <new value>)??
LiamH
(setf (nth 1 ddd) 777)
sellout
Andrii_Torba: forget about setq, just use setf all the time.
Andrii_Torba
thanks alot
kiuma
Is there any example or client app in CL that reads emails via IMAP ?
attila_lendvai
dlowe: pull cffi?
dlowe
attila_lendvai: I'm using the latest stable?
attila_lendvai
dlowe: i use the head from http://common-lisp.net/project/cffi/darcs/cffi
and i'm on iolib head
hrm, almost on head. i'll pull both of them to double check
dlowe
it's our own lispy version of DLL hell
attila_lendvai
well, dependencies will always be a headache in big systems
Xach
kiuma: the original, i think.
attila_lendvai
dlowe: cffi and iolib head seems to work fine here
Xach
kiuma: sorry, apparently it was in interlisp
dlowe
attila_lendvai: yeah, that was the issue
kiuma
Xach, using java libs is the thing I want to avoid at any cost, but the only thing I've been able to test is mel-base, then when it's time to read the message body, the stream is not in a usable format
dlowe
attila_lendvai: does iolib really qualify as a big system? :p
Xach
kiuma: You could always write Lisp code that does what you want.
blandest
Xach: you mean implementing the whole IMAP RFC ? :)
kiuma
yep, I could do everything , but it's somewhat to start from 0 or nearly
blandest, mel-base implements a bit, but extractions need to be managed, they are not 'ready to use'
Xach
blandest: It'd be more interesting than the current frequent requests for someone else to tell him where to download a pre-existing solution.
Guthur
Well obviously you probably don't have to implement the server side of IMAP
So just get working on an IMAP client, and tell us when you are done, hehe
kiuma
:P
Xach
Also, Lisp lets you write software faster. So you might already be done by the time you find what you need.
blandest
I agree, but it usually depends on what the application needs to do
p_l
also, IMAP isn't that complicated of a protocol (it's a sweet one, IMHO, with all that async. support)
stassats
i'd go with "implement what you need"
kiuma
I was checking a solution based on mel-base + cl-mime
mathrick
Xach: the complexity of IMAP comes from the utter brokenness of the RFC as well as all the implementations out there
that's the category of software that's slow to write because the problem domain is stupid, and Lisp won't help you much
p_l
mathrick: RFC broken? Care to elaborate?
IMAP was always the protocol I had the least issues with when it came to email...
hypno
Hooking UW IMAP is probably done in a hour or so tho, with the proper tools. Then you only have to wrap up the API to be lisp friendly, but that part is easy and fun compared to implementing all of the rest of the bullsh*t. :)
mathrick
p_l: sure. For instance, it assigns unique IDs to messages that are valid for the duration of the validity of "session token" generated by the server. And the server can make a new token whenever it feels like, say when you connect.
which means your IDs are not IDs anymore
and you need to pull everything again and try to match it against what you remember of your inbox from the last session
fe[nl]ix
dlowe: use CFFI HEAD
mathrick
it's completely retarded and in no way useful
p_l: in general, it's stupid and/or vague precisely in those places that matter for interop
fe[nl]ix
dlowe: well, it's about 10K lines of code. big for an opensource library, perhaps
pmd
is there something for emacs that indents lambda-lists better? like, if you make a newline after &key argument, it'll indent at argument instead of a column after &key?
_8david
pmd: use ELI instead of SLIME? ;-)
Xach
Hmm, I am trying to run "git clone git://common-lisp.net/projects/alexandria/alexandria.git", but I get "The remote end hung up unexpectedly." Am I doing something wrong? Is there a c-l.net problem?
pmd
_8david: yes, ELI does that... but... i want to use slime
_8david: even if it's just to be able to have several running images under the same emacs
stassats
isn't alexandria using darcs?
Xach
stassats: according to http://common-lisp.net/project/alexandria/ it is using git now, and offers that command line
pmd
this has greatly enhanced my habits. i started to use emacs as a server, and added an explorer context menu to "edit with emacs" (similar to "edit with vim") that either runs emacs if there is no server or reuses the existing one
stassats
Xach: http://common-lisp.net/r/projects/alexandria/alexandria.git works
Xach
stassats: thanks.
stassats: Now I wonder if the web page is in error, or if common-lisp.net is having a problem, or what.
stassats
though, somebody should fix it anyway, since git:// is faster
pmd
_8david: well, thanks anyway
stassats
Xach: seems like the latter
pmd
_8david: have you ever wanted to make eli be able to support multiple connections in one emacs?
stassats
ssh:// also works (if you have an account)
Xach
(Action) tries emailing clo-devel
attila_lendvai
dlowe: re system complexity. where do you draw a line? from one point of view iolib and linux is in one system, because the former provides an interface to the latter... and cffi is merely handling some accidental complexity caused by the impedance mismatch between them...
_8david
attila_lendvai: can you point me to the place in the code where a PERSISTENT-ASSOCIATION injects the PERSISTENT-ASSOCIATION-END-DIRECT-SLOT-DEFINITIONs into the association end point PERSISTENT-CLASS?
attila_lendvai
_8david: err, it sounds too simple, but have you macroexpanded defassociation?
mathrick
uh-huh, are there any circumstances where PRINT-OBJECT could be defined for a type implicitly?
_8david
yeah, I've macroexpanded it and also TRACEd ensure-class, and I'm as mystefied as I was before doing it :-)
mathrick
I'm trying to track where it's defined, and SBCL points to a macro invocation, but when I expand it there's no trace of PRINT-OBJECT being touched
_8david
I'm seeing such dslotds in CLASS-DIRECT-SLOTS, but I can't find a place where the dslotd gets passed to ensure-class or so.
mathrick
_8david: oh, I see you're having the same fun. Welcome to the club
attila_lendvai
_8david: i haven't seen the internals or perec much, but how about update-persistent-class-for-association-definition ?
err, no, that's not the injection
_8david: shared-initialize-around-persistent-class ?
it invokes call-next-method with :direct-slots (append (process-direct-slot-definitions direct-slots) (association-direct-slot-definitions class))
_8david
oh, thanks, that looks promising
Xach
(Action) is surprised that <a rel="nofollow" href="http://en.wikipedia.org/wiki/Ironclad_(Common_Lisp)">http://en.wikipedia.org/wiki/Ironclad_(Common_Lisp)</a> exists
Odin-
The Wiki page, then?
stassats
you can always suggest it for deletion!
Odin-
Wow. That's one hell of a stub.
stassats
i'd do that, but i'm not playing in the english wikipedia
rpg
somewhat random question: anyone have a good pointer to how to run SBCL program as a Unix daemon?
specifically, we've been having trouble with sbcl wanting to write stuff at the console when it's supposed to be a daemon.
p_l
rpg: redirect output somewhere
rpg
p_l: output from errors seems to creep through anyway.
p_l
rpg: did you redirect all descriptors?
rpg
even with disable-debugger and disable-ldb, when sbcl is crashing, it seems to leak stuff to the console.
p_l: as far as I can tell, yes.
stassats
and *debug-io*?
rpg
stassats: you mean redirect that, as well as stdout and stderr?
stassats
i thought you were redirecting on the lisp side
rpg
stassats: no, unix daemon, so we've been redirecting in daemon bash script
attila_lendvai
Guthur
rpg: I'd be interested if you get that solved. I tried for quite some time to get that, but was never really successful.
attila_lendvai
using these http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.environment;a=tree;f=/etc/service-scripts we run those executables
Guthur
I was trying on Linux.
attila_lendvai
rpg
attila_lendvai: thanks very much. I will look at those.
Guthur: Our stuff is also on linux
attila_lendvai
rpg: here http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.meta-model;a=headblob;f=/source/production.lisp you can find the interesting chunk of the exe toplevel lambda. and here http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.home;a=headblob;f=/source/server.lisp there's an actual toplevel function using the former
p_l
rpg: clbuild lisp --eval '(asdf:load-system :swank)' --eval '(setf swank:*use-dedicated-output-stream* nil)' --eval '(swank:create-server :dont-close t)' >/dev/null 2>&1
rpg
p_l: that looks similar to what we're doing, except we don't use clbuild. We are additionally doing --disable-debugger and --disable-ldb, and redirecting streams to a log file instead of /dev/null.
p_l
dump an image with swank initialization as startup function and you don't need to deal with stdin (I left it because normally it would execute repl)
_8david
I don't think SBCL's SB-SYS:*TTY* aka *TERMINAL-IO* actually goes to stdout.
p_l
afaik most people use something like detachtty even if they want to run a daemon
_8david
It goes directly to /dev/tty.
So if you either SETF SB-SYS:*TTY* or dup2 the real stdout over its fd, that should help.
p_l
_8david: /dev/tty won't work if you redirect it and it is signaled to the code, iirc
_8david
p_l: I don't understand what you mean.
attila_lendvai
should i be worried if i don't follow this tty stuff? we use start-stop-daemon
_8david
rpc said he's redirecting stdout and stderr, and I'm pointing to a case where SBCL ignores said redirection.
p_l
_8david: it's just that I recall something about /dev/tty not allowing itself to be open if you aren't attached to a tty
rpg
p_l what do you mean by "it is signaled"? "it" is ?
p_l
rpg: "error"
_8david
p_l: oh yes, that's true. But if rpg is starting from a shell script, I doubt he has detached from the tty.
p_l
i.e. open of /dev/tty should fail, iirc
rpg
p_l: ah, thaks.
_8david: I will check the bash script for detachtty...
_8david
Arguably a process that hasn't detached from the tty isn't a daemon at all.
p_l
rpg: IMHO, if you want to do all that daemon-mode stuff, you should implement necessary routines in your image init function
that is, close the descriptors, then fork
rpg
p_l: we actually have a bash script that can use more than one different lisp impl, so I'd /prefer/ to do that in the bash script, but could move to the image init, if necessary.
doing a fork in lisp seems very exciting...
attila_lendvai
rpg: if you make progress i'd be interested in where you get to. maybe we can port over something useful to our toplevel function
_8david
rpg: I think there's also a setsid(1) program that you could use in a shell if you don't want to call setsid(2) yourself
rpg
attila_lendvai: I'll let you know if we have any luck. Have to compare your scripts with ours, and follow up the detachtty suggestion --- I don't see anyone doing this here.
_8david
(Personally I prefer to write this kind of wrapper in C. More robust than shell.)
rpg
_8david: thanks. I will check that, too.
_8david: Not my code, actually --- someone else wrote the bash scriptage, but wants me to keep sbcl from blatting to screen...
Phantom_Hoover
Is there a Lisp logo?
Odin-
A few. None official.
p_l
rpg: do you need that portable?
Phantom_Hoover
I've wanted to have an application launcher for Slime for ages, but I can't find a decent icon.
rpg
p_l: ideally portable --- we have been going back and forth b/w sbcl and acl, and between linux and macs.
stassats
slime has a logo
Odin-
http://www.normal-null.de/lisp_logo.php && http://www.lisperati.com/logo.html
attila_lendvai
rpg: also note that our solution is only tested on sbcl, although i don't think there are any showstoppers if saving executables with a toplevel lambda is supported
rpg
attila_lendvai: we have somewhat different code for ACL and SBCL in the init function and builder, but that level of portability is already done.
p_l
would IOlib work properly on acl?
fe[nl]ix
no
maybe
only on acl 64bit
p_l
heh
_8david
luis pointed me to a cffi "long long" patch, but I haven't tried it yet
fe[nl]ix
_8david: the long long patch doesn't work for function arguments and return values
only for emulating long long in struct access
_8david
bah.
npoektop
hi! is there a way to protect port 4005 of swank? I want to have swank running on remote server, but how to make it securely?
rpg
p_l, _8david, attila_lendvai: thanks so much to all of you! I have a lot of directions to follow up now, and I really appreciate the help.
Xach
npoektop: by default it only listens on localhost. if you want to access it remotely, you have to e.g. use a tunnel.
npoektop: you can also, iirc, create a "cookie" file, and protect it with file permissions, and slime won't accept connections that don't use the right value from the cookie.
rpg
fe[nl]ix: we have had some luck doing iolib-like portability, but came to it topsy-turvy --- we have been emulating the ACL socket facilities in SBCL...
attila_lendvai
rpg: i remember all my struggling to put together anything useful, not to mention reusability (we use those from several projects). so with those memories i very much hope you'll have less headaches (with this cimpletely accidental complexity)
p_l
rpg: I can try writing you a general "daemon init" function for both SBCL and ACL :)
luis
_8david: fe[nl]ix is talking about something else
_8david: that patch does work for function arguments, that's the point. long long emulation in mem-ref is already in CFFI.
rpg
p_l: we have written our own sort of boot script that's portable, and invoke it from front ends that differently handle command-line arguments for the two implementations (wclas on sbcl, built-in stuff on ACL)...
(Action) goes off to skim boot-script.lisp...
Phantom_Hoover
Can you make arbitrary Lisp objects callable?
fe[nl]ix
luis: and for return values too ?
npoektop
Xach, ok. I'll try to find smth on that
thank you
rpg
Quick follow-up question: will a saved sbcl lisp image properly handle --disable-debugger and --disable-ldb when restarted?
attila_lendvai
rpg: there's some --save-runtime-options which always confused me. is saves some arguments, but i don't think those two are included...
err, no, it's actually :save-runtime-options for save-lisp-and-die
rpg
attila_lendvai: actually, I want the opposite of save-runtime-options --- I want to have those arguments be interpreted by the image when it restarts, so that it can be run either with or without debugger.
attila_lendvai
rpg: originally we tried that first, but for some reason ended up having our own arg handling (which includes --disable-debugger and uses :sro t so that sbcl doesn't interfere with the args)
Xach
rpg: disable-debugger is handled by the default toplevel function in sbcl
attila_lendvai
hrm, i *think* it was due to --help
Xach
rpg: disable-ldb is handled by the runtime
attila_lendvai
note: sb-ext:disable-debugger disables ldb, too
rpg
attila_lendvai, Xach: thanks. We have been handling disable-debugger ourselves, and using sb-ext:disable-debugger. sounds like that's The Right Thing.
(Action) may once have known this, and forgotten it.
attila_lendvai
rpg: fyi, a related sbcl bug: https://bugs.launchpad.net/sbcl/+bug/450280
Xach
rpg: I found the runtime/toplevel argument handling pretty confusing in sbcl.
rpg
btw, I notice that the sbcl manual's function index has no entry for disable-debugger....
I wonder how easy it would be for me to patch to add that...
(Action) doesn't really understand the way docstrings are transduced into the texinfo...
attila_lendvai
(Action) will add a new bug to launchpad about better runtime option parsing that doesn't capture --help unconditionally
rpg
attila_lendvai: thanks. all the more reason for us to handle --disable-debugger ourselves!
Ah. no docstring on DISABLE-DEBUGGER....
Is there anything that needs to be said besides "When invoked, this function will turn off both the SBCL debugger AND the LDB."
?
Also, does anyone know if ENABLE-DEBUGGER simply is the inverse? There's a comment about the setting of *DEBUG-IO* which I don't fully understand.
attila_lendvai
rpg: about the fact that it _used to_ set *debug-io*?
rpg
attila_lendvai: Yest.
s/yest/yes/
attila_lendvai
imho, that is just noise and shouldn't have been written there
Phantom_Hoover
Is it possible to make arbitrary objects callable?
p_l
rpg: http://paste.lisp.org/+25LQ
rpg
attila_lendvai: Do you know if enable-debugger turns the LDB back on, too? I'm afraid I don't know how to reliably force sbcl into the ldb...
p_l: wow. Brilliant! thanks!
p_l
rpg: it's very simple, direct translation of canonical UNIX daemon init code
I recommend running it before starting any threads, though
attila_lendvai
rpg: it turns ldb back on unconditionally
rpg
p_l: I can see that now, but don't know the bottom end of sbcl very well; it would have taken me a long time to winkle out the sbcl equivalents of the C code.
attila_lendvai: thanks.
akamaus
is it possible to use a single loop macro to step across a two dimensional array? Or two nested loops needed?
rpg
I'll try to submit a patch to sbcl-devel with rudimentary docstrings for enable/disable debugger so that they will at least show up in the function index.
attila_lendvai
p_l: why do you close the io? isn't it useful? we redirect stdout and stderr into a file which came handy several times
p_l
attila_lendvai: that's why I marked it as *simple*
attila_lendvai: I didn't bother with writing all redirection code, but it shouldn't be too hard
attila_lendvai
ahh, ok