freenode/#lisp - IRC Chatlog
Search
2:54:43
mfiano
If I make a custom "continue" restart, is there a way to register that with SLIME as the default for when 'c' is pressed?
4:43:22
asarch
I do: (defclass point () (....)) and then (defgeneric draw (point) ...) and later (defmethod draw ((point p1)) (...)) but I get "There is no class named COMMON-LISP-USER::P1".
4:45:06
asarch
As far I understand, defgeneric functions are like "templates" which I can "define" with defmethod
4:45:27
asarch
(From this: http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html)
4:50:54
jackdaniel
usually error messages are quite informative, in this case it told you, that there is no class "p1" – skimming where did you put this symbol would indicate the problem
4:51:56
asarch
How would you do (from C++): class point {int x, y, z; ... }; class rect {point p1, p2; ...}; (the "point p1, p2;" part)?
4:56:03
jackdaniel
if you talk about having class instances as members of another class, you have it without any declarations
4:56:22
jackdaniel
you may add :type initarg to slot definition, but there is no guarantee it will be enforced
4:56:56
minion
asarch: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
4:57:48
jackdaniel
loke: it certainly did not on 1.4.1 version, because I needed defclass* for that (to increase the safety level locally)
4:58:42
jackdaniel
asarch: slot (like variable names) doesn't have a type, it just stores a reference to the variable (which is typed)
4:59:30
jackdaniel
so (defclass rect () ((p1 :initform (make-point 0 0)) (p2 :initform (make-point 1 1)))) is a class having by default two points
4:59:51
loke
asarch: As for your question, you'd create a rect class like so: (defclass rect () ((p1 ...) (p2 ...))
4:59:55
jackdaniel
but you can do (setf (slot-value rect 'p1) 'boom) and you won't have a point in one of the slots
5:00:31
jackdaniel
ACTION leaves asarch in more konwledgeble hands, needs to take a shower (just finished morning excercie)
5:07:05
loke
(defclass rect () ((p1 :initform (make-instance 'point)) (p2 :initform (make-instance 'point))))
5:07:36
loke
then you can add :READER arguments to each point, meaning that you can expose the reader function, but no accessor/writer.
5:13:02
asarch
If you can supply the reader and the accessor, what is the point of the defmethod functions?
5:13:49
loke
asarch: readers and accessors are just a quick way to generate the appropriate methods/gneric functions for you
5:15:00
loke
(defclass foo () ((x))) (defgeneric foo/x (obj)) (defmethod foo/x ((obj foo)) (slot-value obj 'x))
5:19:43
asarch
If I have ":accessor get_x", how could I access to it from: (defparameter *p1* (make-instance 'point :x 1 :y 2 :z 3))?
5:22:19
loke
(let ((a (make-instance 'foo))) #|set the value|# (setf (foo/x a) 'new-value) #|print the value|# (print (foo/x a)))
5:27:31
asarch
This girl was my inspiration to learn Lisp. Now she is sick: https://www.youtube.com/watch?v=gS1DbvHHVH0
5:46:02
asarch
If I have (defgeneric draw (point) ...) and then (defmethod draw (p1 point) ...) and (defmethod draw (p2 point) ...), how can I specify which one (p1 or p2) version of draw I want to use?
5:47:24
jackdaniel
if you want two distinct point classes which are drawn differently, you need to create them and specialize on them
5:48:03
jackdaniel
(defclass p1 (point) (…)) (defclass p2 (point) (…)) (defmethod draw ((p p1)) …) (defmethod draw ((p p2)) …)
6:02:07
asarch
I guess that, by default, all projects stored there now are property of Microsoft :-(
6:02:09
jackdaniel
I'm certain many people heard about that, but it seems a bit offtopic, hence it belongs to #lispcafe
6:08:39
jackdaniel
one way to do that is: (find-class 'foo), PPM on it in slime, select inspect, go to "SLOTS" slot of the class and inspect individual slot
6:09:50
jackdaniel
I'm sure my question got missed in a wall of text – did you read the page in the spec about "documentation" function?
6:10:38
didi
How do I copy the intelligent way structures are printed, using my own :print-object? i.e. I want to open a line whenever I print to a too high column.
6:14:05
asarch
No, I didn't. I just was wondering the Lisp way to access the documentation for the "point.x" slot
6:16:21
jackdaniel
why didn't you? this is a way you look up things by yourself (without depending on others)
6:17:26
jackdaniel
as a bonus point trying to look things up first saves you from creating (hopefully misleading) impression, that you value your time more than person's who you ask for help
6:17:29
asarch
I thought there was another easy way other than: https://stackoverflow.com/questions/21367083/how-do-i-access-the-documentation-string-of-a-slot-of-a-defclass-in-common-lisp
6:20:07
jackdaniel
sure. if you look for something, it is a good idea to type function name in l1sp.org and see what comes up
7:53:56
loke
otwieracz: I never used TLS termination in Hunchentoot. I put a haproxy in front of hunchentoot and do the TLS termination there.
8:02:39
otwieracz
Yes, I'd rather do that but due to backward compatibility I need to do this in Lisp here…
8:07:58
loke
xificurC: cl-gss isn't in the list either, but if you want to integrate with Kerberos, that's the one to use.
8:09:29
xificurC
those are all nice and true comments that don't change the truth - it's not on the list of recommended libraries :( Who's choosing these recommended libraries?
8:41:39
xificurC
some have said here that codewalking is not a good idea (IIUC it's implementation dependent?). However searching for this term doesn't give too many results for me. In Let Over Lambda there was a section called "code-walking with macrolet". Is this just his idea or is macrolet what is referred to as codewalking? Would that mean using macrolet is di
8:45:19
jdz
xificurC: I could recommend reading http://christophe.rhodes.io/notes/blog/posts/2014/naive_vs_proper_code-walking/
9:03:55
jackdaniel
with code-walking you need a full knowledge about special operators used in the source code
9:04:09
jackdaniel
CL defines twenty-something special operators and implementations add some on top of that
9:05:21
jackdaniel
so it is not trivial in a sense, that you need to handle around 30 special cases and you are never sure, if there isn't some operator you are not aware of
9:05:46
jackdaniel
Michael Raskin had a lightning talk about portable code walking during ELS two years ago
9:07:08
xificurC
it's just that the readme didn't explain or link to the issue it is solving. And the alternatives are saying "removes macrolet" which I don't know how to explain
9:20:05
xificurC
shka: I'm never sure if I can trust that book. Just last time I asked on it and was told it defined macros that have issues with code-walking
9:22:05
xificurC
the part about why it is difficult to codewalk I understood, however I don't understand what does "macroexpand-dammit (only macroexpansion, removes macrolet)" mean in agnostic-lizard's README
9:44:44
xificurC
but to summarize what I hope to have learned from this - macrolet is fine when wanting to expand something in the function-call position (sorry for the improper term, not sure what the correct term is). If one wants to do transformations that require searching for anything else naive code walking techniques will fail in bizarre ways
9:45:40
shka
then you surely noticed how it explicitly states that writing code walkers is challenging
9:48:49
xificurC
shka: yes I noticed. What I might have not explained explicitly is that I don't know how much can I trust a person that says to understand the complexity of the issue and then goes on creating macros that by one's own definition will fail to take that complexity in mind
9:50:51
xificurC
e.g. while I like defmacro!'s g! and o! symbols I don't want to take that shortcut if I'll end up debugging some broken expansion for hours before understanding it's not my bug but the macro's
13:51:30
xificurC
beach: are you an author/maintainer of some CLs? I saw you mention sicl and cleavir?