unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emacs-lisp/cl-*.el and requirement of cl
@ 2008-07-03 21:30 Glenn Morris
  2008-07-03 22:04 ` Miles Bader
  0 siblings, 1 reply; 2+ messages in thread
From: Glenn Morris @ 2008-07-03 21:30 UTC (permalink / raw)
  To: emacs-devel


Does anyone know why emacs-lisp/cl-compat.el does this:

  ;; Require at load-time, but not when compiling cl-compat.
  (or (featurep 'cl) (require 'cl))

rather than just a simple "(require 'cl)"?

Similarly, cl-macs and cl-seq throw errors if loaded without cl being
loaded first. Is there any reason not to just make them require cl?
I know just doing it naively can lead to a recursive require, but that
is easily worked around, eg:


*** cl.el	12 May 2008 01:45:41 -0000	1.63
--- cl.el	3 Jul 2008 21:29:27 -0000
***************
*** 632,648 ****
  
  ;; This goes here so that cl-macs can find it if it loads right now.
  (provide 'cl-19)     ; usage: (require 'cl-19 "cl")
  
  ;; Things to do after byte-compiler is loaded.
- ;; As a side effect, we cause cl-macs to be loaded when compiling, so
- ;; that the compiler-macros defined there will be present.
  
  (defvar cl-hacked-flag nil)
  (defun cl-hack-byte-compiler ()
!   (if (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form))
!       (progn
! 	(setq cl-hacked-flag t)		; Do it first, to prevent recursion.
! 	(cl-compile-time-init))))	; In cl-macs.el.
  
  ;; Try it now in case the compiler has already been loaded.
  (cl-hack-byte-compiler)
--- 632,648 ----
  
  ;; This goes here so that cl-macs can find it if it loads right now.
  (provide 'cl-19)     ; usage: (require 'cl-19 "cl")
+ (provide 'cl)
  
  ;; Things to do after byte-compiler is loaded.
  
  (defvar cl-hacked-flag nil)
  (defun cl-hack-byte-compiler ()
!   (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form)
!        (progn
!          (setq cl-hacked-flag t)  ; Do it first, to prevent recursion.
!          (load "cl-macs" nil t)
!          (run-hooks 'cl-hack-bytecomp-hook))))
  
  ;; Try it now in case the compiler has already been loaded.
  (cl-hack-byte-compiler)




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

* Re: emacs-lisp/cl-*.el and requirement of cl
  2008-07-03 21:30 emacs-lisp/cl-*.el and requirement of cl Glenn Morris
@ 2008-07-03 22:04 ` Miles Bader
  0 siblings, 0 replies; 2+ messages in thread
From: Miles Bader @ 2008-07-03 22:04 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

Glenn Morris <rgm@gnu.org> writes:
> Similarly, cl-macs and cl-seq throw errors if loaded without cl being
> loaded first.

Why would you want to?  AFAIK, those filenames are internal
implementation details of cl and not intended to be exported.
`cl' is the publicly exported interface.

> Is there any reason not to just make them require cl?

What would be the advantage over simply having users require cl
(presumably they already do so, as not doing so currently results in an
error)?

-Miles

-- 
Bacchus, n. A convenient deity invented by the ancients as an excuse for
getting drunk.




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

end of thread, other threads:[~2008-07-03 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 21:30 emacs-lisp/cl-*.el and requirement of cl Glenn Morris
2008-07-03 22:04 ` Miles Bader

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).