freenode/#lisp - IRC Chatlog
Search
9:12:52
jmercouris
okay, I see, it is some other, unsupported type, so you had to implement a gray stream to treat it as a stream
9:13:25
jmercouris
and why exactly might you want to do this? where did you need to read the buffer contents as a stream?
9:13:48
beach
jmercouris: The buffer contains Common Lisp code, and I need to read it in order to analyze it as such.
9:14:14
beach
If I hadn't done it this way, I would have to re-implement a specific READ function for this purpose.
9:14:42
jmercouris
right, and that function would read from the buffer, generate some strings or something, or a file, and pass them to READ
9:14:43
nirved
jmercouris: for conditions (and a lot of other topics) you might want to look in "Common Lisp Recipes"
9:16:39
jmercouris
so you don't need to understand what the database is or how it works, just that it supports some sort of protocol
9:27:25
jmercouris
I guess a pre-requisite would be good IMAP or POP3 support, which I understand, does not really exist?
9:32:09
pjb
jmercouris: you may have a lookt at examples of use of gray streams: com.informatimago.clext.pipe or flexi-stream.
9:33:10
pjb
jmercouris: no, to write a listserv, you need very little. You can hook it to an email address with an entry in the aliases file, and it can send back email using sendmail with run-program.
9:33:34
jmercouris
pjb: I am just wondering why mailman is such a massive program, there must be more to it somehow
9:34:02
pjb
jmercouris: no, you can wonder. C programs (or most other programming languages actually) are about 30 times more verbose than lisp.
9:34:48
pjb
jmercouris: they don't have memory management, error handling, generic functions, a dumb type system, etc, so there is a lot of code duplication.
9:40:43
pjb
beach: when I started programming 100% in CL, I translated my library (which was originally written in Modula-2, and later translated into C), into CL. And between the modules that were useless in CL, and the more concise code for the rest, I got that number.
9:43:50
pjb
Look for example openssl. For ASN.1 data structures, they have actually a single "generic" set of functions, but they have macros to generate wrappers for them, with the specific C types. So their man page have 30 functions for 1 feature! https://manpages.debian.org/testing/libssl-doc/d2i_ASN1_TYPE.3ssl.en.html
9:45:13
pjb
And then, they wonder why they are missing bugs… https://news.ycombinator.com/item?id=18236345
9:45:46
pjb
While the brain cells of the C programmers are busy handling errors, managing memory, and avoiding buffer overflow, they forget about sound software engineering rules and proper design. While the code of libssh looks cleaner than eg. FreeBSD, there are still quite a number of functions that are bigger than a screen height.
9:47:03
pjb
Twelve malicious python libraries found and removed from pypi <https://www.zdnet.com/article/twelve-malicious-python-libraries-found-and-removed-from-pypi/>
9:47:58
jmercouris
if you were to implement a listserv in CL with administration portal, what would it look like?
9:49:00
pjb
I would make a postgres database. Then there would be a program to receive the email and process commands or diffuse messages. And a hunchentoot program to manage the administration.
9:50:02
pjb
Since the "process commands" is actually just another interface to to the adminstration module, perhaps this could be a separate server (used by both the email processing and the hunchentoot), or you could merge all three in a single lisp image/unix process.
9:50:04
jmercouris
holycow: no problem :) it is my pleasure to work on it, I just hope to be able to do more
9:53:45
jmercouris
so if the system gets an email at mailman-admin it'll invoke /var/lib/mailman/mail/mailman with the args admin mailman?
9:53:50
pjb
jmercouris: an alternative would be to define a transport in postfix, so you could directly use a running server. With the alias, you would write a little program that would connect to the running server, if you don't want to launch a new program for each message.
9:56:23
jmercouris
because I know that mailman sucks, out of personal experience, and I just want something that just works with minimal configuration, hence why I was thinking of writing my own in CL
9:56:28
pjb
For example, you could implement a SMTP server (without the sophisticated options, it's quite simple). Then you can either hook it behind postfix, or directly on the internet if the machine is used only for your listserv. This would let you do fine filtering when receiving the enveloppe, even before receiving the message.
10:09:45
pjb
Actually, this is just a command system interface. You have different ways to give commands: by sending emails, thru the web, at the unix shell, perhaps thru irc, etc. So you just need a lisp REPL to receive the commands (using a lisp REPL allows you to script those commands too!), and to hook the various user interface to to the same REPL system.
10:11:10
pjb
There are a few algorithms you need to recover or reproduce from listserv or mailman, about the managing of addresses to avoid loops, process bounces (just a different command), etc.
12:31:13
pjb
holycow: if interested, you can implement it in CL. Have a look at https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/sedit/index.html
16:13:14
flip214
any alexandria maintainers around to take a look at https://gitlab.common-lisp.net/alexandria/alexandria/merge_requests/7, please?
16:39:56
anamorphic
Do I need to wrap a defparameter in some kind of eval-when in order for it's binding to be seen from within a macro?
16:40:59
pjb
anamorphic: clhs defparameter says: If a defvar or defparameter form appears as a top level form, the compiler must recognize that the name has been proclaimed special. However, it must neither evaluate the initial-value form nor assign the dynamic variable named name at compile time.
16:44:16
anamorphic
Ah OK. So (eval-when (:load-toplevel :compile-toplevel? I'm not sure if I need :execute
16:46:20
pjb
But if you define it at compilation-time, compute the value at compilation time, perhaps it cannot work if you load only the source? Or perhaps you can also compute the value when just loading the source. Depends on your program.
16:47:12
pjb
For example, when you define functions to be used by macro, you usually don't need them at run-time (unless you plan to use the macro at the REPL, say). In that case, you can skip the :load-toplevel situation.
16:47:34
pjb
So the compilation-time function don't take space at run-time (unless you load the source of course).
16:47:57
pfdietz
If you use the macro in another file those functions better have been loaded, though.
16:49:34
pjb
It's true, that an implementation could fork a different compilation environment for each compile-file that is not within the same with-compilation-unit. Ie it could throw away compilation-time definitions :-)
16:50:02
pjb
In that case, loading the compiled files between compile-file would be essential, and you'd have to include :load-toplevel for those functions.
16:55:03
|3b|
if you skip loading the files you use in macros, you will probably eventually be annoyed when you try to fix something interactively that uses it :)
16:57:11
HighMemoryDaemon
Does a pathname (ex. #p"~/Documents") offer any benefits over a regular string? In Quickproject's make-project function, I noticed that regular strings work too.
16:59:33
|3b|
main place i can think of it would matter is things that try to guess intent from types, for example something that would interpret a string as input, and a pathname as name of file containing input
17:22:00
|3b|
: is just part of the symbol syntax in the reader, with no real name. #p and #' are reader macros
17:22:37
emaczen
What happens with the memory management of pointers (with CFFI) and multiple threads (with bordeaux-threads)?
17:22:45
|3b|
(specifically # is a dispatching reader macro, with p and ' being specific instances of that particular dispatching reader macro)
17:23:03
emaczen
For example, If I create a pointer on a thread, then use it in the main thread, where does it need to be freed?
17:24:31
|3b|
symbols (including the : or :: ) and numbers are built into the reader syntax though, so you can't really change how those are read without just parsing everything yourself
17:25:56
emaczen
anamorphic: but it doesn't explain why I seem to leak more memory with multiple threads then not
17:25:57
|3b|
scymtym: thanks, thought there probably was actually a name after i wrote that, but forgot to go look it up
17:28:12
|3b|
(and to clarify for original asker, #\ is another dispatching reader macro on # that reads a character, so #\: reads as the character : and in general that's how we'd talk about characters when talking about CL. i skipped them previously to try to simplify the answers)
17:33:38
pjb
That said, we could as well talk about the character "a": (character "a") #| --> #\a |# ;-)
18:13:11
HighMemoryDaemon
In my projectname.asd file, is there a good way to use a system that is in a folder of my project? Ex. 'pathnames-lib/pathnames.asd'. I could symlink it to my ~/common-lisp folder but I'd prefer not to.
18:25:26
HighMemoryDaemon
This is what I ended up going with. https://hastebin.com/mukebifepo.lisphttps://hastebin.com/mukebifepo.lisp . Of course I would have to follow the second half of that article if I end up needing to do something similar in a .lisp source file.
18:35:49
flip214
shka_: I guess you'll need a new slot metaclass.... or you re-use eg. the documentation slot (urgh)
18:37:59
Bike
https://github.com/clasp-developers/cl-jupyter-widgets-old/blob/master/src/iwidgets/widgets/traitlets.lisp here's one i wrote that adds observers and stuff. needs... direct/effective-slot-definition-class, compute-effective-slot-definition