libera/#commonlisp - IRC Chatlog
Search
4:10:27
beach
atgreen: If you use Eclector to read your code, you can customize the symbol reader function.
10:59:12
ecraven
pjb: do you know Garnet? can I write constraints that depend on *other* objects (things like "if the object in my slot `parent' resizes itself, I want to change my size too"?
11:00:58
pjb
KR (Knowledge Representation) is independent of Garnet. Garnet is built on it. KR is a OO system (different from CLOS). You can use KR to implement your objects with constratins. If you want to use CLOS with constraints, you may consider Cells.
11:02:08
pjb
Now, I don't remember the details, but it's possible that it may be possible to merge KR and CLOS stuff. At least, you can write generic functions with methods on both kind of objects.
11:03:15
pjb
I guess nowadays you would choose CLOS+Cells instead of KR, and use KR only if you want to use Garnet. But it may be a good idea to have a look at KR.
11:03:58
ecraven
thanks. just found a tour.pdf and tutorial.pdf for garnet, I'll skim through these. just trying to understand how things work there ;)
11:08:01
ecraven
isn't prototype OO just as imperative as it gets? you create objects, modify them, save your image. you have no way of recreating them in the same way, if you lose that image, right?
11:09:25
hayley
The difference, though, is that the text form describes an object and its slots immediately, and not a class. For example, I can write a Self object as (| x = 42. |)
11:12:11
ecraven
hayley: but in practice, isn't it harder to write reproducible code? (though that might be an issue with image-based languages anyway, not just prototype ones)
11:12:46
hayley
I think that is an issue about how you approach persistence, not about prototypes or classes.
11:13:09
ecraven
hm.. would prototypes and generic functions work, if dispatch was based on predicates, not "types"?
11:14:08
hayley
You may wish to read on Korz <https://dl.acm.org/doi/10.1145/2661136.2661147> which was a multiple-dispatch prototype OO language.
11:14:22
scymtym
also https://github.com/sbcl/specializable/blob/master/examples/prototype-specializer.lisp
11:18:30
pjb
ecraven: it's harder to write reproducible code, if you code at the REPL. The same difficulty would occur with CLOS. If you type at the REPL: (defclass coo () ()) (defvar *coo-1* (make-instance 'coo)) (defmethod moo ((obj (eql *coo-1*))) 'hi) (moo *coo-1*) --> hi ; how reproducible is that?
11:18:49
pjb
ecraven: but if you put that in a file, then it'll be reproducible. Same thing with prototype based OO.
11:19:20
ecraven
but doesn't prototype-based OO "invite" this style of work more? because it's so easy to modify objects until "stuff works"
11:20:09
pjb
ecraven: if the predicate is (eql obj *coo-1), yes, prototypes and generic functions would still work the same. ;-)
11:21:27
ecraven
well, I don't just want to specialize on *one* object, but on predicates of objects (hypothetically ;)
11:21:41
pjb
the problem of image-based development can be corrected if you modify your REPL to keep the source forms. See Image Based Development http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/ibcl/index.html
11:22:07
ecraven
hayley: thanks for that Korz reference, I'll need to read that at leisure, it's not a trivial read :D
11:22:25
pjb
or rather: http://informatimago.free.fr/i/develop/lisp/com/informatimago/small-cl-pgms/ibcl/index.html
11:22:44
ecraven
you edit code, and you can "dump" it into a file. the UI remembers where each function goes, and does the right thing ;)
11:25:12
Gnuxie
ecraven: idk what you mean by JavaScript "has no proper history of REPL development", there's quite clearly a REPL in the browser and it really is necessary to use to do any kind of web dev
11:26:06
ecraven
Gnuxie: indeed, and I'm not a web developper, so I don't know how the real pros do it, but from my experience that repl is more for "let's see what that function call really does in a browser" and less for "I'll write my program here in this repl", isn't it?
11:27:48
_death
indeed.. it's more "edit a file and reload".. where reload is equivalent to killing the image and starting anew
11:29:16
Gnuxie
maybe, but people do that in CL when they get into a situation where it is more ergonomic to reload than fix the environment