Re: RFC 181 (v1) Formats out of core / New format syntax
[email protected] (Nathan Wiger) Fri, 01 Sep 2000 08:52:30 -0700
| Newsgroups | perl.perl6.language.io |
|---|---|
| Message-ID | <[email protected]> |
> Have you also looked at Damian's Text::Autoformat, which has a renewed format > implementation that looks *very* good a candidate for replacing perl 4/5's > format. Yes, I have. It's actually very powerful. I've actually been meaning to talk to Damian about this, because at one time he had mentioned proposing a modification of it to replace Perl's formats. In which case, this would obviously be integrated here. > write [format_name] [filehandle]; > > I don't know if I want a comma there, I think yes, but ... Well, if we did it this way, what we'd actually want is: write $FILEHANDLE $FORMAT; The reason is this could use Perl's indirect object notation: $FILEHANDLE->write($FORMAT); Automatically. Plus, it preserves the current write() syntax intact. This is what I was going to put in v2. > If there is a need for migration anyway, look at Damian's implementation again > and add new functionality at the same time, like footers. Agreed. I wanted to get the basic idea out there so people could start thinking about it. > > my format $FILE_FORMAT = > > @<<<<<<<<<<<<<: @<<<<<<<< > > $name, $ssn > > . > > And get rid of the '$' too. If it's feasable in your mind to do it in the > perl6 parser, it would also be possible to move that to the perl5-perl6 > converter. Can't do that. This syntax simply declares a lexical variable $FILE_FORMAT of type format, which is a special variable class that could compile formats for use by write. Removing the $ would be a bad idea; it would special-case one variable name in one specific instance. Both filehandles and file formats should be $scalars in Perl 6. -Nate