unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* return values
@ 2009-11-10 10:33 Andreas Roehler
  2009-11-10 13:10 ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Roehler @ 2009-11-10 10:33 UTC (permalink / raw)
  To: emacs-devel


Hi,

IMHO it might be helpful, if classes of functions have
a regular return value.

For example functions which move point should return point.

`goto-char' does it presently, beginning/end-of-defun not.

Also I suggest mentioning the return value in
docstring.

Thanks all


Andreas

--
https://code.launchpad.net/s-x-emacs-werkstatt/
http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/





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

* Re: return values
  2009-11-10 10:33 return values Andreas Roehler
@ 2009-11-10 13:10 ` Alan Mackenzie
  2009-11-13 10:56   ` Andreas Roehler
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2009-11-10 13:10 UTC (permalink / raw)
  To: Andreas Roehler; +Cc: emacs-devel

Hi, Andreas!

On Tue, Nov 10, 2009 at 11:33:39AM +0100, Andreas Roehler wrote:

> Hi,

> IMHO it might be helpful, if classes of functions have a regular return
> value.

> For example functions which move point should return point.

Here, it's probably more accurate to say "would have been a good idea",
since some users of the current functions will use the current return
values, even if only relying on the fact that they're always nil.

> `goto-char' does it presently, beginning/end-of-defun not.

Indeed.

> Also I suggest mentioning the return value in docstring.

I am in favour of mentioning the return value of EVERY function, even
when (or _especially_ when :-) it's only a sentence like "The return
value is of no significance".

> Thanks all


> Andreas

-- 
Alan Mackenzie (Nuremberg, Germany).




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

* Re: return values
  2009-11-10 13:10 ` Alan Mackenzie
@ 2009-11-13 10:56   ` Andreas Roehler
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Roehler @ 2009-11-13 10:56 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: XEmacs-Beta, emacs-devel

Alan Mackenzie wrote:
> Hi, Andreas!
> 
> On Tue, Nov 10, 2009 at 11:33:39AM +0100, Andreas Roehler wrote:
> 
>> Hi,
> 
>> IMHO it might be helpful, if classes of functions have a regular return
>> value.
> 
>> For example functions which move point should return point.
> 
> Here, it's probably more accurate to say "would have been a good idea",
> since some users of the current functions will use the current return
> values, even if only relying on the fact that they're always nil.
> 
>> `goto-char' does it presently, beginning/end-of-defun not.
> 
> Indeed.
> 
>> Also I suggest mentioning the return value in docstring.
> 
> I am in favour of mentioning the return value of EVERY function, even
> when (or _especially_ when :-) it's only a sentence like "The return
> value is of no significance".

...


Hi Alan,

what about not to have just one return value
hard-coded, but let it being choosed via optional
return-flags?

Let's consider the case of `forward-comment' employed
inside a `delete-comments-in-region' function.

First `forward-comment' must move. If a comment-section
is reached, function must determine its borders in
order to delete.

Now this second operations basically is redundant, as
`forward-comment' determined borders already, otherwise
it couldn't know about nested comments.

A forward-comment is already able to deliver beg, end
--separately or as a list-- and the comment itself as a
string.

So instead of executing two consecutive functions to
determine, forward-comment could take a flag:

For example

b - return beginning
e - return end
l - return beginning and end as a list
s - return found item as a string

Cheers

Andreas

--
https://code.launchpad.net/s-x-emacs-werkstatt/
http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/





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

end of thread, other threads:[~2009-11-13 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 10:33 return values Andreas Roehler
2009-11-10 13:10 ` Alan Mackenzie
2009-11-13 10:56   ` Andreas Roehler

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