unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cl-macs and (require 'cl)
@ 2009-06-30 19:59 Lennart Borgman
  2009-06-30 21:07 ` Davis Herring
  2009-06-30 21:12 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Lennart Borgman @ 2009-06-30 19:59 UTC (permalink / raw)
  To: Emacs-Devel devel

How is cl-macs.el supposed to be loaded? cl-macs.el has a (require
'cl) in it. Is that a bug or?




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

* Re: cl-macs and (require 'cl)
  2009-06-30 19:59 cl-macs and (require 'cl) Lennart Borgman
@ 2009-06-30 21:07 ` Davis Herring
  2009-06-30 21:11   ` Lennart Borgman
  2009-06-30 21:12 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Davis Herring @ 2009-06-30 21:07 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

> How is cl-macs.el supposed to be loaded? cl-macs.el has a (require
> 'cl) in it. Is that a bug or?

If you do the recommended "(eval-when-compile (require 'cl))" in your code
and then use only macros from the CL package, the compiled file has
already had the macros expanded and contains no references to objects in
the CL package or to the 'cl symbol.  So it doesn't matter what's in
cl-macs.el.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




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

* Re: cl-macs and (require 'cl)
  2009-06-30 21:07 ` Davis Herring
@ 2009-06-30 21:11   ` Lennart Borgman
  2009-07-01  6:09     ` Stephen J. Turnbull
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2009-06-30 21:11 UTC (permalink / raw)
  To: herring; +Cc: Emacs-Devel devel

On Tue, Jun 30, 2009 at 11:07 PM, Davis Herring<herring@lanl.gov> wrote:
>> How is cl-macs.el supposed to be loaded? cl-macs.el has a (require
>> 'cl) in it. Is that a bug or?
>
> If you do the recommended "(eval-when-compile (require 'cl))" in your code
> and then use only macros from the CL package, the compiled file has
> already had the macros expanded and contains no references to objects in
> the CL package or to the 'cl symbol.  So it doesn't matter what's in
> cl-macs.el.
>
> Davis

The reason I am asking is that eieio.el in CEDET (which is going to be
included in Emacs soon) has this code

  (require 'cl)
  (load "cl-macs" nil t) ; No provide in this file.

Both lines seems wrong to me, but I do not know how it should look.




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

* Re: cl-macs and (require 'cl)
  2009-06-30 19:59 cl-macs and (require 'cl) Lennart Borgman
  2009-06-30 21:07 ` Davis Herring
@ 2009-06-30 21:12 ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-06-30 21:12 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

> How is cl-macs.el supposed to be loaded?

By (require 'cl).  Or more specifically

  (eval-when-compile (require 'cl))


-- Stefan






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

* Re: cl-macs and (require 'cl)
  2009-06-30 21:11   ` Lennart Borgman
@ 2009-07-01  6:09     ` Stephen J. Turnbull
  2009-07-01  9:43       ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen J. Turnbull @ 2009-07-01  6:09 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Emacs-Devel devel

Lennart Borgman writes:

 > The reason I am asking is that eieio.el

*shiver*

eieio has special needs.  You should ask the author(s) why they did it
this way, rather than using `(eval-when-compile (require 'cl))'.  If
they don't have any particular reason other than "well, it's been like
that since 1997", then you could try changing it to the recommended
form.




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

* Re: cl-macs and (require 'cl)
  2009-07-01  6:09     ` Stephen J. Turnbull
@ 2009-07-01  9:43       ` Lennart Borgman
  2009-07-01 11:25         ` Eric M. Ludlam
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2009-07-01  9:43 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Eric M. Ludlam, Emacs-Devel devel

On Wed, Jul 1, 2009 at 8:09 AM, Stephen J. Turnbull<stephen@xemacs.org> wrote:
> Lennart Borgman writes:
>
>  > The reason I am asking is that eieio.el
>
> *shiver*
>
> eieio has special needs.  You should ask the author(s) why they did it
> this way, rather than using `(eval-when-compile (require 'cl))'.  If
> they don't have any particular reason other than "well, it's been like
> that since 1997", then you could try changing it to the recommended
> form.

Yes, that is why I asked here. Eric said he will change it.

But I do not know of any particular reason for including cl.el and
cl-macs.el like they did. Maybe you could explain?




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

* Re: cl-macs and (require 'cl)
  2009-07-01  9:43       ` Lennart Borgman
@ 2009-07-01 11:25         ` Eric M. Ludlam
  0 siblings, 0 replies; 7+ messages in thread
From: Eric M. Ludlam @ 2009-07-01 11:25 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Stephen J. Turnbull, Emacs-Devel devel

On Wed, 2009-07-01 at 11:43 +0200, Lennart Borgman wrote:
> On Wed, Jul 1, 2009 at 8:09 AM, Stephen J. Turnbull<stephen@xemacs.org> wrote:
> > Lennart Borgman writes:
> >
> >  > The reason I am asking is that eieio.el
> >
> > *shiver*
> >
> > eieio has special needs.  You should ask the author(s) why they did it
> > this way, rather than using `(eval-when-compile (require 'cl))'.  If
> > they don't have any particular reason other than "well, it's been like
> > that since 1997", then you could try changing it to the recommended
> > form.
> 
> Yes, that is why I asked here. Eric said he will change it.
> 
> But I do not know of any particular reason for including cl.el and
> cl-macs.el like they did. Maybe you could explain?

Indeed, that is just the way it has been for a long time.  I did try
switching to the `eval-when-compile' part, but this doesn't work.  EIEIO
has functions which create types with deftype, and uses typep.  If I
wrap the require of cl as above, then sources creating classes can't
find the typep symbol.

It could be I am using deftype and typep in some inconsistent way.  If
someone is interested in pointing out the correct way to do these
things, I'd appreciate it.

You can look at EIEIO w/out getting the whole CEDET suite here:

http://cedet.cvs.sourceforge.net/viewvc/*checkout*/cedet/cedet/eieio/eieio.el?revision=1.185&pathrev=MAIN

Offending line #1 is at 569:  

There is some crufty old code here that can probably be done
differently.  I changed the eval thing in my copy to see if I could fix
it, but ran into a new problem:

The next offending line is at 1389

(defun eieio-perform-slot-validation (spec value)
  "Return non-nil if SPEC does not match VALUE."
  ;; typep is in cl-macs
  (or (eq spec t)			; t always passes
      (eq value eieio-unbound)		; unbound always passes
      (typep value spec)))

I'm not sure about this one.  While it is true that EIEIO can disable
slot validation, I get a lot of value from it while developing new code.

Eric




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

end of thread, other threads:[~2009-07-01 11:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 19:59 cl-macs and (require 'cl) Lennart Borgman
2009-06-30 21:07 ` Davis Herring
2009-06-30 21:11   ` Lennart Borgman
2009-07-01  6:09     ` Stephen J. Turnbull
2009-07-01  9:43       ` Lennart Borgman
2009-07-01 11:25         ` Eric M. Ludlam
2009-06-30 21:12 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).