emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: un-deprecating CL


From: Joe Wells
Subject: Re: un-deprecating CL
Date: Mon, 17 Sep 2007 03:25:13 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Richard Stallman <address@hidden> writes:

>       incf callf callf2 setf function* destructuring-bind case typecase
>       loop union intersection set-difference subst sort* delete*
>
> That is a long list.

But also a good list.

> destructuring-bind is ok to add, because it is simple and modular.

By the way, destructuring-bind supports full Common Lisp style
argument lists.

> Likewise `case' and `typecase'.

Hurray!  These two macros are extremely useful.

> I don't want to add CL argument lists,

Just curious: Why not?

(By the way, librep, which is derived from the GNU Emacs Lisp
implementation, implements keyword arguments, optional arguments with
defaults, and dotted-list notation for &rest arguments.  It doesn't
implement all the possibilities of CL.)

> so no `function*' or `defun*'.

> I don't want to add `union' or `intersection' or `set-difference' or
> `subst' or `sort*' or `delete*', because they use CL keyword
> arguments.

Okay, but they are extremely useful functions, and people keep
reimplementing this functionality.

For example, typing “C-h a union RET” in my running Emacs reveals
union (from cl), gnus-union and gnus-sorted-union, ediff-union, and
jbw-sorted-number-list-union (my own).  And I wouldn't be surprised to
find other packages (which I haven't loaded in this Emacs) that also
implement union.

> Adding `setf' really means adding `defstruct'.

By the way, setf and related functions are very useful even without
defstruct.  It's the “generalized variable” notion which makes them
useful.  Here are some examples of using “generalized variables” from
my code that don't rely on defstruct:

  (setf (cadr break-style) 'line)
  (setf (nth 1 node) (cons (cons 'id unique-id) (nth 1 node)))

  (callf2 delete macro (cadr p))
  (callf2 concat "[" (car return-value) "]")

  (push x (symbol-value tab))
  (push ":active" (cdr (assq 'class munged)))

  (pushnew macro (cadr p) :test #'equal)

Writing out the macroexpanded versions of the above would be a pain.

I can also supply examples using structures.  I'm just pointing out
that the “generalized variable” notion is about more than structures.

> That might be a good
> feature to add, but it is too complex because of all the structure
> options.  If we get rid of most of them, `defstruct' could be simple
> enough to add.

I did forget to ask for defstruct!  So yes, defstruct also please.

> `incf' and `callf' are creeping featurism, and not worth adding.

callf is marvelous and makes it much easier to program!

I'd hate to have to define my own callf all the time.

> `setf' is enough.  But I would not mind extending `push' and `pop'
> work with structs in the CL fashion.
>
>       pushnew adjoin caaar caaddr caadr cadaddr cadar caddar cadddr caddr
>       cdaar defun* flet every substitute find subsetp
>
> `pushnew' is ok.  `caaar' and so on are superfluous, I think.
> Definitely not `flet'; I think its use is bad practice.
>
> `every', `substitute', `find' and `subsetp' have the ugly CL keyword
> arguments, so I don't want to add them.

Nonetheless, the functions are very useful.

Richard Stallman <address@hidden> writes:

>     some every notany
>     remove-if delete-if
>
> Those are useful operations, and I would like to add facilities to do
> them.

I'm very happy to hear this, because it is tiring to reimplement and
redebug such functionality.

I hope this message is helpful.

-- 
Joe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]