freenode/#lisp - IRC Chatlog
Search
11:03:41
Josh_2
When talking about condition handling, non-local transfer of control means control being moved outside of the current function?
11:20:00
jdz
Josh_2: in case of condition handling non-local transfer of control is when the control is explicitly transferred out of the handling construct.
11:49:27
schweers
does sbcl use :type specifiers in DEFCLASS in its type inferencer? or do I have to manually specify the types of slots again in code that uses them?
11:59:34
jdz
schweers: what exactly are you trying to accomplish, considering that classes can be redefined at any time?
11:59:38
schweers
I know, and now that I think of it, it‘s somewhat obvious to me that this would at least be difficult
12:00:54
schweers
I have a class which contains --- among other things --- a simple-array of fixnums. I was naively hoping that using an accessor on an object of this class would let the compiler know what kind of value to expect. But now that I think of it, it might not be possible.
12:01:23
schweers
anyway, as soon as I add (the (simple-array fixnum) (accessor-use obj)) the compiler is happy
15:03:35
beach
schweers: SBCL uses the type information if you have the right OPTIMIZE settings, or at least it did that in the past.
15:04:34
beach
Again, the default settings are unfortunate, in my opinion, because most people just leave them that way, and then they are missing out on beter debugging behavior.
15:04:42
schweers
beach: for some reason it didn‘t for me, on the contrary: it warned me that it didn‘t have enough type information. But now that I’ve added some hints the warnings disappeared :)
16:05:04
Josh_2
How do I define a condition that needs no slots for an argument passed to a function?
16:11:52
_rumbler31
beach: can you go into a little more detail on that? I.e. what are the default settings (or what don't they provide), and what do the settings need to be, and how should they be applied?
16:12:48
beach
_rumbler31: I don't know that much. I just know that I have (declaim (optimize (speed 0) (debug 3) (safety 3))) in my .sbclrc.
16:13:26
beach
_rumbler31: And that means I catch things that people using the default settings can't, and I get more information in my backtraces.
16:14:34
beach
_rumbler31: But mainly, I am surprised that people don't do this, and instead spend a lot of time trying to find difficult bugs with the default settings. And that has made want the default setting to be different.
16:16:56
beach
But showing more detail in backtraces is very valuable. As I recall, there is also more detail about the precise location (in source code) of an error.
16:25:18
Josh_2
I read the papers _death suggested to me on the condition system in CL, and I understand how it works, but not how to actually use it...
16:26:53
beach
I mean, a simple use is just to signal an error when your program detects a situation it can not handle.
18:41:46
vsync
what does this mean? "| foo-bar | type-slot, converting FOO to BAR |" on http://www.cliki.net/naming+conventions
18:44:57
phoe_
this function, when given a symbol, extracts a package that this symbol belongs to, and returns that package
18:45:39
phoe_
generic-function-methods - accepts a generic function, returns all of its method objects
20:46:43
emaczen`
I'm using CFFI with opencv and I've defined (defcfun "cvNamedWindow" :int (name :string) (flags :int)), and it will open a window with CCL but not SBCL
20:54:25
jackdaniel
emaczen`: one thing is that you must call this function from your main thread (starting one)
20:58:48
jmercouris
any more recent performance benchmarks than these: http://www.cliki.net/Performance%20Benchmarks?
21:00:40
jackdaniel
jmercouris: https://common-lisp.net/project/ecl/static/files/misc/benchmarks/2016-05-bench-all.html
21:28:17
Josh_2
So I have this code http://paste.lisp.org/display/358158 and It currently enters the debugger and lets me choose my restart (division-by-zero-1 ..) however it is written like the example at the top of PCL page 240. I'm a lot confused about this.
21:32:57
jmercouris
like for example a defmacro that expands to a particular code on OSX and a different one on Linux
21:36:36
basket
jmercouris: You want the #+ read macro, you would use it like #+linux (foo) and foo would be evaluated iff :linux is in *features*, otherwise it's as if it were commented out
21:39:03
_death
Josh_2: there are several issues.. you define a DIVISION-BY-ZERO-1 condition, but never signal it.. when the division by zero will occur, a DIVISION-BY-ZERO error will be signaled by lisp.. you use the same name for a restart, which is just confusing; a better name would be, say, RETURN-NIL.. in N-RANDOM, you set up a handler in each iteration, which is unnecessary, you can have it once outside the loop.. you handle DIVISION-BY-ZERO-1
21:39:03
_death
conditions, which are, again, not signaled anywhere.. your handler function takes no arguments, but it should take one - the condition object
21:43:09
Josh_2
I'm very confused and there is so much information in this chapter that I'm finding it hard to ask a specific question
21:51:25
Bike
well this is the main one. if you want to handle a condition, it has to be signaled somewhere
22:00:25
Josh_2
Well I don't have to manually trigger an error of type "division-by-zero" because (mod.. will do that on it's own, so how do I catch that with a (handler-bind instead of a handler-case
22:01:24
Bike
you have the handler specialize on DIVISION-BY-ZERO, instead of DIVISION-BY-ZERO-1 like you have now.
22:02:42
Bike
yes, you'd have to define a condition class called DIVISION-BY-ZERO-1 and signal it yourself, as by ERROR.
22:04:28
Josh_2
Okay, so now now it'll look back on the stack for a handler that can deal a division-by-zero error?
22:05:21
Bike
you can try in your repl (handler-case (mod 7 0) (division-by-zero (c) (declare (ignore c)) (print 'in-handler)))
22:06:10
Bike
i know. i'm just trying to get across how the types in handler-bind and handler-case work. that part is identical between them.
22:07:55
Josh_2
Is it? Because in PCL it says that handler-bind must take a function-object unlike handler-case