libera/#commonlisp - IRC Chatlog
Search
12:00:44
puchacz
hi, is there a lisp-to-lisp communication library that would be suitable for interactive REPL development? e.g. from SBCL sly, evaluate (with-another-lisp *abcl-connection* (do-something)) ?
12:01:41
puchacz
the reason is that my main Lisp is sbcl, but abcl has potentially access to many libraries based on java.
12:14:43
beach
You would not be able to do much with such a thing. Objects would lose their identity, and most objects would not be possible to replicate on the other side.
12:23:46
beach
Even with strings, there is not much you can do with a string such as "#<SOME-CLASS ...>"
12:25:31
puchacz
yes. only lists, actual strings, keywords, symbols used as string designators, numbers. like JSON really
13:11:42
puchacz
I wi ll have a look how it is done, but I think design goal is different - rather than have 2 lisps or more tightly coupled, sending a task to any of lisp server instances that are interchangeable
13:16:40
puchacz
systems I have in mind are like cl4py/py4cl or Rich Hickey's thingy for java<->lisp comm (was the name leaf? I can't remember now)
13:18:09
puchacz
Riich' library uses weak hash map to tell the server when it is ok to garbage collect object on java, and it either sends around self evaluating objects like strings or numbers, or creates proxies for everything on lisp side
13:52:56
puchacz
yes, foil. https://foil.sourceforge.net/ I used it but not much and not for interactivity, but to generate specific java calls that returned strings...
18:21:34
NotThatRPG_away
Does anyone have a link to a page that lists all the forms that are evaluated at compile time? My google fu is too weak to find this.
20:03:49
kenran
When do I use a defclass in Common Lisp as opposed to, say, a defstruct to group data together? From what I've read about CLOS so far it seems like I should use a class only if I want inheritance. Is that correct?
20:06:01
aeth
One is to use defclass for everything and to treat structs as a legacy format. This is the majority approach on this IRC channel.
20:06:47
aeth
The other is to use defstructs in certain circumstances, usually for performance and/or simplicity. After all, you can still defmethod on them if you need to. Technically, they can have their own form of inheritance, but by the time you need inheritance, you're probably in a place where standard classes are better
20:08:08
kenran
From my more FP-like view (where I rarely if ever need or want inheritance), it seems so "strange" to use `defclass' to just define simple product types, given that defmethods are not coupled to classes.
20:08:21
aeth
My personal rule of thumb is to use defstruct when :type in slots is an important factor, especially for performance, because it gives the implementation more information, even if the implemntation can choose to ignore it.
20:09:14
aeth
But I also have a way to force typechecks on defclass via the metaobject protocol, so it's not even a case of 'every time I have typed slots I use a struct'.
20:09:34
kenran
Every winter for some reason the Common Lisp virus latches onto me, but this time it feels like it's gonna stick for a while :D
20:10:18
aeth
e.g. defclass is very OOP, dynamic OOP, high level, slower, redefinable, etc. While defstruct is great for hot loops in high-performance stuff.
20:14:00
kenran
Ah yeah, that's the way I'm used to from other languages. I was especially wondering if there's anything else they could be useful for if I don't plan on using inheritance.
20:14:15
aeth
I guess you could say that the most functional (who needs inheritance?) and least functional (you can write Fortran in any language) code might use structs while the majority in the middle can ignore them.
20:14:43
aeth
Standard classes are incredibly dynamic so you can force some fancy things on them with the metaobject protocol.
20:16:44
kenran
The MOP still eludes me, as I have not spent any time on it. I'm looking for a fun language for hobby projects, and so far CL is quickly rising up in rank for me :) I'm working exclusively in FP for my job, so I thought using something that's more pragmatic and mostly paradigm-agnostic would make it more fun.
20:18:15
aeth
Structs are simple (static) containers, hash tables are simple containers in the complete opposite direction (no real structure), and defclass has a lot of mostly-hidden power.
20:19:01
aeth
It's actually kind of hard to decide which one if you overthink things, and that's before getting into alists/plists (largely interchangeable), fancy arrays, etc.
20:19:45
kenran
That kind of sums up my whole experience with CL so far: I can never decide between all the different ways to do things.