develooper Front page | perl.perl6.language.io | Postings from August 2000

Re: RFC 181 (v1) Formats out of core / New format syntax

Thread Previous | Thread Next
From:
Nathan Wiger
Date:
August 31, 2000 09:20
Subject:
Re: RFC 181 (v1) Formats out of core / New format syntax
Message ID:
39AE807D.A49F9832@wiger.org
Johan Vromans wrote:
>
> Good work!

Thanks. :-)
 
> Is there any reason left to maintain formats as something internally
> special?

Well, as you note in your implementation suggestions, it would be nice
if Perl compiled the format the first time around. Along with the
implicit constructors suggested in RFC 171, this means that

   my format $FILE_FORMAT = ....

could create an instance of a 'format' object - $FILE_FORMAT - then use
the string assigned to it as a format to compile. It could then
recompile the format on reassignment. Personally, I think it's clearer
than qf(), more consistent with other types (int, etc), and also looks
more like Perl 5.

> How about providing the format string as an additional argument to
> write?
> 
>   write $fh, $format_string;

That's a neat idea, I like it. 
 
> Alternatively, if a real internal format type, proposed name: Format :-),
> would be desirable, yet anoter quoting operator could be useful:

I think this is definitely what I was aiming for. Though I think qf() is
a cool idea, I also worry we're going to then need qi() (int objects),
qb() (bigint objects), and so on. But I'm not against it.

Current discussions on -objects talk about making everything an object,
in which case a 'format' object make a lot of sense. That's where I
lifted the syntax in the RFC from, actually.
 
> > [2] We might consider making a special case in the Perl parser so that
> 
> This is exactly what we must try to avoid as much as possible. TPOP 
> are too many special cases already.

I agree.

-Nate

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About