Re: Metadata

2002-03-18 Thread Larry Wall

Charles Bunders writes:
: I came across Simon Cozens email
: (http:[EMAIL PROTECTED]/msg08641.html) again
: tonight and it got me thinking...
: 
: In Perl 6 are modules compiled down to pbc (Perl byte code) going to also
: create metadata similar to what .NET has describing methods, use, etc.

We have to do that if we want to run well on top of .NET.

: I don't think it would be that dificult to do and you could do some interesting
: things with the development environments on the various platforms with it as
: well.
: 
: Just curious if you plan on keeping with the POD documentation in the source or
: had some magic mojo you would be throwing in either with the pbc or files that
: go with it?

Hasn't been designed yet.  POD streams will certainly have to be
accessible, but so will various kinds of metadata derived from Perl
declarations.  So it's unlikely to be an either/or thing.

Larry



Re: rethinking printf

2002-03-18 Thread Jim Cromie

  Rich Morin wrote:

> At 11:24 PM -0500 3/6/02, Uri Guttman wrote:
>
>>  qn would be just like qq but not allow any
>> direct hash interpolations (%foo or %foo{bar}). you can always get those
>> with $() if needed. this solves the common case with a minimal of noise
>> and the uncommon case has a simple out of using $(). no need for wacko
>> ways to put in \n. it is double quotish in all ways but one and mainly
>> to be used for printf format strings.
>
>
> I also like this because it allows a typical format string to be 
> converted
> merely by adding a two-character prefix:
>
> printf("The value is %7.2f\n", $foo);
> ---
> printf(qn"The value is %7.2f\n", $foo);
>
> -r

if qf() is defensible, it should pass some generality tests;

1. make it 'replace' printf
print qf'%s %d', $somestring, $someint;

2. make it 'replace' sprintf.
$res = qf('%s %d %d', $somestr, $anint)

3. detect the silent error above - insufficient args.
this quote-like operator is now a list-op, and a smart one.

4. make it know whether %s means hash interpolation or printf-format-spec

a. ive seen perl5 warn about escaping @ when printing undefined / undeclared
@array (cant seem to replicate now :-/ )

b. the universe of printf format specs is pretty small, it really only 
interferes
with (the expansion of: @{[ each %s ]} ) a few single letter hashes %s, 
%d, etc..

c. item b implies a run-time check to see that no %s, %d, are hidden by 
a format-spec
interpretation, but that is excessive; a comment in `perldoc -f printf` 
would address
that rather fully.





Re: rethinking printf

2002-03-18 Thread Luke Palmer

On Mon, 18 Mar 2002, Jim Cromie wrote:

>   Rich Morin wrote:
> 
> > At 11:24 PM -0500 3/6/02, Uri Guttman wrote:
> >
> >>  qn would be just like qq but not allow any
> >> direct hash interpolations (%foo or %foo{bar}). you can always get those
> >> with $() if needed. this solves the common case with a minimal of noise
> >> and the uncommon case has a simple out of using $(). no need for wacko
> >> ways to put in \n. it is double quotish in all ways but one and mainly
> >> to be used for printf format strings.
> >
> >
> > I also like this because it allows a typical format string to be 
> > converted
> > merely by adding a two-character prefix:
> >
> > printf("The value is %7.2f\n", $foo);
> > ---
> > printf(qn"The value is %7.2f\n", $foo);
> >
> > -r
> 
> if qf() is defensible, it should pass some generality tests;
> 
> 1. make it 'replace' printf
> print qf'%s %d', $somestring, $someint;
> 
> 2. make it 'replace' sprintf.
> $res = qf('%s %d %d', $somestr, $anint)
> 
> 3. detect the silent error above - insufficient args.
> this quote-like operator is now a list-op, and a smart one.
> 
> 4. make it know whether %s means hash interpolation or printf-format-spec
> 
> a. ive seen perl5 warn about escaping @ when printing undefined / undeclared
> @array (cant seem to replicate now :-/ )
> 
> b. the universe of printf format specs is pretty small, it really only 
> interferes
> with (the expansion of: @{[ each %s ]} ) a few single letter hashes %s, 
> %d, etc..
> 
> c. item b implies a run-time check to see that no %s, %d, are hidden by 
> a format-spec
> interpretation, but that is excessive; a comment in `perldoc -f printf` 
> would address
> that rather fully.

I'm thinking, an operator really isn't needed is it? Hows about we extend 
printf to support double quote-like escape sequences. So:
 (s)printf 'Hello $foo,\n how %s you?', 'am';
Would print:
Hello $foo,
how am you?

In other words, we change printf, not the quotes.