freenode/#lisp - IRC Chatlog
Search
21:54:45
whartung
so if I have (defstruct xxx a b c) and (defstruct (yyy (:include xxx)) x y z) and (defmethod m1 (arg1 xxx)) and (defmethod m2 (arg1 xxx)) and (defmethod m2 (arg1 yyy)), will those work as expected? Is there a relationship between xxx and yyy or is it simplty structural?
21:57:34
whartung
ah cool! Well, that makes it easy then — I don’t have to class-ify them then…Because I mostly want to specialize behavior, not structure. So I should be able to (defstruct xxx a b c) and then simply (defstruct (yyy (:include xxx))) and method dispatch should Just Work.
0:19:28
mfiano
Does anyone know how to use the type pattern in trivia, on arguments of a list, and also bind the arguments for use in the clause body?
1:24:08
jack_rabbit
Ahh, I see: https://github.com/pkhuong/string-case/commit/718c761e33749e297cd2809c7ba3ade1985c49f7
2:54:38
White_Flame
of course, for erlang-style mailbox based asynchronous message passing, there are libs in quicklisp
3:06:33
White_Flame
in the simplest case, (defmacro send (obj message) `(,(first message) obj ,@(rest message))), where the first element of the message is a generic function name
3:38:46
loke
I recall having an extended debate with someone on social media where it was claimed to me that “message passing” was a fundamentally different way to do object orientation. I desperately tried to get this person to explain exactly how it was different, other than a superficial syntactic different (and a difference in the way the actual technical working were explained to the programmer), but I never got any proper answer.
3:55:21
pillton
I am not sure about that. Alan Kay said "I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages ..." (http://www.purl.org/stefan_ram/pub/doc_kay_oop_en). I am probably misquoting.
3:58:42
pillton
Anyway, I'll shut up because I don't really know and because I have to go to a meeting.
4:01:54
mfiano
Is anyone really familiar with the trivia library? I cannot seem to figure out how to compose the 'struct/class' and 'place' patterns, such that I can match a struct and define symbol macros for their slots in the process. Thanks.
4:09:30
beach
MichaelRaskin: I don't know how feasible your idea of hooking Clordane up to SBCL is, but you gave me a similar, but different, idea. I can create a Cleavir-based compiler for SBCL that propagates source information to executable code and that adds the interaction code required by Clordane. Again, it won't be as fast as native SBCL, but it will me much easier than to wait for a native SICL executable.
4:15:28
beach
MichaelRaskin: It would still take some time to create Clordane and this Cleavir-based SBCL compiler, of course. But such a thing would allow me to debug SICL code in a very comfortable environment without having to deal with the additional problems of a native SICL executable.
4:16:27
beach
MichaelRaskin: So I will probably move Clordane closer to the top of the list of projects to work on.
5:12:55
asarch
bar and baz both have the foo function. How could I shado baz::foo instead of bar::foo?
5:14:03
beach
asarch: It is a bad idea to :USE packages other than COMMON-LISP. Use explicit package prefixes instead.
5:14:39
beach
asarch: your code will be much clearer, because the person reading it will know from which package the symbols came.
5:15:08
beach
asarch: Plus, if you find yourself needing two ::, then you are doing something wrong.
5:15:54
beach
It means you are violating the public protocol of those packages, OR that you didn't design those packages correctly (in case you are the author).
5:17:47
MichaelRaskin
beach: I thought a bit, and as long as you accept limitations about not being able to see return value of top-level eval-when, the rest seems very feasible and not too much work.
5:17:56
beach
If a package P is not yours and you do a :USE P, you expose yourself to future modifications of P. If, in the future, the author of P decides to add new functions to the public protocol(s), then your code could break with a conflicting-symbols error even though you have not changed anything.
5:19:37
MichaelRaskin
Probably the eval-when problem can be solved with a few tons of annoying special-casing.
5:20:32
jack_rabbit
asarch, So double colon references symbols interned by a package. Single colon can only be used to reference symbols *exported* by the package.
5:21:16
jack_rabbit
asarch, So packages export symbols they intend to be used. A library will export functions it wants library users to call, constants, variables, etc.
5:21:53
jack_rabbit
asarch, internal variables, functions, etc. that it doesn't want a user to use, it doesn't export.
5:22:21
jack_rabbit
asarch, So when using a package, you should (almost always) only use the exported symbols (single colon)
5:23:10
jack_rabbit
asarch, That's why beach said you're either doing something wrong, or the package creator did something wrong, if you're using the double colon to use non-exported symbols.
5:25:53
jack_rabbit
Oh, minor note. Symbols that can be accessed with a single colon can *also* be accessed with a double colon. It's just best practice to use the single colon.
5:26:31
asarch
(defpackage :bar (:use :common-lisp) (:export :foo)), (defpackage :baz (:use :common-lisp) (:export :foo)) <- I don't want to use :foo from baz in :asarch
5:28:06
jack_rabbit
asarch, packages have access to other loaded packages, even without :use'ing them.
5:29:02
asarch
If I do: (defpackage :asarch (:use :common-lisp :bar :baz)), I would conflict the REPL at the time when I use (foo), right?
5:29:55
jack_rabbit
<jack_rabbit> asarch, packages have access to other loaded packages, even without :use'ing them.
5:30:29
jack_rabbit
asarch, It's not like java or python, etc. where you have to import packages to have access to them.
5:30:30
asarch
(defpackage :asarch (:use :common-lisp)) <- But any other functions in bar or in baz would not be accessible
5:36:07
jack_rabbit
asarch, When you :use a package, it just imports all that package's symbols into the target package, so they can be used as if they were part of the target package.
5:37:04
jack_rabbit
That's what beach advised against. Using explicit package prefixes makes the code clearer, since you can tell at the call site where functions, etc. reside.
5:39:46
jack_rabbit
It makes sense once you get used to it. It's just a little different than a lot of common systems.
7:32:25
verisimilitude
I wanted to make you aware of an article I've written that is related to yours:
7:33:12
verisimilitude
This is what I've been meaning to do since first reading your ``CL-CHARMS Crash Course''; it's a first draft, but I'll work on improving it later.
7:54:37
beach
jackdaniel: Unless you are in a very good mood, my advice is for you to ignore that link.
8:22:40
jackdaniel
verisimilitude: calling people idiots is not the best way of communicating your ideas
8:30:46
beach
In each iteration, you remove a CONS cell from the beginning of REMAINING, and you stick it first on the list RESULT.
8:37:39
beach
Er, when you are done, all the initial CONS cells are on RESULT (not REMAINING) in reverse order.
8:50:16
verisimilitude
I suppose xterm is just carrying on the UNIX way of making up stardards and violating real ones, anyway.
8:54:15
verisimilitude
It could be better, yes, but my main intent was showing how easy it is to write this functionality without using Ncurses.
8:55:49
verisimilitude
The code in ACUTE-TERMINAL-CONTROL is much better; I've updated it, but not yet published that update; the article is a ``crash course'' for that, in a way.
9:05:11
jmercouris
instead of just randomly splitting the window and ending up somewhere in the frame?
9:10:12
jackdaniel
verisimilitude: can I use it in my gnome-terminal? because if not, I'm definetely not your target audience
9:11:01
verisimilitude
I do extensive testing in gnome-terminal, actually, because I like its looks.
9:11:05
jackdaniel
and as I've said, examples weren't complete programs and I hardly understood 10% of it
9:11:35
verisimilitude
I'm only using standard ECMA-48 control functions, so most any terminal should work with it.
9:12:32
beach
verisimilitude: It is not just my opinion. It is also that of Peter Norvig and Kent Pitman. Can I assume you have read their "LUV slides" on Good Lisp Programming Style?
9:15:57
beach
jmercouris: When you need a different evaluation rule than a function provides, i.e, you don't want all the arguments to be evaluated.
9:18:00
beach
Sure, you can use a macro both in the expander code and in the expanded code. That's not a problem.
9:18:33
francogrex
Hi, I wonder if someone could help me understand why when I load this clsql asdf there is a recompilation every time (!) https://pastebin.com/Ad0aVkuC
9:19:17
francogrex
I understand that the first time use this is expected but every new time is weird
9:19:50
beach
verisimilitude: For instance, in (OR CURSOR (error ...)), you are violating one of the rules on page 13.
9:20:13
makomo
jmercouris: some macros are written just for the purpose of writing macros for example
9:22:10
francogrex
jmercouris: ok it seems the fasl files compiled by asdg are still were they are (cached)
9:22:16
jmercouris
here is my macro for reference: https://gist.github.com/15acdd2b6ef7f6f14e4c8741b748be7a
9:22:33
beach
verisimilitude: So when you said "That doesn't really tell me much at the present", you hadn't really looked at it yet?
9:24:22
makomo
jmercouris: using a function in this case would mean that you would still have to use a conditional within the caller
9:25:11
makomo
i think you misunderstood me, but if i correctly see what you're thinking, that's correct i guess
9:25:43
jmercouris
I'm saying that if "with-logged-in" is a function, the body of whatever you pass to it will get evaluated
9:26:57
makomo
but if this session check happens only a few times, factoring it out in a macro might be an overkill
9:28:09
makomo
what i was trying to say is that, without macros, you would be forced to do this conditional in the function that calls LOGGED-IN-P
9:28:34
makomo
or maybe you would have something like CHECK-LOGGED-IN that would somehow do a non-local transfer of control or something? idk
9:28:56
makomo
perhaps throw an error and catch it somewhere else, but then you're using errors for control flow and i don't know how good is that
9:29:14
makomo
maybe CL has different guidelines regarding that since the condition/signal system is more powerful
9:30:20
makomo
verisimilitude: yeah i suppose so, but i haven't seen any usages yet where it was used to guide "normal" control flow
9:35:54
beach
verisimilitude: Yes, I figured you would say that. But style issues are not about personal preference but about communication with other people. If you submit your code for others to read, it would be polite to respect such conventions rather than insisting on your own personal preference.
9:36:36
verisimilitude
Well, I like that Common Lisp is a language without kings and other such things.
9:45:48
verisimilitude
Well, it's just example code. I'd be interested in other critiques about it, though.
9:45:52
dim
I'm in the middle of rewriting a PR due to code style issues, and I don't like doing it, but I appreciate that the result is worth it