[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (format "Hello %1$S%2$s" 'world "!")

From: Clément Pit-Claudel
Subject: Re: (format "Hello %1$S%2$s" 'world "!")
Date: Sun, 2 Jul 2017 13:25:43 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 2017-07-02 12:54, Noam Postavsky wrote:
> On Sun, Jul 2, 2017 at 12:32 PM, Clément Pit-Claudel
> <address@hidden> 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 can still give a new name I suppose.

I think it would be nice, if we also write a polyfill. If we don't intend to 
write one, then there's probably no point.

>> The ones I'm familiar with use $1, {1}, or similar syntax,
> What's the equivalent of %1$d in that syntax? Or is it just strings?

{1:d} (this one is Python).

>> but I've never seen %1$s :/
> It's a POSIX extension to C's printf [1,2], also used by Java [3] and perl 
> [4].
> [1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
> [2]: https://en.wikipedia.org/wiki/Printf_format_string
> [3]: https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
> [4]: https://perldoc.perl.org/functions/sprintf.html

Then I guess it's good enough :) Maybe I just need to get used to that syntax.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]