[Top][All Lists]

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

Re: CL package serious deficiencies

From: Helmut Eller
Subject: Re: CL package serious deficiencies
Date: Sat, 11 Feb 2012 00:56:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

* Stefan Monnier [2012-02-10 18:51] writes:

>> At the risk of stating the obvious: we could define compiler-macros for
>> keyword-using functions like position and automatically rewrite all uses
>> to a keyword-less implementation like cl-position.  Then everybody could
>> use the prefix-less version without the need to (require 'cl) at
>> runtime.
> The problem with this approach is that you end up having to first
> implement the function (complex because of all the args you have to
> handle), then re-implement it all as a compiler-macro (which happens to
> be more complex and bug-prone and more difficult to debug, usually).
> In the end, a lot of complexity, lots of bugs, difficult to maintain,
> and the function itself is dog-slow because it has to handle all the
> weird combinations.
> Even a pure macro makes more sense at that point.
> I much prefer a leaner approach where instead of (delete-if #'foo :key #'bar)
> you have to write (delete-if (lambda (x) (foo (bar x)))).

This transformation can be done automatically by a compiler-macro.

> As for :start :end :from-end and :count, I've never even seen them used
> with delete-if.

Well, dropping the keyword args of delete-if would not be backward
compatible and quite a useless move.  And the :count argument is pretty
cool; surely beats stuff like byte-compile-delete-first.

> The :key in `sort*' makes sense.  Not in `delete-if'.

Sure it does.  Here's an example for remove-if with :key arg:


reply via email to

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