libera/#commonlisp - IRC Chatlog
Search
22:30:21
EdLangley[m]
that is, just use load-time-value without checking and then document that the code has to be compiled to work correctly
22:31:54
phoe
EdLangley[m]: it's possible to (ab)use this behavior to detect code that wasn't minimally compiled and signal an error
22:32:21
phoe
it's very likely not portable and depends on unspecified behavior as you mentioned, but it seems to be reliable enough on modern implementations
22:32:27
EdLangley[m]
But, I think that sort of "defensive programming" in a macro like static-let causes more problems than it would help
22:32:53
EdLangley[m]
It's better, IMO, to document the situations in which static-let fails and just generate normal code
22:33:32
EdLangley[m]
Basically, this means that you can't portably use l-t-v for things like memoization
22:34:41
phoe
yes - thank goodness that ASDF compiles everything by default, so you don't really get to play with interpreted code outside REPLs of these four implementations
22:36:45
Bike
static-let is exactly the kind of thing that i'd expect to not happen in an evaluator, too
22:38:00
Bike
as in, i don't think an evaluator could reasonably be expected to have any kind of "static" semantics
22:38:53
EdLangley[m]
If you want this counter behavior, you should use the let over lambda pattern :)
22:39:24
phoe
EdLangley[m]: not a wrong thing from the perspective of LOAD-TIME-VALUE but a wrong thing from the perspective of an operator whose values are meant to persist across function calls in the same way closure values do
22:42:17
Bike
say, you have a macro function for static-let or whatever that returns the usual form the first time, and on subsequent expansions returns an error form
22:43:14
Bike
clearly you need to introduce another special operator to conditionalize on evaluation/compilation status.
22:44:09
Bike
although that could itself get tricky in situations like when the compiler runs the evaluator
22:44:21
EdLangley[m]
(defun foo () ...) (foo) is bad (defun foo () ...) (compile 'foo) (foo) is good
1:13:59
mrcom
What's the appropriate channel on Liberia for navel-gazing "how does Lisp compare and contrast with other languages"?
4:06:28
asarch
I have this list: (defparameter *the-list* '((:id 343 :name "foo" :date 3852308297) (:id 212 :name "bar" :date 3852308297) (:id 583 :name "baz" :date 3852308297) …)
4:11:40
beach
asarch: Since you have two lists, I think you may have to use INTERSECTION with some appropriate :KEY and :TEST arguments.
4:12:45
moon-child
beach: I think intersection does not guarantee which of its inputs it uses to make the output
4:13:00
moon-child
'The result list may share cells with, or be eq to, either list-1 or list-2 if appropriate'
4:56:18
mfiano
Bike: Reading the spec for *-D-C, it doesn't seem to matter which parameter I specialize in a :AFTER method, PREVIOUS, CURRENT, or both. Is this correct?
4:58:51
Bike
if you care about updates from one class specifically to another class you need to specialize both. if you care about updates from one class to anything you only specialize on that.
4:59:39
mfiano
I thought one is just a copy of the other, a they would both always be instances of the same direct class
5:00:14
Bike
No, previous is the copy, and it is a direct instance of whatever class the instance being changed used to have
5:05:57
mfiano
Bike: Unfortunately, this seems to have the same bad behavior as SHARED-INITIALIZE for me.
5:09:20
mfiano
The method in the above gist, should _only_ SETF those slot values to the supplied initargs when CHANGE-CLASS's NEW-CLASS-NAME argument matches that of the class I'm specializing on. In the printout, the CAR of the list in the printed represenation is that class name.
5:10:01
mfiano
As you can see, the second invocation, called CHANGE-CLASS with 'SRGB as the new-class-name. I want to ensure that this method is not invoked then.
5:12:03
Bike
okay, so the mop stuff is not helping clarity here. im wondering if there isn't something weird going on such as the actual color-storage3 class object being used both times but its list of mixins changing.
5:14:45
mfiano
c0/c1/c2 initargs update the instance correctly when the first mixin is added with #'MIX, but after the second one, the instance has been reset to the default state.
5:14:57
Bike
like, what you're describing here is your implementation not dispatching correctly, which is a deep enough problem that it seems unlikely
5:21:48
mfiano
The problem is with the mixin system. I see the issue. Trying to find a solution is hard.
5:24:28
mfiano
Which makes sense. I want to change the class to be an anonymous class containing all the previous classes as superclasses, plus the additional new class.
6:43:06
mfiano
Hmm, for once I don't know if anything built-in can help me here, and I don't have any good ideas for how to do the plumbing myself.
7:07:00
moon-child
kathe: I do not know. I expect you would be more likely to get a response in a forum dedicated to X. I will note: the 'fn' key is usually handled in firmware or similar
7:22:40
mrcom
mfiano: update-instance-for-different-class is going to match as long as current is color-storage3 **or a subtype**, right?
7:24:08
mfiano
Yes. There is a bit of anonymous class MOP stuff going on that doesn't make what is going on very obvious, but yes.
7:25:03
mfiano
That isn't valid syntax. EQL value must be quoted, and I'm specifically looking for a class, not a value.
7:30:03
mfiano
I sometimes use Sharpsign number to refer to values here, but that's besides the point.
7:35:21
mfiano
The problem here is that the new-class argument passed to CHANGE-CLASS is always going to be a an anonymous class whose direct superclasses include the previous class plus one more additional class. I would have to disassemble the direct superclass list to see which class was just added.
7:36:03
mfiano
That information is not provided explicitly to UPDATE-INSTANCE-FOR-DIFFERENT-CLASS as in normal circumstances.
7:36:58
mfiano
Basically this mixin system is creating (and memoizing when new) anonymous classes containing a list of superclasses.
7:38:02
attila_lendvai
i wonder why i don't see many users of cffi/c2ffi... are people aware of how easy it is to generate FFI's with those tools?
7:39:18
mfiano
I would assume the answer has to do with the ultimate goal of a Lisp OS, or a pure Lisp stack for those less ambitious people.
7:40:05
Shinmera
I've written a lot of wrappers and I don't like the dependencies and style of code these autogenerators produce, so I just write them by hand.
7:40:21
phoe
attila_lendvai: oh? what are they using as alternatives to cffi? implementation-specific stuff?
7:41:15
attila_lendvai
phoe, cffi/c2ffi is a subsystem of cffi. this kinda answers my question... :) people are not aware of it
7:43:02
attila_lendvai
Shinmera, cffi/c2ffi generates pretty much the exact same names as they are in the C namespace (it generates into an empty package, and even retains the upper/lower case of symbols).
7:43:18
attila_lendvai
Shinmera, then you can add a foo/fancy package that lispifies it as you see fit
7:43:57
attila_lendvai
phoe, yes, like cl-autowrap, but c2ffi is using clang as a lib to parse the code and extract the metadata for the FFI
7:43:59
mfiano
mrcom: There's a few solutions, that being one of them. A couple others are, checking the supplied-p argument for the initargs supplied, and also doing a doing some set theoretical operations on the direct superclass list to see exactly which class was added.
7:46:10
attila_lendvai
phoe, didn't know about claw, it looks like something very similar. sadly, cffi/c2ffi predates it by several years, feels like duplicate effort.
7:46:38
mrcom
Custom combination that bases match against class equality rather than subtype matching
7:47:56
attila_lendvai
Shinmera, not sure, i never looked into wrapping C++ libs. it does deal with #define macros properly.
7:50:48
mrcom
Random question: Anybody familiar with J.A.R Williams? My wife knew a "Dr. JAR", but as an artist. Same person?
7:51:20
attila_lendvai
whatever can be done for wrapping C++, c2ffi and the cffi/c2ffi infrastructure is fully qualified to be a comfortable framework for it.
7:54:11
Shinmera
Idunno man I feel like if someone embarks on the journey of writing something like claw they'd have already checked c2ffi and deemed it not usable enough.
7:57:43
attila_lendvai
Shinmera, your imagination is rather constrained then. claw seems to be a fun project (looks like it does the c2ffi part also in CL). i can easily see myself embarking on that project 20 years ago, regardless of what else is available.
8:22:26
attila_lendvai
any ideas what else the CFFI readme should mention besides claw and cl-autowrap?
8:27:25
attila_lendvai
considering that each of us only has a limited time on earth, that is so much not true...
8:28:09
attila_lendvai
let alone when a project has no specification, and the only "API" is a binary blob...