freenode/#lisp - IRC Chatlog
Search
2:23:32
moldybits
is it possible for a method to specialize on two different types for the same argument? ie, that it has to be a subtype of both types specified, to be considered a match.
2:30:49
Bike
ofc you can just define a new class that has both as superclasses, and have your actual class be a subclass of that one
2:31:30
White_Flame
note to self: do not recompile with unfinished code (defparameter *tags* (loop ))
2:33:23
aeth
moldybits: If you must dispatch on types instead of classes, you can use a library like specialization-store, but this dispatch will be slower than even method dispatch is unless it can be inlined. https://github.com/markcox80/specialization-store/
2:33:58
aeth
There might be a few other ways to do it, other than the obvious manual way of having a function with a TYPECASE in it.
2:34:28
White_Flame
or the obvious manual way of having 2 defmethods which call the same shared function
2:36:24
aeth
White_Flame: That's an interesting idea for how to implement this behavior in a define-method extension to defmethod. Perhaps inlining that function.
2:36:38
aeth
White_Flame: Of course, perhaps the proper way to do define-method is to heavily MOP it.
2:44:10
moldybits
the method is object-open and the argument is an instance of door inhereting from object, openable-mixin, and lockable-mixin
2:46:49
moldybits
the problem is when something is lockable but not openable. the object-open method specializing on lockable-mixin will still match
3:06:51
moldybits
i probably shouldn't have lockable and openable be mixins. they could go into a list as properties.
3:07:48
moldybits
either i could have a lock in a list of properties, or i could have a locked-p slot, and check for the existence of that slot. hm.
3:07:50
aeth
moldybits: wouldn't (subtypep (type-of o) 'lockable-mixin) also work like this? (typep o 'lockable-mixin)
3:08:35
aeth
If that works (not sure) then you can just use typecase, and even though that will nest in more conditions, it could potentially be more efficient.
3:11:40
moldybits
i'm slowly reading through Keene's OOP in CL book, and i wanted to try applying CLOS to a text game.
3:11:46
aeth
moldybits: I wouldn't use slot-value... accessors are a better in just about every way afaik, including performance, surprisingly.
3:13:38
moldybits
hm. there are so many ways of implementing this, and i'm having trouble weighing them against each other.
3:14:17
aeth
moldybits: If you're always going to call SAY, I would have one SAY at the bottom and build it at the top. You can do this with multiple-value-binds and values. So (multiple-value-bind (status text) ...) and e.g. inside the conditional (values :success "opened ~A")
3:15:14
aeth
Then you'd just have one (say status text o) at the bottom and the flow is a lot cleaner
3:15:37
aeth
Combine that with with-accessors instead of slot-value and the function should be a lot more readable imo
3:17:09
aeth
Using lots of internal bindings also has the advantage that you can easily spin off helper functions if the function grows too big
5:12:52
beach
jackdaniel: Maybe databases don't have to imply copying. But it seems to me that current technology requres it.
5:34:37
no-defun-allowed
I found a very nice "dictionary" entry on the topic of business objects. It seems to be some kind of way to generate reports without having to know the internal structure of a database?
5:35:21
no-defun-allowed
Or, rather, it's a system of representing orders and reports as objects somehow. Never mind, I don't understand that either.
5:37:47
no-defun-allowed
Scrolling back, I don't think it would be legal to use the source code if it was reachable from inside the environment, especially for developing competing products.
6:35:27
beach
liangchao: This channel is dedicated to Common Lisp, so that's the only dialect discussed here.
6:57:33
loke
The only reasonable way forward if _I_ want to help that happen, is to implement a GTK+ backend (since GTK+ works on Windows). I am not going to do any Windows development.
6:59:21
loke
However, proper native integration would be slightly harder. For example, font management can't use the operating-system provided rendering engine (SDL has its own). Also things like cut&paste will not work as well.
7:00:01
loke
If I use GTK+, then the graphics rendering will be implemented by Cairo, which is _very_ nice.
7:04:31
splittist
Extensive commentary on the process of writing a backend would make subsequent backends easier and, therefore, more likely. (Since there is no consensus on the 'best' gui library.)
8:41:17
White_Flame
how do you fiddle negatives? first test the high bit then do an optional subtraction?
8:42:16
shka__
White_Flame: take the high bit from the integer, dpb into result, take other bits, dpb into result
8:44:26
White_Flame
there's some fancy-pants C code that can do it for a fixed register width, but CL doesn't have that notion
8:45:16
White_Flame
I mean, the naive transformation is pretty straightforward, but as this is in the middle of an emulator, I'd want it to be pretty fast if possible
8:47:25
White_Flame
I do have a ffi union that casts between float, double, signed & unsigned ints, char array, etc that I use for float conversions, but the code ends up being surprisingly large
8:48:00
White_Flame
that needs to be treated as a signed 10-bit number, resulting in that numeric interpretation
8:48:27
White_Flame
erm, wait, I'm shooting off the cuff a bit quick. For a 10-bit value, it's -512 to +511 I guess
8:50:16
White_Flame
I'll play with it, just curious if there was some well-known algorithm for non-fixed-width values
9:54:22
p_l
beach: haven't done much with it, but GemStone/S is essentially a smalltalk environment where some objects are persisted transparently + there are interfaces for indexing them
9:57:56
adip
Hi, I'm trying to rewrite funciton in lisp (sbcl). I'd need a for loop like this one for(int i=3; i<x/2; i+=2)
9:58:53
adip
I've read few webpages about loops avalible in common lisp, but I can't find something similar.
11:13:23
p_l
beach: while there are non-Smalltalk interfaces to GemStone, the database always provides the programming model of "just write smalltalk in the same image and enjoy persistence"
11:14:46
p_l
beach: yes. I believe that due to real world-friction, some of it might depend on whether something is marked as persistent or not, but references etc. remain valid
11:37:03
p_l
I consider them least SQL-like part of SQL because they explicitly deal with "array" instead of a set
11:39:49
p_l
by itself SQL is mostly a bit COBOL-esque language for set manipulation, and doesn't really require any special relationship with disk and the like
11:40:23
p_l
but the quality of education about it is dismal and I spent a long time fixing issues caused by it :( :(
11:40:38
p_l
maybe not as bad as what typical student takes away about lisp from typical CS course, but...
11:49:03
White_Flame
yeah, I work with a really good SQL guy. I personally have never dug too much into it
11:49:32
White_Flame
I'm amazed at the horror stories he tells me, compared to what I'm used to seeing from him
11:49:36
p_l
I don't consider myself good at it, but if your data can be viewed as set relations, it's pretty amazing
11:50:11
p_l
often that database work is on SQL because it kinda won for a long time over some other options
13:31:26
warweasle
beach: No. I sometimes need to manipulate large amounts of data and it's very useful for that and templating my applications.