<random-jellyfish>
I'm defining a class using macro inside a function and I get these warnings: caught STYLE-WARNING:
<random-jellyfish>
; Cannot find type for specializer
<random-jellyfish>
; SYSTEM-LISP::%RESUMABLE-STATE-ENV-LAMBDA-RES-13% when executing
<random-jellyfish>
; SB-PCL:SPECIALIZER-TYPE-SPECIFIER for a STANDARD-METHOD of a
<random-jellyfish>
; STANDARD-GENERIC-FUNCTION.
<random-jellyfish>
is this something I should be worried about?
<random-jellyfish>
the code works as intended at run time but this warning confuses me a little
<beach>
I think you need to paste your function to plaster.tymoon.eu
<scymtym>
the warning probably means that SBCL cannot optimize your method body as well as it could if the class that appears as a specializer was already defined at that time. since the warning is a style warning, https://sbcl.org/manual/index.html#Style-Warnings applies
<random-jellyfish>
the code is pretty big, I was wondering if anyone has seen this warning before from sbcl and if it's safe to ignore it
<ixelp>
SBCL 2.4.3 User Manual
<beach>
That's a very strange message for that situation.
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
<random-jellyfish>
sorry if it's not readable
<random-jellyfish>
it's part of a bigger project
<beach>
random-jellyfish: scymtym seems to have given the explanation.
<beach>
random-jellyfish: Do you take other remarks on that code?
<random-jellyfish>
beach, sure, any feedback is welcome
<beach>
random-jellyfish: Top-level comments take 3 or 4 semicolons.
<beach>
random-jellyfish: Lines 9 and 10 are badly indented, probably because you have TABs in your code.
<beach>
Same with line 14.
<beach>
LOOP clause keywords like COLLECT should be first on a line.
<beach>
There are probably TABs on several other lines.
<beach>
random-jellyfish: You can tell Emacs to use only spaces for indentation.
<beach>
(setq-default indent-tabs-mode nil) I think.
<beach>
In your Emacs init file.
FragmentedCurve has quit [Quit: Leaving]
<random-jellyfish>
beach: yes good points, it's on my TODO list to refactor the code to respect the recommended coding style, especially the part with spaces instead of tabs
<random-jellyfish>
I just kept postponing because I always had new functionalities I wanted to add
<random-jellyfish>
but I'll do it sooner or later
<beach>
OK.
<random-jellyfish>
I'm still not sure why it complains it can't find a specializer. The lambda-res class first generates the class declaration and then the method declaration: `(progn
<random-jellyfish>
,derived-class-decl
<random-jellyfish>
,resumable-init-fn
<random-jellyfish>
,resume-method
<random-jellyfish>
(function ,name))))
<random-jellyfish>
"The lambda-res macro first generates the ..." **
<random-jellyfish>
,derived-class-decl is expanded to a (defclass ...)
<random-jellyfish>
,resume-method is expanded to a (defmethod ...)
<beach>
random-jellyfish: You need to be more careful about terminology. DEFCLASS is not a declaration. It is a definition.
<beach>
But yeah, that sounds strange.
<beach>
Oh, wait... Those forms are not top-level, are they?
<beach>
As you pointed out, they are inside a function, right?
<random-jellyfish>
yes, the progn is inside a defun-res in my example, therefore it ends up in a defmethod
johnjaye has quit [Ping timeout: 256 seconds]
<beach>
Then, the compiler does not note the existence of the class name in the compilation environment, so when the compiler sees the DEFMETHOD definition, it is unaware of the class definition.
<random-jellyfish>
makes sense now
ym has joined #commonlisp
<beach>
Perhaps you can generate a bogus top-level DEFCLASS definition. It is OK if it is redefined later.
johnjaye has joined #commonlisp
<beach>
... in case you want to avoid the style warning.
<random-jellyfish>
yeah the lambda-res macro would have to take care of that somehow
<random-jellyfish>
is there a way to "move" the defclass outside of the progn or schedule it to be compiled at an earlier time?
<beach>
The PROGN is not the problem.
<beach>
If a PROGN is a top-level form, then the body form are also top-level forms.
<beach>
The problem is that they are inside the definition of a function or method.
<beach>
random-jellyfish: More terminology remarks: Common Lisp has "statements" only as part of a tagbody. Usually, an expression meant to be evaluated is referred to as a "form" and not a "statement".
<beach>
So "lambda" and "yield" are usually not "statements".
<random-jellyfish>
I'll remember that
<random-jellyfish>
Is there a way to evaluate forms in the top level while being inside a lower level scope like inside a function or method definition?
<random-jellyfish>
I could populate a global list variable with the defclass forms at :compile-toplevel and evaluate those forms one by one at :load-toplevel
<beach>
It is tricky in your case. The compiler processes the DEFMETHOD form before your function/method is executed, so the class would have to be defined at compile time.
ec has quit [Remote host closed the connection]
anticomputer has quit [Remote host closed the connection]
<random-jellyfish>
yeah I'd need a separate pass through the code to happen before :compile-toplevel, probably too much to ask for from sbcl and cl in general
anticomputer has joined #commonlisp
ec has joined #commonlisp
pfdietz has quit [Quit: Client closed]
fererrorocher has quit [Quit: WeeChat 4.2.1]
green_ has quit [Ping timeout: 260 seconds]
b00p has joined #commonlisp
waleee has quit [Ping timeout: 260 seconds]
nij- has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
attila_lendvai has quit [Quit: Leaving]
wacki has joined #commonlisp
cage has joined #commonlisp
<cage>
Hi! I think I have found a difference between bordeaux-threads version 1 and version 2
<cage>
(bt:make-thread (lambda () (format t "~a" 1.0))); prints 1.0
<cage>
(bt2:make-thread (lambda () (format t "~a" 1.0))); prints 1.0f0
<beach>
cage: As I recall fe[nl]ix mentioned some incompatible changes.
b00p has quit [Quit: b00p]
<beach>
This one seems to have something to do with how special variables are initialized.
chomwitt has quit [Ping timeout: 240 seconds]
<cage>
Hi beach! regardless of the library I guess there is some kind of dynamic variable binding for the printer here, but i am not able to figure out wich one, from the hyperspec :(
<cage>
beach: yes :)
yitzi has joined #commonlisp
<cage>
i wonder how can i force the printer to print the 'f' in a floating point number
<ixelp>
bordeaux-threads/apiv2/api-threads.lisp at 4c3914b427706d1dec5cc5b2318e33c45f76a871 · sionescu/bordeaux-threads · GitHub
<cage>
yitzi: thanks!
<beach>
It seems to have to do with *READ-DEFAULT-FLOAT-FORMAT*. Perhaps it is 'SINGLE-FLOAT when the 1.0 is read, and 'DOUBLE-FLOAT when it is printed so the 1.0f0 is printed.
<cage>
beach: thanks, you are right!!
<yitzi>
Correct, FORMAT ~f consults *READ-DEFAULT-FLOAT-FORMAT*
<cage>
beach: yitzi thank you very much!
<beach>
Sure.
pfdietz has joined #commonlisp
fererrorocher has joined #commonlisp
random-jellyfish has quit [Ping timeout: 240 seconds]
pfdietz has quit [Quit: Client closed]
dlowe has joined #commonlisp
dra has joined #commonlisp
dra has joined #commonlisp
dra has quit [Changing host]
pfdietz has joined #commonlisp
ebrasca has quit [Remote host closed the connection]
igemnace has quit [Read error: Connection reset by peer]