freenode/#lisp - IRC Chatlog
Search
18:50:59
another-user
hi, i would like to define a method which will be called when object has changed, like :after method for setf of spicific :accessor but for whole object
18:55:21
Bike
another-user: you could define a metaclass and then a method on (setf slot-value-using-class). reinitialize-instance might result in it running more than once, though.
19:24:18
jcowan
ACTION is reading the CL0+CLOS0 document with an eye to how it might be rewritten to describe ANSI CL.
19:25:03
another-user
how would you solve followin problem: i have class with tons of different slots and i would like to serialize and save data from slots to file on every change made to instance of such class
19:25:35
another-user
there is an option mentioned by Bike but i'm not sure it's a proper way of doing it
19:27:43
another-user
i could define "update" wrapper function which will pass its args to corresponding setfs and save data to file afterwards but that doesn't seem good
19:30:19
another-user
shka_: will changing how writers/accessors are auto-generated cause same problem with reinitialize-instance?
19:31:30
stacksmith
Good morning. Does anyone know why SBCL's logcount compiles a conditional? I get TEST BYTE PTR [#x5010010B], 1 with a JEQ to a call and POPCNT on NE...
19:32:05
another-user
shka_: that's great! could you please tell me where can i find documentation on how to change how writers/accessors are auto-generated?
19:34:56
stacksmith
I have it optimising to the max, and (truly-the as an unsigned byte, etc. I was hoping to eliminate a conditional and a memory access if possible...
19:36:56
stacksmith
I thought it may be testing to see if the instruction is available - but that should not be a runtime check...
19:41:27
sjl_
https://github.com/sbcl/sbcl/blob/082a3f8317e0820ffae222bd8cd3020fd4605ea9/src/assembly/x86-64/arith.lisp#L331-L337 is where that test is coming from
19:43:07
shka_
https://stackoverflow.com/questions/25078285/replacing-a-32-bit-loop-counter-with-64-bit-introduces-crazy-performance-deviati
19:47:20
stacksmith
in '*cpuid-fn-ecx*'... Shouldn't do it once? It is very unlikely that my CPU will upgrade itself to a new model while running a tight loop....
19:50:20
stacksmith
That is just wrong... There has to be a way to set things like that to not check, locally...
19:52:12
sjl_
If you've got some profiling that shows a significant portion of your time is being spent on that TEST instruction, maybe #sbcl could help figure out an alternative approach you could take.
19:53:31
sjl_
I'd be surprised if a single instruction that always branches the same way ends up being a performance bottleneck. Even *I* can make a branch predictor that does a good job when only one branch is ever taken, and I'm not all that smart.
19:53:48
stacksmith
sjl_: I will get to that at some point... It seems that there is a whole class of session-local constants like this... I am surprised I haven't come across it before.
19:55:16
stacksmith
sjl_: True, the branch prediction should take care of that, but there is an entire cache line of code here instead of a 5-byte instruction.
19:56:40
sjl_
Sure. Profile and make sure it's actually a bottleneck, then feel free to worry about it.
19:58:21
stacksmith
sjl_: If I were a betting man, I would bet it is not a bottleneck... It's just one of those things that bug me and irritates my obsessive-compulsive disorder. I really should stop looking at disassembly.
20:05:26
makomo
stacksmith: i was going to ask what kind of an application you're writing when such stuff is so important
20:05:45
makomo
but then you said you didn't profile yet, so i was wondering "who checks the disassembly for 'no reason'?" :P
20:09:06
stacksmith
makomo: I did not profile this particular version because it would require quite a bit of work to change all the other parts of the code. And my loop is assembled with a bunch of macros, so profiling to localize problematic instructions would take a little effort...
20:10:22
makomo
stacksmith: ah i see. interesting issue nonetheless. may i ask what the program is for?
20:11:15
sjl_
SBCL will annotate the disassembly with instruction-level counts, you just have to use profile-call-counts with the function.
20:20:30
stacksmith
makomo: The particular loop is for walking a transaction log and updating the state of a data structure, which gets slow for long stretches. Basically I need dispatch for a few really fast cases (that occur often ) inline, and am always looking for branch-free ways of doing things.
21:39:52
pjb
jackdaniel: if you say that ,@form is not a form, then you won't be able to process ,,,x either.
21:40:34
jackdaniel
See rule 9: If the backquote syntax is nested, the innermost backquoted form should be expanded first. This means that if several commas occur in a row, the leftmost one belongs to the innermost backquote.
21:40:46
pjb
jackdaniel: so don't be silly, accept that in that rule, form can be prefixed by one or more , or ,@ .
22:01:52
makomo
jackdaniel: thanks. the earliest i'll be able to get to it is wednesday afternoon. i'll let you know in any case when i'm done (but it might take a while as i'm in the middle of my midterms).
23:55:37
jcowan
I'm kind of surprised that (subtypep '(simple-vector 10) '(simple-vector 5)) doesn't return true.
23:59:26
sjl
(simple-vector 10) can't be a subtype of (simple-vector 5) because the set of all 10-element simple-vectors isn't a subset of the set of all 5-element simple-vectors
0:02:44
jcowan
What they have in common is that aref and (setf aref) that works on one will work on the other, but that's not enough for Liskov substitutability.
0:19:08
jasom
If there were a type "all simple vectors with at least 5 elements" then (simple-vector 10) would be a subtype of it
0:40:13
stacksmith
In SBCL, (incf-pointer *foo*) causes "doing SAP to pointer coercion (cost 14)"... Even when *foo* is a SAP... Does anyone have any ideas of how to fix it? (sb-sys::sap+ *foo* 1) seems to do the same.
1:04:06
stacksmith
I take it back. It is really strange, but SAP-to-pointer conversion note comes up - I think in all cases where the new SAP is stored...
1:09:59
stacksmith
so (setf *foo* ptr) is fine, but (setf *foo* (inc-pointer ptr 4)) is a problem. (type-of ptr) is SB-SYS:SYSTEM-AREA-POINTER; (type-of (inc-pointer ptr 4)) is also SB-SYS:SYSTEM-AREA-POINTER and I am a bit stumped.
1:30:27
jasom
PuercoPop: it's possible that some implementaions mapc will be faster since it takes a list, not a sequence.
1:46:12
PuercoPop
sjl: ah, mapc returns something? Then yeah map nil would be a better fit for this case (stumpwm::raise-top-windows)
2:13:57
sielicki
I've been working on a homework assignment tonight and I thought it might be a good opportunity to practice lisp.
2:14:55
sielicki
I rewrote the C-like code in there into lisp. The idea is that I want to write a lisp function that takes in an arbitrary function and makes it either pass by reference or pass by value.
2:15:48
sielicki
Okay, forget I said anything about homework. I'm already done with the assignment, the class has nothing to do with lisp, it's trivial to rewrite that c-like function with pointers to make it give the results.
2:16:41
sielicki
Just on the question of an arbitrary lisp function that makes another function pass by value or pass by reference, is this possible with creative usage of quoting? I feel like it is but I'm too new to lisp to understand it.
2:19:58
LdBeth
There's a historical reason that compiler technology was not advanced to handle call by name, so macro comes out to completly replace the use of NLAMBDA
2:46:55
aeth
you can even give it an element type and override the box for 64-bit integers or double-float with your own manual box
3:02:05
sielicki
I'm giving up on my idea but I learned a lot tonight. Interesting link above, LdBeth, thanks for linking to it.
4:26:53
drmeister
Is it fair to return something like "#.(FOO x y)" from print-object if *print-readably* is T?
4:27:11
drmeister
Not x and y of course - arguments that can be evaluated in the top level environment.
4:45:34
drmeister
That's what I'm using it for - internal objects that need to be literals within fasl files.
4:51:10
fiddlerwoaroof
Especially when it doesn't matter whether the object is created at read time or not
4:52:56
elderK
fiddlerwoaroof: That raises a good question. When should you provide specializations for make-load-form and suchlike?
5:14:35
fiddlerwoaroof
I like specializing print-object, because it makes values of a particular easier to understand
5:15:21
fiddlerwoaroof
I've never used make-load-form because I've never run into a situation where adding a new loadable object was the right solution
5:16:28
fiddlerwoaroof
I use #. occasionally in print-object, when the object being printed is not supposed to be mutable
5:16:58
fiddlerwoaroof
e.g. here: https://github.com/tarballs-are-good/coalton/pull/1/commits/034df50ae3380086e5d0901402ceef5371c6ab2f
5:18:41
beach
During SICL bootstrapping, customizing print-object is a must. Otherwise, in phases 3 and 4 all objects (generic functions, classes, slot objects, methods, method combinations) print as <HEADER>. :)
5:20:15
fiddlerwoaroof
even if you use PRINT-UNREADABLE-OBJECT, it makes your classes a lot nicer to use in the repl
5:22:46
beach
SaganMan: No, but making fantastic progress. I finished phase 4, and now I am working on the necessary conditions for being able to "tie the knot", i.e. converting my acyclic graph of objects to a normal-looking cyclic graph as Common Lisp expects.
5:24:00
SaganMan
beach: woah, hasn't it been more than 4weeks since you started working on it? I don't know what kind of difficulties are, I bet it's tough
5:24:49
beach
Yes, I think it is one of the hardest things I have ever attempted. And I am quit serious about that.
5:25:26
beach
The main reason is that it has not been done before, and that involves 4 different versions of every MOP metaobject.
5:26:48
SaganMan
beach: woah so no one has done this before you? that's awesome man, you're breaking the boundaries
5:27:30
beach
Yes, I am totally convinced that nobody has tried to build a Common Lisp system this way. Not even the AMOP suggests such a possibility.
5:27:57
SaganMan
beach: it might be difficult and confusing but after all the ordeal, you'll be master of the domain.
5:28:09
beach
And the paper we are working on that describes this bootstrapping procedure shows that all the examples in the "Living with Circularity" appendix in the AMOP just disappear.
5:29:08
beach
SaganMan: Sure, but the main purpose is that one should be able to modify the source code of even the most basic MOP features, like adding a slot to a metaclass, and then just re-run the bootstrapping procedure.
5:29:51
beach
Plus, by doing it this way, I can skimp on A LOT OF maintenance problems that other systems require.
5:30:39
SaganMan
beach: I don't understand the technical stuff but from what I've worked on programming in past, it's okay if the model/system is crude or ineficient, you will make things better later
5:32:21
beach
SaganMan: Sure. Once I fully understand what I did AND once I am able to describe it fully in written form, I think it will be quite beautiful.
5:34:35
beach
SaganMan: I hope so. We are working on the paper. http://metamodular.com/bootstrapping.pdf
5:34:36
fiddlerwoaroof
I suppose you're also implementing your gf dispatch algorithm as part of this?
5:36:24
beach
We are not yet taking feedback on the paper. The description of the technique is still incomplete.
5:40:36
beach
Also, ELS is not that prestigious a conference. But I am in the luxury position that I don't need a promotion, so I can publish what I think is important and where I want to publish it, as opposed to what others think is important.
5:48:41
beach
SaganMan: Come on! Lisp is not on the radar of any research lab in the world, except possibly EPITA where Didier Verna works.
5:51:09
SaganMan
beach: I believe the research is going in new languages by taking concepts from lisp..
5:52:51
beach
Yes, that's part of the problem. Novelty is funded, even when it is not that novel. But when Lisp is mentioned, no matter how novel some technique is, it is not funded, because Lisp is considered dead.
5:53:07
shka_
i don't think that there is much of language specific research going on in the first place
5:53:15
beach
I guess drmeister has been able to revive it a bit by attaching Lisp to things that do get funded, like building molecules.
5:53:55
shka_
since 90s teached everybody that innovation in languages are mostly ignored by the industry
5:55:42
beach
Anyway, time to go find my (admittedly small) family to have breakfast. And then off to the defense. I'll be back later.
5:56:59
SaganMan
shka_: the problem is that many companies or even programmers just see programming languages as tools for their task. They hardly care about any language in particular.