unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* list3i etc.
@ 2013-03-07  6:22 Eli Zaretskii
  2013-03-07  7:01 ` Eli Zaretskii
  2013-03-09  1:59 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2013-03-07  6:22 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> +2013-03-07  Dmitry Antipov  <dmantipov@yandex.ru>
> +
> +	* lisp.h (list2i, list3i): New functions.
> +	(list4i): Move from window.c and make LISP_INLINE.

Can we have a more mnemonically significant names for these, please?
Like list_of_numbers2, list_of_numbers3, etc., for example?



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

* Re: list3i etc.
  2013-03-07  6:22 list3i etc Eli Zaretskii
@ 2013-03-07  7:01 ` Eli Zaretskii
  2013-03-07  8:58   ` Dmitry Antipov
  2013-03-09  1:59 ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2013-03-07  7:01 UTC (permalink / raw)
  To: dmantipov; +Cc: emacs-devel

> Date: Thu, 07 Mar 2013 08:22:01 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > +2013-03-07  Dmitry Antipov  <dmantipov@yandex.ru>
> > +
> > +	* lisp.h (list2i, list3i): New functions.
> > +	(list4i): Move from window.c and make LISP_INLINE.
> 
> Can we have a more mnemonically significant names for these, please?
> Like list_of_numbers2, list_of_numbers3, etc., for example?

Also, why are they implemented as inline functions?  They call list,
list3, etc. which aren't inlined.



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

* Re: list3i etc.
  2013-03-07  7:01 ` Eli Zaretskii
@ 2013-03-07  8:58   ` Dmitry Antipov
  2013-03-07  9:11     ` Xue Fuqiao
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dmitry Antipov @ 2013-03-07  8:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 03/07/2013 11:01 AM, Eli Zaretskii wrote:

>> Can we have a more mnemonically significant names for these, please?
>> Like list_of_numbers2, list_of_numbers3, etc., for example?

Of course we can. But IMHO they're "mnemonically significant" already,
and the similar approach is widely used here and there. For example,
OpenGL API uses glFoo[sifd] to denote versions of glFoo with short/int/
float/double arguments.

> Also, why are they implemented as inline functions?  They call list,
> list3, etc. which aren't inlined.

Hm... I guess that we don't want function call overhead for such a simple
things; these might be macros, but it looks like that everyone tends to
use [HEADER]_INLINE instead of them.

Dmitry




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

* Re: list3i etc.
  2013-03-07  8:58   ` Dmitry Antipov
@ 2013-03-07  9:11     ` Xue Fuqiao
  2013-03-07  9:30       ` Dmitry Antipov
  2013-03-07  9:23     ` Eli Zaretskii
  2013-03-07 21:17     ` Paul Eggert
  2 siblings, 1 reply; 9+ messages in thread
From: Xue Fuqiao @ 2013-03-07  9:11 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Eli Zaretskii, emacs-devel

On 03/07/2013 04:58 PM, Dmitry Antipov wrote:
>>> Can we have a more mnemonically significant names for these, please?
>>> Like list_of_numbers2, list_of_numbers3, etc., for example?
>
> Of course we can. But IMHO they're "mnemonically significant" already,
> and the similar approach is widely used here and there. For example,
> OpenGL API uses glFoo[sifd] to denote versions of glFoo with short/int/
> float/double arguments.

In GNU Coding Standards (just for reference):

"The names of global variables and functions in a program serve as 
comments of a sort. So don’t choose terse names—instead, look for names 
that give useful information about the meaning of the variable or function."

"Try to limit your use of abbreviations in symbol names. It is ok to 
make a few abbreviations, explain what they mean, and then use them 
frequently, but don’t use lots of obscure abbreviations."

"Please use underscores to separate words in a name, so that the Emacs 
word commands can be useful within them."

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



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

* Re: list3i etc.
  2013-03-07  8:58   ` Dmitry Antipov
  2013-03-07  9:11     ` Xue Fuqiao
@ 2013-03-07  9:23     ` Eli Zaretskii
  2013-03-07 21:17     ` Paul Eggert
  2 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2013-03-07  9:23 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> Date: Thu, 07 Mar 2013 12:58:09 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: emacs-devel@gnu.org
> 
> On 03/07/2013 11:01 AM, Eli Zaretskii wrote:
> 
> >> Can we have a more mnemonically significant names for these, please?
> >> Like list_of_numbers2, list_of_numbers3, etc., for example?
> 
> Of course we can. But IMHO they're "mnemonically significant" already,

Obviously, I disagree.  The names list2, list3 etc. _are_ good for
mnemonics, because all they do is construct lists of N members.  But
what is the 'i' part is completely obfuscated, IMO.

If the length of the name is a factor, then I can suggest list_ints2,
list_ints3 etc.

> and the similar approach is widely used here and there. For example,
> OpenGL API uses glFoo[sifd] to denote versions of glFoo with short/int/
> float/double arguments.

That others sin similarly shouldn't stop us from doing TRT ;-)

> > Also, why are they implemented as inline functions?  They call list,
> > list3, etc. which aren't inlined.
> 
> Hm... I guess that we don't want function call overhead for such a simple
> things

Why not?  Are these used in any context where speed matters?



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

* Re: list3i etc.
  2013-03-07  9:11     ` Xue Fuqiao
@ 2013-03-07  9:30       ` Dmitry Antipov
  2013-03-07 22:46         ` Stephen J. Turnbull
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Antipov @ 2013-03-07  9:30 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: Eli Zaretskii, emacs-devel

On 03/07/2013 01:11 PM, Xue Fuqiao wrote:

> In GNU Coding Standards (just for reference):

I just treat listXi functions simple and obvious like their listX counterparts;
reading the standard literally, we should eventually drop car and cdr since
they're not "mnemonically significant" everywhere beyond IBM704 :-).

Dmitry





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

* Re: list3i etc.
  2013-03-07  8:58   ` Dmitry Antipov
  2013-03-07  9:11     ` Xue Fuqiao
  2013-03-07  9:23     ` Eli Zaretskii
@ 2013-03-07 21:17     ` Paul Eggert
  2 siblings, 0 replies; 9+ messages in thread
From: Paul Eggert @ 2013-03-07 21:17 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

On 03/07/13 00:58, Dmitry Antipov wrote:

> I guess that we don't want function call overhead for such a simple
> things; these might be macros

Let's not use macros unless we really need their power.
Here it's not needed.

My guess (without really knowing) is that making the
functions inline doesn't buy much performance.  When in
doubt, it's usually better to use ordinary functions
instead of inline.




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

* Re: list3i etc.
  2013-03-07  9:30       ` Dmitry Antipov
@ 2013-03-07 22:46         ` Stephen J. Turnbull
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen J. Turnbull @ 2013-03-07 22:46 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Xue Fuqiao, Eli Zaretskii, emacs-devel

Dmitry Antipov writes:

 > [R]eading the standard literally, we should eventually drop car and
 > cdr since they're not "mnemonically significant" everywhere beyond
 > IBM704 :-).

Lack of mnemonic significance here is a feature.[1]

Footnotes: 
[1]  At least now that the convention is universal.




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

* Re: list3i etc.
  2013-03-07  6:22 list3i etc Eli Zaretskii
  2013-03-07  7:01 ` Eli Zaretskii
@ 2013-03-09  1:59 ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2013-03-09  1:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Antipov, emacs-devel

> Can we have a more mnemonically significant names for these, please?
> Like list_of_numbers2, list_of_numbers3, etc., for example?

I think list2_int, list3_int would be fine, no need to get
extra verbose.  As for inline or not, I don't think it matters either way.


        Stefan



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

end of thread, other threads:[~2013-03-09  1:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-07  6:22 list3i etc Eli Zaretskii
2013-03-07  7:01 ` Eli Zaretskii
2013-03-07  8:58   ` Dmitry Antipov
2013-03-07  9:11     ` Xue Fuqiao
2013-03-07  9:30       ` Dmitry Antipov
2013-03-07 22:46         ` Stephen J. Turnbull
2013-03-07  9:23     ` Eli Zaretskii
2013-03-07 21:17     ` Paul Eggert
2013-03-09  1:59 ` Stefan Monnier

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