libera/#commonlisp - IRC Chatlog
Search
14:34:08
dnhester26
dlowe: pardon my ignorance for I have never used do. what is the last statement doing there? when is it called? it's after the test form, form the spec I don't understand
14:35:54
dnhester26
is it evaluating only if the test-form fails? That's what it looks like to me, but from the spec I couldn't understand
14:38:09
thuna`
dnhester26: That DO evaluates its body - which is the RESTART-CASE - until the result of (ALL-START-WITH-SAME-LETTER ICE-CREAM SAUCE TOPPING) is non-nil.
14:38:22
dnhester26
In this line in the spec "At the beginning of each iteration, after processing the variables, the end-test-form is evaluated. If the result is false, execution proceeds with the body of the do (or do*) form. If the result is true, the result-forms are evaluated in order as an implicit progn, and then do or do* returns." I don't see in the sytnax neither the body of the do nor the result forms
16:37:14
hayley
jmercouris: Consider writing --quiet with two hyphens before you smartass about wHaTeVeR rEaSoN.
20:28:57
NotThatRPG
Is there any way to assert types and get compile-time type-checking for generic functions in SBCL?
0:47:41
paulapatience
dbotton: Maybe mention the use of % prefix for slots so that they cannot be accessible publicly via slot-value if the accessor shares the same name and is itself exported.
0:50:48
paulapatience
Also, mention that one convention for accessor naming is that they should not be prefixed with the class name, because it is awkward when you have differently named subclasses (there are also other reasons). This is actually where package namespacing comes in handy, in case you want the same name for a generic function but a different lambda list.
0:52:57
aeth
the class prefix is a struct convention (though the struct can configure the conc-name)
0:53:34
paulapatience
Another thing I learned from yitzi recently is that you can make a generic predicate to tell if a specific class implements a certain protocol rather than having an abstract superclass
0:56:01
pillton
You shouldn't think of generic functions as being associated with a class. Functions perform actions. Classes encapsulate state.
0:57:12
dbotton
paulapatience - generic predicate to tell if a specific class implements a certain protocol - just adding something to indicate you implemented it?
0:59:07
dbotton
interface to what is the question - but I understand your point which is more not seeing CL with a C++ eye
0:59:36
pillton
Sure. The functions have nothing to do with the class though. They are the interface to the actions that need doing. They can be generic, macros or normal functions.
1:02:48
paulapatience
dbotton: Suppose someone has an instance of a class and wants to know if they can call a protocol function. You have two options: You can do typep to check for all the types you know implement the protocol, or you call protocol-implemented-p (where presumably it is specialized on the appropriate classes to return T).
1:03:12
pillton
One thing I like about lisps in general is that they have one way to perform an invocation. None of this f(x,y) versus x.f(y) or y.f(x) confusion.
1:03:36
paulapatience
The problem with typep is that unless all classes implementing the protocol have a common superclass, you can't know if a third-party implementation of the protocol does implement it
1:04:12
paulapatience
yitzi knows more about this. He believes for example that it was a mistake in gray streams to export the class hierarchy.
1:04:33
paulapatience
I have not yet used this pattern, but I think it will simplify the design of some of my in progress libraries
1:05:12
paulapatience
Ok, actually, another thing you could add to your document is the client pattern
1:06:11
paulapatience
Basically, you should only specialize a generic function if you own it, or if you own one of the types you are specializing
1:06:34
yitzi
To clarify more, I believe that exporting the classes in Gray streams should have been done as "mixins." There is already generic STREAMP, INPUT-STREAM-P, etc. So having the classes that as implied "you have use these" is confusing. And there are some minor contradictions as a result.
1:07:36
ldb
in dynmaic typing it always possible to apply a generic function until it signals error at runtime or something
1:07:49
paulapatience
The client is basically a (sometimes empty) class which users define to not break that rule
2:11:30
beach
dbotton: You have to export names of slot readers/writers only if they are part of the protocol. A class can have some slots with private accessors.
2:12:05
beach
dbotton: Similarly, there may be private generic functions that apply to a class, and you don't want to export their names.
2:13:49
beach
dbotton: And I don't understand the convention of using meta-names of packages that start with a colon.
2:15:09
beach
dbotton: It is definitely not necessary to use :IMPORT-FROM, and recommend not using it. It is much better to use an explicit package prefix.
2:17:45
aeth
I suppose "class method" could be interpreted to mean "a method automatically generated by DEFCLASS"
2:17:50
beach
dbotton: Why do you use uninterned symbols for package names, but not for the symbol names they export? And then you sometimes use keyword symbols for package names as well as in (IN-PACKAGE :TPAC).
2:17:58
aeth
though these automatically generated methods do not do anything special or different, afaik
2:18:42
beach
They usually become instances of STANDARD-READER-METHOD and STANDARD-WRITER-METHOD, but that's it.