freenode/#lisp - IRC Chatlog
Search
14:25:52
schweers
when I have an object like this: #<MYCLASS {100359AB03}> the last part is a memory address or some other kind of identity, right? Can that change over time due to the garbage collector? I’m using sbcl
14:27:35
Bike
the identity is only used in print-unreadable-object. i don't think there are any guarantees on it at all.
14:30:01
schweers
I pass an object via a closure to another thread. I do this in a loop. Normally each thread should have its own instance of this object/class (it’s basically a calispel:channel). But for some reason I have the situation that two or more threads share an object, thus weird things happen
14:31:51
Bike
however, for your problem it sounds like you could just eq-test objects from different threads?
14:32:02
schweers
beach: normally I wouldn’t care, but I’m trying to debug a situation where I care about identities
14:33:17
beach
schweers: So what are you attempting instead? Visual inspection of the printed representation?
14:33:57
Shinmera
When you create a thread, push its object to a global list or something, and then look at it to see if any of them are the same
14:34:43
Colleen
Clhs: function sxhash http://www.lispworks.com/documentation/HyperSpec/Body/f_sxhash.htm
14:34:58
jackdaniel
sxhash doesn't guarantee distinct values for distinct objects (try calling it on two different vectors on sbcl)
14:37:22
beach
Sure. Write a method in print-object specialized to your class that uses (say) sxhash.
14:38:23
beach
schweers: Other possibility: add a slot to your class and initialize it to some huge random number.
14:39:49
beach
(defmethod print-object ((object my-class) stream) (format stream "..." (sxhash object)))
14:41:33
beach
(defmethod print-object ((object my-class) stream) (print-unreadable-object (object stream :type t) (format stream "~s" (sxhash object))))
14:44:35
pjb
schweers: clhs print-unreadable-object says: If identity is true, the output from forms is followed by a space character and a representation of the object's identity, typically a storage address.
14:45:37
beach
pjb: Except that I don't think schweers knows that PRINT-UNREADABLE-OBJECT is what is used by default for printing his objects.
14:45:40
pjb
The identity of an object should not change (even if its address changes), so I would expect it not to change. But I guess an implementation may consider the identity at the instant of printing, not over long periods.
14:46:47
pjb
AFAIK, most implementations use the address there, and since the address may change, it's safer not to rely on it over time, to identify the objects.
14:48:02
beach
Like in a trace, the same object may have a different appearance at different times during the trace.
14:49:52
schweers
if I use (gensym) repeatedly, it it guaranteed that the result always has a distinct printed representation, at least if done within one thread?
14:51:11
Shinmera
Running a primitive test, it takes //a lot// of allocation before the GC kicks in and decides to move my instance, thus changing the printed ID.
14:51:35
shka
[16:32] <schweers> beach: normally I wouldn’t care, but I’m trying to debug a situation where I care about identities
14:53:08
shka
i mean that schweers does not actually care about unique ids for classes, but he seems to just debug how content of class changes in another thread
14:53:40
schweers
I believe that I have come the conclusion that my problem was not the gc moving objects around after all, yet I still have no clue what the problem actually is :/
14:54:59
schweers
I do something like this: (iter (for obj in ...) (make-thread (lambda () ... s ...) :name ...))
14:55:46
schweers
yet on the other hand, there are at least two of these threads which have the same object
14:58:47
Shinmera
schweers: what iter does is probably something like this: (let ((s NIL)) (loop-somehow (setf s next-object) ...))
14:59:07
beach
schweers: It's the same for LOOP. The standard gives an option to behave this way for LOOP.
14:59:55
shka
schweers: try this (let ((result nil)) (map 'nil (lambda (x) (setf result x)) '(1 2 3 4 5))
15:05:55
rumbler31
sorry if this is obvious. I'm trying to work with a remote repl for which the network connection peridically drops
15:06:26
rumbler31
I renamed the emacs buffer for this connection. but when the connection drops and I re-issue slime-connect, a new repl opens instead of using the existing one
15:08:16
rumbler31
I get the impression that the emacs side is looking to open a buffer of the name *slime-repl implementation* and if it finds one, prompts me if I wish to close the old connection. I think if I say yes, the old buffer is reused, if no, a new repl is made
15:08:54
whoma
hmm there has to be a way. slime-update-connection-list ? slime-reset? slime-restart-inferior-lisp ? slime-redirect-inferior-output etc ? i would google further.
15:10:59
Shinmera
restart-inferior-lisp will shut down your lisp process, so definitely don't use that.
15:11:09
whoma
might be some info here: http://slime-devel.common-lisp.narkive.com/qYAuQeOD/port-file-and-dedicated-slime-instance
15:37:42
schweers
thanks again to everyone here. I’m off on vacation which I can now really enjoy knowing that I fixed this annoying bug!
17:08:19
rumbler31
is there a way with usocket to see if there are more bytes available to be read on a datagram socket without blocking?
17:16:36
phoe
Lisp test framework question. Is there anything in Lisp that allows me to do stuff like http://paste.lisp.org/display/351234 ?
17:16:43
phoe
Basically - declare what a test case should do in terms of test steps, then define its implementation while marking the individual test steps, then use that information when displaying error information?
17:39:39
Shinmera
I don't particularly see the point in separating the description of what happens and its implementation, though?
17:41:40
phoe
Shinmera: I see such a point though. I want to export my test cases as HTML, and for this, I need a textual representation for them.
17:42:12
Shinmera
Still no need to separate, though. You can also mix the description and extract it.
17:50:01
phoe
I mean - no problem, this is doable using the same reader macros that I have in my example. Just stuff the test step description in the same place where the evaluated expression will be.
17:52:25
rumbler31
according to the docs, not specifiying a timeout blocks, specifiying a timeout will cause the call to return no later than the timeout, or a timeout of 0 should return immediately if no input is available.
17:58:26
rumbler31
wait-for-input with timeout is returning immedately, but is returning the socket I gave it, not nil
18:01:41
phoe
rumbler31: returning the socket you gave it? are you sure you checked that "fresh list" thing that WAIT-FOR-INPUT has?
18:02:23
rumbler31
I'm going senile. I just didn't focus while I was reading the description of the function. I see how to elicit the behavior I expect now
18:27:23
rumbler31
is there a shortcut or config item for the slime inspector to default the slot view to "un-alphabetically
18:27:46
nosefouratyou
I am getting this error dexador.error:http-request-forbidden and I don't understand what the period means between dexador and error.
19:04:34
nosefouratyou
I have stuff like "0: #<CL-OANDA::INSTRUMENT #x30200235235D>" when inspecting; is it possible to change the value of #x30200235235D to something readable? or is that a specific number generated to address it?
19:06:44
Bike
nosefouratyou: it's an "identity". it's only intended to help a human reader, so it's okay to change. you can control how objects are printed by defining a method on print-object.
19:11:03
Bike
it would be something like (defmethod print-object ((object instrument) stream) (print-unreadable-object (object stream) (format stream "blah")))
20:22:44
pjb
phoe: stakeholders NEVER write tests cases, even in English. This has been demonstrated by man.centuries of cucumber test writting done exclusively 100.000000000000% of the time by PROGRAMMERS.
20:23:04
pjb
So the question is why do you want to bother with English? Just write lisp! We're lisp lovers!
22:37:59
quotation
pjb: I'm entirely for deprecating the entirety of the english language if not wholly extending it further into a "special" dialect accompanying the flavors of homoiconicity
22:50:00
slark
when i pass a variable to the macro it fails, but it works with a number can't really understand why it works
22:51:08
slark
Bike: well i know the macro def should be (list 'setq var (list '- var amount))) but well was just trying to mess a bit
22:51:48
Bike
and it sets var (not the symbol passed to the macro, var, every time) to (+ var amount)
22:58:48
pjb
Since this variable has not been declared (in the compilation environment) the actual behavior is actually implementation dependent.
23:00:15
slark
well in fact was thinking why should i return an expression to inc a variable when the inc could be done at expansion time
23:01:09
pjb
Because expansion time is normally done at compilation time, long before the values of the arguments are known.