unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Noah Friedman <friedman@splode.com>
Cc: alex@emacswiki.org, emacs-devel@gnu.org
Subject: Re: IRC client for Emacs
Date: Tue, 20 Aug 2002 14:38:17 -0700 (PDT)	[thread overview]
Message-ID: <20020820143817.816033.FMU965@piglet.prv.splode.com> (raw)
In-Reply-To: <200208151954.g7FJsut07968@wijiji.santafe.edu> (rms@gnu.org Thursday, 15 Aug 2002 13:54:56 -0600)

>    Maybe for applications within Emacs.  In erc.el there is code like
>    this:
>
>    (defun erc-make-message-variable-name (catalog entry)
>      (intern (concat "erc-message-"
>		      (symbol-name catalog) "-" (symbol-name entry))))
>
>This seems like a space-inefficient way to store the data, creating a
>symbol for each translatable string.  Aside from that, how would you
>load a new message catalog?  I suppose you would set each of these
>variables.  That means Emacs can only hold one message catalog
>for the category at any time.

zenirc already uses separate hashtables for each language, so multiple
languages at once are supported and the current language can be
buffer-local.

It looks to me like the erc API is pretty similar to the zenirc API in
regard to using symbols for the catalog entry lookup.  The reason zenirc
chose this method was because the actual message strings change in cosmetic
ways from time to time and people aren't necessarily good at keeping the
rest of the catalogs up to date.  So if someone changed the (english)
format string in the source code, suddenly none of the other catalogs would
work anymore for that message.  (It goes without saying that these are
still maintained manually; we don't have a message entry scanner.)  Symbols
don't ever need to change, so this was a maintenance choice.  I'm not set
on preserving this style, but at the time the obfuscation factor seemed
minor in constrast to reliability.

(Also, zenirc still uses obarrays, not proper hashtables, so we are already
paying a high symbol use price.  And preserving emacs 18 compatibility is
still a goal, so the authors would probably want to implement obarray-based
catalogs as a fallback method anyway.)

Argument order is also still a potential problem in zenirc and right now
some of the catalogs probably have awkward sentence construction just to
keep the parameter order the same in every language.  I have been
contemplating some kludges to address this, such allowing an optional
argument order list for each message entry in a given language's catalog.
But I seem to recall that the C library's printf library has some feature
for dealing with this already in the format specifier, e.g.

      printf ("%2$s is %1$s", "foo", "bar");
      =| bar is foo

and wondered if this would be worth adding this functionality to emacs's
message function as part of the basic functionality for i18n in elisp
packages.

>The drawback would be that lookup is slower.  But I think this won't
>matter much, because these operations are mostly for user output.
>
>A program that needs to use various message translations, and wants to
>run fast, could look them up once at the outset and then save the
>translations in local variables.  This would combine the advantages
>of both methods.

Given the relative infrequency of messages in irc (on the order of less
than 1/s most of the time, often there are minutes of idle time), this is a
non-problem for the program we're talking about at the moment.  I am more
concerned about preloading the entire contents of the message catalogs into
memory at once, rather than lazy-loading entries as they are used.

Even for an application that might produce a lot of output very quickly,
I'm not sure that the cost of looking up the catalog entry is
significantly higher than parsing the format string and converting
arguments.  Has anyone ever profiled this?

  reply	other threads:[~2002-08-20 21:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-09 16:01 IRC client for Emacs Alex Schroeder
2002-08-09 20:25 ` John Wiegley
2002-08-10  5:37 ` Noah Friedman
2002-08-11  3:55   ` Richard Stallman
2002-08-11 18:14     ` Alex Schroeder
2002-08-11 23:06       ` Noah Friedman
2002-08-14 16:50         ` Mario Lang
2002-08-14 17:11         ` Karl Eichwalder
2002-08-14 19:07           ` Alex Schroeder
     [not found]             ` <m2sn1ht4sq.fsf@primate.xs4all.nl>
2002-08-15  8:49               ` Mario Lang
2002-08-15 19:24             ` Karl Eichwalder
2002-08-15 19:54             ` Richard Stallman
2002-08-20 21:38               ` Noah Friedman [this message]
2002-08-21  1:53                 ` Richard Stallman
2002-08-21  2:07                   ` Noah Friedman
2002-08-22  1:56                     ` Richard Stallman
2002-08-22  2:39                       ` Noah Friedman
2002-08-22  7:13                         ` Daiki Ueno
2002-08-24  2:33                         ` Richard Stallman
2002-08-24  4:03                           ` Daiki Ueno
2002-08-25  5:27                             ` Richard Stallman
2002-08-26 18:29                               ` Noah Friedman
2002-08-27 19:05                                 ` Richard Stallman
2002-08-21  6:51                 ` Eli Zaretskii
2002-08-22  0:14                 ` Karl Eichwalder
2002-08-13  1:47       ` Richard Stallman
2002-08-13  2:10         ` Noah Friedman
2002-08-13  2:18           ` Mark Ayers
2002-08-14  5:14             ` Richard Stallman
2002-08-13  6:57         ` John Wiegley
2002-08-13 20:47           ` Alex Schroeder
2002-08-14  5:15             ` Richard Stallman
2002-08-12 14:30     ` Steve Youngs
2002-08-10 17:17 ` Richard Stallman
2002-08-10 19:34   ` Alex Schroeder
  -- strict thread matches above, loose matches on Subject: below --
2002-08-24  4:32 IRC Client " Jonathan Walther
2002-08-24  5:11 ` Damien Elmes
2002-08-25  5:27 ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20020820143817.816033.FMU965@piglet.prv.splode.com \
    --to=friedman@splode.com \
    --cc=alex@emacswiki.org \
    --cc=emacs-devel@gnu.org \
    /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 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).