freenode/#lisp - IRC Chatlog
Search
2:45:03
beach
skidd0: But you will do yourself a favor if you use explicit package prefixes. When you come back to your code in the future, you will have forgotten from which package a symbol comes if you can't see the package prefix.
2:45:46
beach
skidd0: And even if you have exceptionally good memory, the people who want to use your code and maintain it will have no clue where those symbols come from.
2:46:15
matzy_
i have a noob-ish question. for cl-cffi-gtk (gtk bindings for cl) where do you put the folder that you can load it with the command (asdf:load-system :cl-cffi-gtk)?
2:47:05
matzy_
everyone says to use that command to instll it, but i dont see where you can even point it to the dir. should i put it in my quicklip folder? i thought that was bad for manually installed packages
2:47:35
beach
skidd0: I am reminded of the quotation from Charles Simonyi on page 9 of this document: https://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf
2:49:16
beach
mfiano: And notice that there is no definition of "CLOS object" in the Common Lisp HyperSpec. The only reasonable interpretation of such a term would be "any Common Lisp object" (since every Common Lisp object is an instance of a class) which makes it meaningless.
2:52:25
beach
skidd0: Nowadays when I look at some code that I wrote a few years back, I deeply regret having overused USE, because I have no clue where those symbols are coming from, so maintaining that code is a nightmare. I usually start such maintenance by removing the USEes and inserting package prefixes. But even that exercise is VERY DIFFICULT.
3:10:12
beach
skidd0: No you don't have to. Others can use the double package prefix. But exporting is a signal that it is meant for client code to use.
3:12:18
skidd0
so if i had a TASK-LIST with a TASKS slot (that had a :accessor tasks), i export :tasks?
3:12:27
beach
skidd0: A protocol is a collection of types (usually classes) and functions (usually generic functions) that is all the client code needs in order to use your module.
3:12:37
mfiano
You may even have multiple accessors per slot, and only a selection of them exported for users.
3:13:17
skidd0
beach: the protocol basically a collection of higher leverl interfaces to the lower level code
3:14:02
beach
skidd0: Yes, a module (not a Common Lisp term) consists of a protocol (or interface) and its implementation.
3:14:36
beach
skidd0: Because you might want the client to be able to define an auxiliary method on one but not on the other.
3:15:07
beach
skidd0: The small part is the protocol and the big part is the implementation. So you don't want to reveal the implementation in your protocol.
3:15:36
mfiano
What I typically do, is I define a reader which is exported, and an accessor symbol with a % prefix which is used internally. That way, users know the slot is read-only, and I can pre-populate it myself through the internal API
3:15:55
beach
So you don't export those. Only accessors, and only those accessors that make sense as independent functions, without any reference to slots.
3:17:14
mfiano
Multiple accessors per slot starts to make sense when you think of the package system as a protocol for your users
3:17:20
beach
skidd0: Now for the technical details of :EXPORT in DEFPACKAGE. The :EXPORT and :SHADOW options of DEFCLASS take what is known as "string designators".
3:18:26
beach
skidd0: A string designator can be a string, a character (denoting a singleton string) or A SYMBOL.
3:18:33
mfiano
Also note, that the HyperSpec defines "accessor" to be any of reader, writer, or accessor, which might make what I said a bit confusing otherwise
3:19:00
beach
skidd0: The thing is that in Common Lisp, symbol names are usually typed in lower case and then turned into upper case by the reader.
3:20:07
beach
skidd0: One possibility is to use symbols from the KEYWORD package, so like :export :my-accessor.
3:21:06
beach
skidd0: When the reader sees a : at the beginning of a token, it creates a symbol in the KEYWORD package, yes.
3:26:10
beach
skidd0: Try (symbol-package ':hello) (symbol-package 'hello) (symbol-package '#:hello)
3:26:35
beach
skidd0: No, it is not anonymous. Anonymous means "has no name" and every symbol has a name.
3:30:26
skidd0
beach: not same symbol becuase, among maybe other things, the symbol-package is different?
3:30:30
beach
mfiano: There is nothing in the Common Lisp HyperSpec that says a symbol has a symbol-function slot.
3:30:57
mfiano
fair enough. Point being, symbols are objects, much like everything else in Common Lisp.
3:34:33
beach
skidd0: What mfiano says. It is the syntax #:... that makes the reader create a fresh symbol.
3:44:41
mfiano
matzy_: Probably not. GTK is a beast, and there isn't really anything "simple" about it, or really any GUI programming. Shinmera has created quite a few tools around Qt because of the fact, even though Qt's API is only slightly better.
3:46:46
mfiano
i would use something more native to CL, like McCLIM. Or I would use something hosted, like SDL2 with OpenGL, or a web frontend if it fits the problem.
3:48:10
matzy_
Really I just want to make a gui app for my personal use. Ive been wanting to learn cl for a long time, and i finally have a worthwhile personal project to do with whatever language i want
3:49:09
matzy_
i use linux though, and havent had to bring in qt yet (run a tiling wm instead of DE)
3:50:08
beach
matzy_: I would personally avoid learning Common Lisp by writing a GUI application because GUI applications are hard.
3:51:29
beach
matzy_: Debugging becomes a nightmare. You will have segmentation faults and other messy stuff that is typical in less safe languages.
3:51:43
mfiano
Start by learning Common Lisp. Not just using Common Lisp as a stepping stone to foreign libraries. You're bound to fall and get dirty
3:52:14
beach
matzy_: Plus, by mixing languages, you put yourself in a situation where you don't have any good debugging tools.
3:54:04
beach
matzy_: Now, McCLIM is a GUI toolkit that is (almost) entirely written in Common Lisp. But to use it, you need to know about generic functions and lots of other things that is not typical to learn in the beginning.
3:54:31
matzy_
it's pretty simple. I use arch + i3, so I just launch apps thrugh stuff like rofi. the problem comes when you cant remember an apps name (like, what was that pdf reader i instaled?). i wanted to build some GUI app organizer you could use to categorize and launch common gui apps. some small utility just for me
3:55:58
mfiano
rofi can do more than just act as a dmenu replacement. It is scriptable, calling out to any binary to do the heavy lifting
3:56:08
matzy_
ive just been looking for something to do in cl for awhile, because im not one to sit through endless tutorials. i like learning by building something
3:56:16
mfiano
So use Common Lisp to do the backend work. then you aren't writing a GUI...you are leveraging what you already use
3:59:51
matzy_
wow...so i could take a list of all sysem apps in cl, filter to get how i want, and then present in a cutom rofi window?
4:01:13
matzy_
this is an awesome idea. and really useful too, a perfec project to learn on. thanks a million for the idea man!
13:17:15
xificurC
(read (process-output (sb-ext:run-program "/bin/sh" '("-c" "export-lisp") :output :stream))) is there something inherently wrong with such code? It keeps hanging in some cases even though the internal program always finishes when running from the shell directly
13:20:50
flip214
but the process will block if the pipe is too small to hold all the output at once.
13:21:38
flip214
use UIOP:launch-program (or use :wait nil), read the stream, and then explicitly let it stop (== read the return code)
13:25:42
xificurC
flip214: ah, I tried :wait nil and then (read (process-output process)) (process-close process) but forgot to return the read value... That works. uiop:run-program worked too so I knew it must be something me doing wrong
14:33:50
HighMemoryDaemon
Caveman uses a syntax feature of Lisp I have not seen before. Ex. '@route GET "/"' - What is this syntax feature called?
14:35:11
random-nick
HighMemoryDaemon: reader macros work by telling the reader to call a function when encountering a certain character on the beginning of an expression
14:36:29
random-nick
the simplest reader macro is probably quote ('), which reads the following expression and returns it wrapped in a (quote ...) form
14:39:07
antoszka
You can use reader macros to quite trivially create, say, a literal syntax for hashes.
14:39:35
HighMemoryDaemon
That is very cool. Not saying that it is worth doing at all, but using these macros, couldn't you do something like re-make the entire Python or Ruby programming languages..within Lisp?