emacs-devel
[Top][All Lists]
Advanced

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

Fwd: Moving files from lisp/gnus/ to lisp/net/?


From: Daiki Ueno
Subject: Fwd: Moving files from lisp/gnus/ to lisp/net/?
Date: Fri, 9 Nov 2007 22:40:56 +0900

I'm sorry for that I sent this message only to Richard, by mistake.

---------- Forwarded message ----------
From: Daiki Ueno <address@hidden>
Date: 2007/11/09 9:33
Subject: Re: Moving files from lisp/gnus/ to lisp/net/?
To: address@hidden


2007/11/9, Richard Stallman <address@hidden>:
>     (3) if read-passwd caches passphrases when the optional argument is
>     given, some people will misuse that new feature (perhaps by cut&paste
>     existing code)
>     even though the docstring of read-passwd explicitly states that behavior.
>
> I don't follow.  What is the scenario you are worried about?
> What code are they copying and pasting?  And why is misuse
> more likely if the new feature is an optional argument
> than if it is a separate function?
>
Ok, here is my scenario:

(1) There is a package "foo" which consists of several files.

(2) "foo" manages passwords used within the package with the same key
associated in the cache.  For example both foo-imap.el and foo-smtp.el
in "foo" use read-passwd with the optional argument like this:

  (read-passwd "Password: " "foo")

(3) The author of another package "bar" wants to read password which
is not necessarily cached.  He searches for appropriate code in
several elisp packages including "foo", and finds several uses of
read-passwd:

  foo/foo-imap.el: (read-passwd "Password: " "foo")
  foo/foo-smtp.el: (read-passwd "Password: " "foo")
  baz.el: (read-passwd "Password: ")

The first two lines and the last one looks similar and the author of
"bar" might use the former with a change of the package name "foo" ->
"bar".

On the other hand, if there is a separate function named
password-read-and-cache and "foo" uses this function, the author of
"bar" will find:

  foo/foo-imap.el: (password-read-and-cache "Password: " "foo")
  foo/foo-smtp.el: (password-read-and-cache "Password: " "foo")
  baz.el: (read-passwd "Password: ")

The first two lines and the last one looks different and it is quite
obvious for the author of "bar" that the first two do password caching
and the last one doesn't.

BTW, though it might not match elisp, there is an argument of function
naming in other languages.
http://www.zenspider.com/dl/rubyconf2005/open-uri.pdf

That says "give shorter names to frequently used functions, longer
names to rarely used functions".  My suggestion is based on the fact
that I hope that password caching in elisp will not be used frequently
;-)

Regards,
--
Daiki Ueno


-- 
Daiki Ueno




reply via email to

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