all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109327: Generalize INTERNAL_FIELD between buffers, keyboards and frames.
Date: Sun, 05 Aug 2012 18:59:10 +0400	[thread overview]
Message-ID: <501E8A3E.1090708@yandex.ru> (raw)
In-Reply-To: <501C1F4D.5010007@cs.ucla.edu>

On 08/03/2012 10:58 PM, Paul Eggert wrote:

>> why (F|W)VARs are so bad but (B|K)VARs are OK?
>
> The short answer is they're all bad.  :-)
>
> FVAR is bad partly because it has the syntax of a C function,
> but not the semantics; it cannot be implemented as a function.

Why this is a problem ever? OK, maybe AREF and ASET are better;
but the only way to implement FVARs as functions is to have
array of Lisp_Objects in struct frame and meaningful indexes
for the particular slots, i.e.

enum frame_slots
   {
     NAME,
     ICON_NAME,
     TITLE
     ...
   };

I don't like this, and most probably others will not like it too.

> How about if we compromise by switching to functional notation?
> That should be easier to read.  That is, instead of this:
>
>    return XFRAME (frame)->buffer_list;
>
> or this:
>
>    return FVAR (XFRAME (frame), buffer_list);
>
> we write this:
>
>    return frame_buffer_list (XFRAME (frame));
>
> Also, instead instead of this:
>
>    f->buffer_list = Fcons (buf, Qnil);
>
> or this:
>
>    FVAR (f, buffer_list) = Fcons (buf, Qnil);
>
> we write this:
>
>    set_frame_buffer_list (f, Fcons (buf, Qnil));

IMHO this is just a poor copy of C++ class :-(:
if you have a huge class with 50 private members, you're
enforced to have 50 get_xxx and 50 set_xxx member functions.
Most of them are inline and fast, but, (IMHO again) they
do not improve readability and makes sense only if you have
a huge class hierarchies where the fine-granted member access
control is very important for some another reason.

Dmitry



  parent reply	other threads:[~2012-08-05 14:59 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1SwCK8-0001PC-3m@vcs.savannah.gnu.org>
2012-08-01 10:33 ` [Emacs-diffs] /srv/bzr/emacs/trunk r109327: Generalize INTERNAL_FIELD between buffers, keyboards and frames Stefan Monnier
2012-08-01 12:04   ` Dmitry Antipov
2012-08-01 14:58     ` Paul Eggert
2012-08-01 16:52       ` Dmitry Antipov
2012-08-01 17:38       ` Tom Tromey
2012-08-01 21:04         ` Paul Eggert
2012-08-02  5:28         ` Stephen J. Turnbull
2012-08-01 15:01     ` Eli Zaretskii
2012-08-01 18:02       ` Dmitry Antipov
2012-08-02 15:28         ` Eli Zaretskii
2012-08-01 23:52     ` Stefan Monnier
2012-08-02  4:12       ` Dmitry Antipov
2012-08-02  5:56         ` Stephen J. Turnbull
2012-08-02  7:47           ` Dmitry Antipov
2012-08-02  9:30             ` Juanma Barranquero
2012-08-02 16:07             ` Eli Zaretskii
2012-08-02 15:45           ` Eli Zaretskii
2012-08-02 21:28             ` Paul Eggert
2012-08-03  6:27               ` Eli Zaretskii
2012-08-03  6:52                 ` Paul Eggert
2012-08-02 23:38           ` Richard Stallman
2012-08-02 15:34         ` Eli Zaretskii
2012-08-03  7:42         ` Stefan Monnier
2012-08-03  8:31           ` Dmitry Antipov
2012-08-03 18:58             ` Paul Eggert
2012-08-03 22:52               ` Stefan Monnier
2012-08-04 16:31                 ` Paul Eggert
2012-08-05 15:03                   ` Dmitry Antipov
2012-08-06 10:54                     ` Stefan Monnier
2012-08-06 11:44                       ` Dmitry Antipov
2012-08-06 16:31                         ` Stefan Monnier
2012-08-06 17:43                           ` Stefan Monnier
2012-08-08  7:22                         ` Chong Yidong
2012-08-05 14:59               ` Dmitry Antipov [this message]
2012-08-05 15:23                 ` Paul Eggert
2012-08-05 20:29                   ` Miles Bader
2012-08-03 22:50             ` Stefan Monnier
2012-08-03 23:11               ` Wojciech Meyer
2012-08-08  3:39           ` Chong Yidong
2012-08-08  7:14             ` Dmitry Antipov
2012-08-08  7:46               ` Chong Yidong
2012-08-08 10:18                 ` Dmitry Antipov
2012-08-08 12:41             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501E8A3E.1090708@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.