Barring objections, I'm going to attempt to compile a S29.
Plan of attack:
I'm using a recent copy of Perl 5's perlfunc as a very rough template.
At some point, I'll drudge through the A's and S's to look for functions
new to Perl 6. I'll try not to make up too many new ones on my own, but
I'll
Matt Diephouse wrote:
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> wrote:
Besides, I think "as" will do just fine, especially since you can now
interpolate method calls as well. You can even do something like this
if you want to perform bulk formatting:
say join ' ', ($n1, $n2, $n3) >>.as('%
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> wrote:
> Besides, I think "as" will do just fine, especially since you can now
> interpolate method calls as well. You can even do something like this
> if you want to perform bulk formatting:
>
> say join ' ', ($n1, $n2, $n3) >>.as('%d');
What ab
On Sun, Mar 13, 2005 at 01:01:39AM +0100, Juerd wrote:
: It puts the variable name out front, which is great, but it also puts
: the second variable name a the way to the right, after the line
: noise.
print $foo.as('%03d'),
$bar.as('%15s');
Larry
Luke Palmer wrote:
Rod Adams writes:
Are the following all legal and equivalent?
for 1..10 -> $a, $b { say $a, $b };
for 1..10 { say $^a, $^b };
sub foo ($a, $b) { say $a, $b };
for 1..10 &foo;
Almost. The last one should be:
for 1..10, &foo;
Doh! I knew that.
What happens
Rod Adams writes:
> Are the following all legal and equivalent?
>
>for 1..10 -> $a, $b { say $a, $b };
>
>for 1..10 { say $^a, $^b };
>
>sub foo ($a, $b) { say $a, $b };
>for 1..10 &foo;
Almost. The last one should be:
for 1..10, &foo;
> What happens with:
>
>for 1.
Are the following all legal and equivalent?
for 1..10 -> $a, $b { say $a, $b };
for 1..10 { say $^a, $^b };
sub foo ($a, $b) { say $a, $b };
for 1..10 &foo;
What happens with:
for 1..10 -> [EMAIL PROTECTED] { say @a };
-- Rod Adams
Larry Wall wrote:
I don't see that this buys us anything over just shortening "sprintf"
to something shorter, like:
print as '%03d %15s', $foo, $bar;
And your argument list falls out naturally from making "as" a listop.
Plus it naturally lets you say other "as-ly" things:
print as MyBigInt, $
Larry Wall wrote:
I don't see that this buys us anything over just shortening "sprintf"
to something shorter, like:
print as '%03d %15s', $foo, $bar;
And your argument list falls out naturally from making "as" a listop.
Plus it naturally lets you say other "as-ly" things:
print as MyBigInt, $
Juerd wrote:
Rod Adams skribis 2005-03-12 17:41 (-0600):
Why not just rename C< sprintf > to C< format > and ditch printf and sayf?
Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:
format("%03d %15s", $foo, $bar), $baz, ...
compa
On Sun, Mar 13, 2005 at 12:58:50AM +0100, Juerd wrote:
: I'm really getting the feeling I'm the only one who uses sprintf because
: it *separates* and lets you write complex things on one simple line.
: That, and I use it a lot in one liners.
Then you should feel much better after you read my mess
On Sat, Mar 12, 2005 at 09:21:23PM +0200, Yuval Kogman wrote:
: Hola,
:
: Object::Realize::Later and friends in perl5 get the job done, but
: have many caveats.
:
: Will there be a mechanism to provide a way to do inplace replacement
: of an object's, err, thingyness (class, data), without losing
On Sat, Mar 12, 2005 at 03:13:37PM -0600, Rod Adams wrote:
: Obviously this can't happen for everything, but for the builtin methods
: and classes, I don't see a penalty for supporting both forms. Consider:
:
:$str.split($rule);
:$rule.split($str);
:
: I can see using both of those. But
Larry Wall skribis 2005-03-12 15:55 (-0800):
> Well, we do already have:
> print $foo.as('%03d'), $bar.as('%15s')
> which works on interpolated values as well. It als puts the variable
> name out front, since the name is more important than the pattern in
> most cases.
It puts the variable na
Brent 'Dax' Royal-Gordon skribis 2005-03-12 15:51 (-0800):
> Besides, I think "as" will do just fine, especially since you can now
> interpolate method calls as well. You can even do something like this
> if you want to perform bulk formatting:
> say join ' ', ($n1, $n2, $n3) >>.as('%d');
> Or
On Sat, Mar 12, 2005 at 11:57:39PM +0100, Juerd wrote:
: Without introduction, I'll just present the syntax idea:
:
: f/%03d %15s/$foo, $bar/;
:
: This gives s?printf to any expression with short and concise syntax,
: making printf redundant, which means I won't even have to start a
: discuss
Juerd <[EMAIL PROTECTED]> wrote:
> Without introduction, I'll just present the syntax idea:
>
> f/%03d %15s/$foo, $bar/;
>
> Of course, this is s///-like in quoting behaviour, so f[][] or f"""
> should work just as well. The RHS is not a string, but parsed as an
> expression in list context.
Rod Adams skribis 2005-03-12 17:41 (-0600):
> Why not just rename C< sprintf > to C< format > and ditch printf and sayf?
Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:
format("%03d %15s", $foo, $bar), $baz, ...
compared to
f/%
Juerd wrote:
Without introduction, I'll just present the syntax idea:
f/%03d %15s/$foo, $bar/;
This gives s?printf to any expression with short and concise syntax,
making printf redundant, which means I won't even have to start a
discussion about sayf :)
printf "%03d %15s", $foo, $bar;
vs
On Sat, Mar 12, 2005 at 09:40:46PM +0100, Juerd wrote:
: %foo
:
: is really
:
: %foo{'bar'}
:
: and
: :foo
:
: is actually
:
: :foo('bar')
But it's not--it's actually
:foo{'bar'}
What's happening is that :foo is using the subscript syntax oddly.
: naturally,
:
: :f
Without introduction, I'll just present the syntax idea:
f/%03d %15s/$foo, $bar/;
This gives s?printf to any expression with short and concise syntax,
making printf redundant, which means I won't even have to start a
discussion about sayf :)
printf "%03d %15s", $foo, $bar;
vs
print
Juerd wrote:
Larry Wall skribis 2005-03-12 12:26 (-0800):
And arguably, the current structure of join is that the delimiter is
the invocant, so cat should be defined as
''.join(@foo)
This is what Python does. It does not make any sense to me, and I can't
wrap my mind around it at all. R
%foo
is really
%foo{'bar'}
and
:foo
is actually
:foo('bar')
naturally,
:foo, 'baz'
is
:foo('bar'), 'baz'
but is
reverse, 'baz'
then
reverse('bar'), 'baz'
? And if that is so, then is
reverse , 'baz'
any different?
Juerd
--
http://convolutio
Larry Wall skribis 2005-03-12 12:26 (-0800):
> Well, we thrashed that one around a lot at one of our meetings, and
> the general consensus was that array interpolation and the default
> stringification of arrays should probably work the same for consistency.
> (Likewise for hashes.) And that the d
On Sat, Mar 12, 2005 at 08:37:52PM +0100, Juerd wrote:
: Juerd skribis 2005-03-12 20:32 (+0100):
: > My gut prefers that both scalar reverse LIST and ~LIST join LIST on ''.
:
: scalar reverse LIST probably returns an arrayref.
:
: I meant ~reverse LIST, which should probably do ~LIST at some poin
On Sat, Mar 12, 2005 at 21:21:23 +0200, Yuval Kogman wrote:
> Hola,
>
> Object::Realize::Later and friends in perl5 get the job done, but
> have many caveats.
FYI, Juerd told me how to clean this up with Data::Swap (err,
Data::Alias) more cleanly in perl 5.
Thanks!
--
() Yuval Kogman <[EMAIL
Juerd skribis 2005-03-12 20:32 (+0100):
> My gut prefers that both scalar reverse LIST and ~LIST join LIST on ''.
scalar reverse LIST probably returns an arrayref.
I meant ~reverse LIST, which should probably do ~LIST at some point
instead of join($sep, LIST), for consistency, and my request is t
An old exegesis says that ~ is "foo bar". It was still _('foo',
'bar') back then, though. This behaviour I couldn't find in the
Synopses, but it wouldn't be the first time I completely overlook
important information while looking for it.
I think having it stringify as "foobar" is more useful, beca
Hola,
Object::Realize::Later and friends in perl5 get the job done, but
have many caveats.
Will there be a mechanism to provide a way to do inplace replacement
of an object's, err, thingyness (class, data), without losing it's
identity?
I would like a way to transpose objects between classes in
29 matches
Mail list logo