Re: [perl6/specs] ff11f1: define %%; clarify that % is not quantmod

2011-09-29 Thread Carl Mäsak
Martin (>):
> 5. And pretty please could we have infix:<%>(Str,Capture) as an alias for
> sprintf? (Not that I'm normally a Python fan, but that feature has a
> particularly wholesome appeal about it.)

There's no problem adding this to either your user code or to CORE
today. All the prerequisites are there.

But I doubt it'll end up in CORE, and here's why:

* We have sprintf and .fmt already, and they cover that ecological niche.
* More importantly, infix:<%> is taken already in mainline Perl 6, by
a mathematical operator, no less. Perl operators in general and Perl 6
operators in particular have been about not mixing meanings of
operators, and if it's a math operator it cannot also be a string
formatting one -- for pretty strong philosophical reasons.

But, again, there's nothing to prevent you from defining a multi
infix:<%> in your code today, or even package it in a module and make
it re-usable.

// Carl


Re: [perl6/specs] ff11f1: define %%; clarify that % is not quantmod

2011-09-28 Thread Martin D Kealey
Out of curiosity, I followed this and read through "Str".

When I got to the section on "sprintf", I found a few things I think need
attention.

1. There isn't any description what the flags do, in particular 'v', which
seems to be a P6 enhancement.

2. Not mentioned are 'hh' (native char), 'j' (native maxint_t) and 'l'
(applied to 's' and 'c', native wchar_t).

3. Logically the 'p' conversion applied to an Object should return the
object identity (.id or whatever that's called now), though applied to
non-objects it should probably still throw an exception.

4. In keeping with named parameters, it seems to me that the 'index' should
be extended to allow a name rather than just an integer. Obviously that
would need the name to be disambiguated by some punctuation such as <> or
«».

5. And pretty please could we have infix:<%>(Str,Capture) as an alias for
sprintf? (Not that I'm normally a Python fan, but that feature has a
particularly wholesome appeal about it.)

-Martin

On Sun, 25 Sep 2011, nore...@github.com wrote:
> Date: Sun, 25 Sep 2011 17:33:22 -0700
> From: nore...@github.com
> To: perl6-language@perl.org
> Subject: [perl6/specs] ff11f1: define %%; clarify that % is not quantmod
>
>   Branch: refs/heads/master
>   Home:   https://github.com/perl6/specs
>
>   Commit: ff11f19331bf30327cf729a0f5c9c349caa231c7
>   
> https://github.com/perl6/specs/commit/ff11f19331bf30327cf729a0f5c9c349caa231c7
>   Author: Larry Wall 
>   Date:   2011-09-25 (Sun, 25 Sep 2011)
>
>   Changed paths:
> M S05-regex.pod
>
>   Log Message:
>   ---
>   define %%; clarify that % is not quantmod
>
> ingy++ requested a method of stopping optionally after the separator,
> so that's now %% (with some notion of "evenly divisible" in some kind
> of loose sense).  (Note, if you want to require the separator at the
> end, don't use this construct, just use [x ',']* or such.
>
> sorear++ requested clarification: % (and %%) are not really quantifier
> modifiers; they modify a quantified atom to insert requirements
> between each iteration of that quantified atom.  Hence any quantifier
> may still take an additional control quantmod in addition to a separator.
>
>
>   Commit: 6d7f9f1ad5f42fe3e14d44a10834cda869643cc7
>   
> https://github.com/perl6/specs/commit/6d7f9f1ad5f42fe3e14d44a10834cda869643cc7
>   Author: Larry Wall 
>   Date:   2011-09-25 (Sun, 25 Sep 2011)
>
>   Changed paths:
> M S32-setting-library/IO.pod
>   M S32-setting-library/Str.pod
>
>   Log Message:
>   ---
>   Merge branch 'master' of github.com:perl6/specs
>
>
> Compare: https://github.com/perl6/specs/compare/d7b5637...6d7f9f1
>