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
11:40:00
phoe
which is more of a FUBAR situation than a "every cycle of the feedback loop looks like this" situation
11:45:16
hayley
I watch over my bot via REPL; at best that means I've had a REPL open for 100 days or so.
11:46:33
_death
yes, similarly for my server.. but even on the development machine I sometimes have such sessions.. of course, sometimes I restart tens of times a single day
11:50:22
VincentVega
random-nick: Hey, sorry for the late reply, just saw this. I don't really mind holding this discussion anywhere.
11:50:51
VincentVega
random-nick: In Fern, I will do configurations and contexts using dynamic inheritance. Even if CLOS could be cajoled to allow that, it wouldn't work because you should be able to apply that to particular objects. Wrt GUIs, there are often a lot of similar entities that different only slightly, and which you might want to be creating at runtime programmatically (or modifying via slot addition/removal). If you are familiar with gamedev,
11:51:01
VincentVega
random-nick: As per cells vs constraints: multi-way constraints let you do stuff like multi-value unpacking (e.g. #(0 1 2) <--> :x 0 :y 1 :z 2), which is useful for defining synonyms and easy accessors. Multi-garnet also deals with loops, and well, there are quite a few other things to it, really. Cells isn't so bad, but it's not as nearly as capable (not judging, we all do this at times, but the codebase is kind of a
11:51:07
VincentVega
random-nick: I see this as a special case of the debate about dynamic typing. I am not arguing about the usefulness of explicit typing, but the case for flexibility is pretty clear-cut.
11:58:13
pjb
(uptime) #| uptime: 1 day, 22 hours, 11 minutes, 43 seconds.↩ --> 166303 |# I had to reboot for a system update 2 days ago…
11:58:15
_death
it does mean sbcl is not the most up-to-date, and sometimes (not often, as you can see) that's a reason for a restart
11:59:04
pjb
_death: system upgrade are more often reasons to restart (emacs, lisp, etc). Ie. those programs are quite stable!
12:01:33
_death
pjb: right, but here's there's also a mismatch between server and development machine, as I keep sbcl and libraries that use sbcl-specific code up-to-date on the latter.. sometimes this creates conflict if I want to update the code on the server
12:10:42
_death
I suppose a different style (the prevalent style, with docker and such) would be to build an image and deploy to server.. repl could still be available, but image restarts would happen more often
12:14:18
_death
in that style, whenever you want to update the code, you build a new image.. the repl could be used for debugging, but usually not updates
12:23:03
VincentVega
ecraven: And if you are interested in the solver, there's this: https://constraints.cs.washington.edu/solvers/skyblue-tr-92.html
12:35:53
atgreen
just give it input and output streams and it formats the code nicely, preserving comments