Klaus Straubinger wrote:
> Kevin Rodgers <[EMAIL PROTECTED]> wrote:
>>Is it necessary to destructively modify url-callback-arguments?
>
> I am not sure because I have no complete overview over the URL library.
> But in many places dynamic binding is used where one indeed must modify
> the globally visible value of variables.

That is not what I asked.  One can change the globally visible value of
a variable without destructively modifying the original list structure.
If you intend to change the variable permanently, you use setq; if you
intend to change it temporarily (e.g. for the duration of a function
call), you use let.  But you should destructively modify the original
value only when changing the variable permanently, and only if you
understand the implications (namely, that you are modifying by
side-effect any other variable that happens to share that data
structure).

> See for example the definition
> of the function "url-http-activate-callback".

I don't see any modification of a global variable (permanent or
temporary, destructive or not) in the CVS implementation at
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/url/url-http.el?rev=HEAD&content-type=text/vnd.viewcvs-markup

> By the way: The code uses
> "(declare (special ...))" to mark these cases and to pacify the
> byte-compiler. Someone with CVS write access could replace these with an
> equivalent non-CL statement, i.e., append the named variables to
> "byte-compile-bound-variables".

No, those declarations are there to pacify the Common Lisp cravings of
the author.  The right thing to do is to defvar the global variables at
the top level (either in url-http.el itself or in one of the libraries
it requires).

>>But (append (list x) ...) is better expressed as (cons x ...):
>>
>>   (cons redirect-uri (cdr url-callback-arguments))
>
> Isn't that a matter of taste? I find it more intuitive to use "append"
> and "list" for list operations and "cons" for simple cells. But I am no
> lisp expert.

Yes, I suppose it is a matter of style.  But the fact is that cons is
the primitive function for constructing a new list from an element and
an old list.  And 2 function calls are seldom more readable than 1.

--
Kevin Rodgers



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to