all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cl-generic
@ 2015-04-21 16:27 Pierre Lorenzon
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Lorenzon @ 2015-04-21 16:27 UTC (permalink / raw
  To: help-gnu-emacs


Hi,

I recently downloaded the last git emacs version. With prior
versions I used the eieio-defmethod (or eieio--defmethod)
function to create method for a given eieio class. But now even
if there are aliases the suitable method is cl-defmethod.

With the old functions I was able to give a byte compile form
as method body but it does not seem to be possibl with
cl-defmethod. One might always define a method :

(cl-defmethod mymethod ....  and then execute (byte-compile
'mymethod) but I wonder if doing that the method body is really
byte compiled. So what to do if method body will be much more
time consuming if not byte compiled ?

Regards

Pierre



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cl-generic
       [not found] <mailman.1284.1429634199.904.help-gnu-emacs@gnu.org>
@ 2015-04-26 23:33 ` Stefan Monnier
  2015-04-29 17:58   ` cl-generic Pierre Lorenzon
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-04-26 23:33 UTC (permalink / raw
  To: help-gnu-emacs

> With the old functions I was able to give a byte compile form
> as method body but it does not seem to be possibl with
> cl-defmethod. One might always define a method :

Of course eieio-defmethod and eieio--defmethod are still available, as
backward compatibility, and otherwise you can use the new
cl-generic-define-method.

But in any case, such issues should be reported via M-x report-emacs-bug
rather than in gnu.emacs.help.

> (cl-defmethod mymethod ....  and then execute (byte-compile
> 'mymethod) but I wonder if doing that the method body is really
> byte compiled.

No, that won't byte compile the method: (byte-compile 'mymethod) will
only try to compile `mymethod' which is a generic function (which
dispatches to the various possible methods) and is already
byte-compiled anyway (I could imagine extending `byte-compile' so that
it understands the internal structure of generic functions and tries to
byte-compile all the methods when applied to a generic function, but
currently it doesn't do that).

You'd have to use

    (eval (byte-compile '(cl-defmethod mymethod ....)))

to byte-compile this particular method.


        Stefan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cl-generic
  2015-04-26 23:33 ` cl-generic Stefan Monnier
@ 2015-04-29 17:58   ` Pierre Lorenzon
  2015-04-29 22:27     ` cl-generic Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Lorenzon @ 2015-04-29 17:58 UTC (permalink / raw
  To: help-gnu-emacs


Hi Stefan


thanks for your answer.



From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: cl-generic
Date: Sun, 26 Apr 2015 19:33:03 -0400

>> With the old functions I was able to give a byte compile form
>> as method body but it does not seem to be possibl with
>> cl-defmethod. One might always define a method :
> 
> Of course eieio-defmethod and eieio--defmethod are still available, as
> backward compatibility, and otherwise you can use the new
> cl-generic-define-method.
> 
> But in any case, such issues should be reported via M-x report-emacs-bug
> rather than in gnu.emacs.help.

  For me it was in fact not really a bug but much more an
  information about what effect will really have the
  byte-compile command.





> 
>> (cl-defmethod mymethod ....  and then execute (byte-compile
>> 'mymethod) but I wonder if doing that the method body is really
>> byte compiled.
> 
> No, that won't byte compile the method: (byte-compile 'mymethod) will
> only try to compile `mymethod' which is a generic function (which
> dispatches to the various possible methods) and is already
> byte-compiled anyway (I could imagine extending `byte-compile' so that
> it understands the internal structure of generic functions and tries to
> byte-compile all the methods when applied to a generic function, but
> currently it doesn't do that).


  OK !



> 
> You'd have to use
> 
>     (eval (byte-compile '(cl-defmethod mymethod ....)))

      I'll do that !

      Thanks Again





> 
> to byte-compile this particular method.
> 
> 
>         Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cl-generic
  2015-04-29 17:58   ` cl-generic Pierre Lorenzon
@ 2015-04-29 22:27     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-04-29 22:27 UTC (permalink / raw
  To: help-gnu-emacs

>> (eval (byte-compile '(cl-defmethod mymethod ....)))
>       I'll do that !

I didn't mean to recommend that.  Remember: every time you use `eval',
a kitten dies.  Better use cl-generic-define-method.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-29 22:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1284.1429634199.904.help-gnu-emacs@gnu.org>
2015-04-26 23:33 ` cl-generic Stefan Monnier
2015-04-29 17:58   ` cl-generic Pierre Lorenzon
2015-04-29 22:27     ` cl-generic Stefan Monnier
2015-04-21 16:27 cl-generic Pierre Lorenzon

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.