all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>,
	Noam Postavsky <npostavs@users.sourceforge.net>
Subject: Re: (format "Hello %1$S%2$s" 'world "!")
Date: Fri, 22 Dec 2017 21:48:10 +0000	[thread overview]
Message-ID: <CAArVCkQr2shzVXaSUD1fQX0sHqhq6sZBMbGVzR7PCT57oLJ=pA@mail.gmail.com> (raw)
In-Reply-To: <f16415e8-7aad-cd2a-0d4a-2fa3840515a0@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

Clément Pit-Claudel <cpitclaudel@gmail.com> schrieb am So., 2. Juli 2017 um
18:34 Uhr:

> On 2017-07-02 11:03, Noam Postavsky wrote:
>
> > Why would we need a new function since %n$ would be an error for the old
> format anyway?
>
> This in itself is a good reason to have a new function.  A new function
> lets you migrate existing code, including plugins, to the new syntax, and
> load the polyfill in older Emacsen.  A new syntax that causes errors in old
> Emacsen isn't usable by anyone outside of Emacs core, for fear of
> compatibility problems.
>

We extend functions all the time. Here's a random entry from NEWS:

*** Time conversion functions now accept an optional ZONE argument
that specifies the time zone rules for conversion.  ZONE is omitted or
nil for Emacs local time, t for Universal Time, 'wall' for system wall
clock time, or a string as in the TZ environment variable.  The
affected functions are 'current-time-string', 'current-time-zone',
'decode-time', and 'format-time-string'.  The function 'encode-time',
which already accepted a simple time zone rule argument, has been
extended to accept all the new forms.

There's no difference between those changes and this one: the new syntax
was an error before, but now has a specified meaning.


>
> Also, the syntax is very heavy.  Was it inspired by another programming
> language?  The ones I'm familiar with use $1, {1}, or similar syntax, but
> I've never seen %1$s :/
>
>
As said, it comes from GNU printf.
We need to use a syntax that's backwards-compatible, that rules out $1 or
{1}.

[-- Attachment #2: Type: text/html, Size: 2219 bytes --]

  parent reply	other threads:[~2017-12-22 21:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-02 10:12 prin1 / princ vs message ? Jean-Christophe Helary
2017-07-02 11:57 ` Tino Calancha
2017-07-02 12:21   ` Jean-Christophe Helary
2017-07-02 12:32     ` Andreas Schwab
2017-07-02 12:41       ` Jean-Christophe Helary
2017-07-02 12:44     ` Tino Calancha
2017-07-02 12:45     ` Noam Postavsky
2017-07-02 13:09       ` Jean-Christophe Helary
2017-07-02 13:17         ` Noam Postavsky
2017-07-02 13:21         ` Tino Calancha
2017-07-02 13:47           ` Jean-Christophe Helary
2017-07-02 14:02             ` Jean-Christophe Helary
2017-07-02 14:23               ` Tino Calancha
2017-07-02 14:26                 ` Jean-Christophe Helary
2017-07-02 14:27               ` Philipp Stephani
2017-07-02 14:38                 ` Jean-Christophe Helary
2017-07-02 14:30               ` (format "Hello %1$S%2$s" 'world "!") Clément Pit-Claudel
2017-07-02 14:39                 ` Jean-Christophe Helary
2017-07-02 15:03                 ` Noam Postavsky
2017-07-02 16:32                   ` Clément Pit-Claudel
2017-07-02 16:54                     ` Noam Postavsky
2017-07-02 17:25                       ` Clément Pit-Claudel
2017-12-22 21:50                         ` Philipp Stephani
2017-07-02 16:56                     ` Vivek Dasmohapatra
2017-12-22 21:48                     ` Philipp Stephani [this message]
2017-12-22 21:44                 ` Philipp Stephani
2017-07-02 14:29 ` prin1 / princ vs message ? 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='CAArVCkQr2shzVXaSUD1fQX0sHqhq6sZBMbGVzR7PCT57oLJ=pA@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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.