freenode/#lisp - IRC Chatlog
Search
4:13:39
pjb
cnomad: in the golden age of Internet, you could just do whois lispm.de # but this time has been over for a long time, since the spammers, etc.
12:00:57
no-defun-allowed
That's definitely good practice, since then users can subclass those classes and create them dynamically.
12:01:34
pjb
fivo: you cannot export classes in lisp from anything (in the CL standard; you can always invent your own concepts).
12:03:07
fivo
ok, so it's no possible to just export the symbol of a class and have access to all the readers/writers
12:03:34
pjb
fivo: what this tutorial means to convey, is that you should define and document your own API. It is valid to define make-instance '<your-class> as the API to instanciate objects of your class, and to specify that they're CLOS object.
12:04:26
pjb
fivo: but if you could want to implement them as structures or as something else (eg. a reference in a database, a handle), then you may want not to publicise the fact that they're clos objects and it's a class.
12:05:02
pjb
fivo: in that case, you would define your API in terms of functions such as make-person, instead of a clos class with a constructor such as make-instance 'person.
12:05:54
pjb
fivo: and yes, you get to choose the precise list of accessors you want to export. Some accessors may be "private".
12:07:19
pjb
Since CL is a lisp-n, (cf. lisp-2 vs. lisp-1) a symbol can name several things. When you export it, thru it you give access to all the things it names.
12:11:17
fivo
ok so there is no mechanism to automatically export all accessors whenever I export the symbol of clos class? (maybe also for a good reason)
12:32:52
selwyn
fivo: you may be interested in cl-annot https://github.com/m2ym/cl-annot#annotation-export-accessors which provides this functionality with read macros
12:33:44
beach
pjb: There is no such thing in the Common Lisp HyperSpec as a "CLOS object". The only reasonable meaning of such a term would be equivalent to "object" or "datum".
12:34:31
beach
fivo: Yes, very good reasons. You almost never want to do that, so the functionality is fairly limited.
12:35:30
_death
you may also be interested in this: (defun thoughtful-export (symbols &optional (package *package*)) (dolist (symbol symbols) (when (y-or-n-p "Do you really want to export the symbol ~S?" symbol) (export symbol package))))
12:36:23
_death
you should think about the external interface first, instead of automatically exporting symbols
12:37:47
p_l
fivo: also, package nicknames, and available in some systems package-local-nicknames, allow you nice shortnames that help with things
12:38:15
katco
can anyone recommend a common-lisp equivalent to pandas? the only one i can find that appears similar is cl-ana http://pandas.pydata.org/
12:39:10
p_l
Josh_2: it's good to think on external interface, including which symbols need to be qualified
12:39:22
beach
There is no problem exporting names of classes, especially if you want client code to be able to subclass, define :AROUND methods, etc.
12:40:15
beach
Josh_2: As several people pointed out, it is not whether it's a class or not that counts, but whether the entity is part of the external protocol.
12:41:52
beach
Josh_2: The stuff you want to present to client code. Called API or Interface in other contexts.
12:43:58
beach
Josh_2: There is no problem. If your symbol names something that is part of the protocol, then export it, otherwise not.
12:48:50
Nilby
_death: lol, I think I need to make the whole thoughtfull-* suite, especially thoughtfull-defsystem, and thoughtfull-setf
12:55:57
_death
you can also add (unless (documentedp symbol) (setf (docstring symbol) (prompt "Please enter documentation for ~S:" symbol)))
13:18:05
pjb
beach: object and datum include objects of build-in classes. What I mean by CLOS objects are instances of standard-object; there remains instances of user-defined standard-classes.
13:23:36
pjb
katco: why would anybody want an equivalent of pandas? They're stupid, lazy, evil, gluttonous, (and they eat something they're not supposed to eat), they don't reproduce, and they cost a lot of CO₂, being shuffled around in planes.
13:24:28
pjb
_death: (unless (documentation symbol t) (setf (documentation symbol t) (prompt "Please enter documentation for ~S:" symbol)))
13:25:44
beach
pjb: I know what you mean, but it is better to use the established terminology, i.e. standard object.