[From nobody Mon Aug 2 21:38:17 2004 Return-Path: <perl6-language-return-15284-mirod=xmltwig.com@perl.org> Delivered-To: mrodrigu@mirlin.xmltwig.com Received: from smtp3-out.lerelaisinternet.com (smtp3-out.lerelaisinternet.com [194.206.126.77]) by mirlin.xmltwig.com (Postfix) with ESMTP id 3D7422D9 for <mrodrigu@mirlin.xmltwig.com>; Wed, 7 May 2003 07:40:21 +0200 (CEST) Received: from av10.lerelaisinternet.com (AV10.cluster-av.wanadoo.net [192.168.164.213]) by smtp3-out.lerelaisinternet.com (8.12.0/8.12.0) with ESMTP id h475ZqsP008243 for <mrodrigu@mirlin.xmltwig.com>; Wed, 7 May 2003 07:35:52 +0200 Received: (from nobody@av.lerelaisinternet.com) by av10.lerelaisinternet.com (8.11.3/8.11.3) id h475Zo430406 for mirod@xmltwig.com; Wed, 7 May 2003 07:35:50 +0200 Received: from smtp1-in.lerelaisinternet.com (pri-smtp1-in.lerelaisinternet.com [192.168.164.193]) by av10.lerelaisinternet.com (8.11.3/8.11.3) with ESMTP id h475ZaG30379 for <mirod@xmltwig.com>; Wed, 7 May 2003 07:35:36 +0200 Received: from onion.perl.org (onion.valueclick.com [64.70.54.95]) by smtp1-in.lerelaisinternet.com (8.12.1/8.12.1) with SMTP id h475ZYOg013319 for <mirod@xmltwig.com>; Wed, 7 May 2003 07:35:35 +0200 Received: (qmail 93087 invoked by uid 1005); 7 May 2003 05:39:55 -0000 Mailing-List: contact perl6-language-help@perl.org; run by ezmlm Precedence: bulk List-Post: <mailto:perl6-language@perl.org> List-Help: <mailto:perl6-language-help@perl.org> List-Unsubscribe: <mailto:perl6-language-unsubscribe@perl.org> List-Subscribe: <mailto:perl6-language-subscribe@perl.org> Delivered-To: mailing list perl6-language@perl.org Received: (qmail 93070 invoked by uid 76); 7 May 2003 05:39:55 -0000 Received: from qmailr@one.develooper.com (HELO ran-out.mx.develooper.com) (64.81.84.115) by onion.perl.org (qpsmtpd/0.26-dev) with SMTP; Tue, 06 May 2003 22:39:55 -0700 Received: (qmail 7793 invoked by uid 225); 7 May 2003 05:39:53 -0000 Delivered-To: perl6-language@perl.org Received: (qmail 7787 invoked by uid 507); 7 May 2003 05:39:53 -0000 Received: from h007.c000.snv.cp.net (HELO c000.snv.cp.net) (209.228.32.71) by one.develooper.com (qpsmtpd/0.26-dev) with SMTP; Tue, 06 May 2003 22:39:41 -0700 Received: (cpmta 25660 invoked from network); 6 May 2003 22:39:32 -0700 Received: from 210.10.237.109 (HELO conway.org) by smtp.conway.org (209.228.32.71) with SMTP; 6 May 2003 22:39:32 -0700 X-Sent: 7 May 2003 05:39:32 GMT Message-ID: <3EB89C0F.4050607@conway.org> Date: Wed, 07 May 2003 15:39:27 +1000 From: Damian Conway <damian@conway.org> User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en, en-us MIME-Version: 1.0 To: "perl6-language@perl.org" <perl6-language@perl.org> Subject: Re: include macro References: <C2EFCC62-7FE4-11D7-8AA2-00050245244A@cognitivity.com> In-Reply-To: <C2EFCC62-7FE4-11D7-8AA2-00050245244A@cognitivity.com> Content-Transfer-Encoding: 8bit X-SMTPD: qpsmtpd/0.26-dev, http://develooper.com/code/qpsmtpd/ X-Spam-Check-By: one.develooper.com X-Spam-Status: No, hits=-1.3 required=7.0 tests=CARRIAGE_RETURNS, IN_REP_TO, REFERENCES, SPAM_PHRASE_00_01, TO_ADDRESS_EQ_REAL, USER_AGENT, USER_AGENT_MOZILLA_UA, X_ACCEPT_LANG version=2.44 X-SMTPD: qpsmtpd/0.26-dev, http://develooper.com/code/qpsmtpd/ X-Virus-Scanned: Analyse Anti-Virus (LeRelaisInternet.Com) Content-Type: text/plain; CHARSET=ISO-8859-1; FORMAT=flowed Rather than the very imaginative solutions proposed so far, I still have hopes that we'll be able to unify heredocs, POD, and general file slurping. Specifically, I hope Perl 6 will have a unary << operator, which would operate as follows: * If the operand evaluates to a string starting with "=", grab the next available POD section with the same tag as the string and slurp it. * If the operand is a string literal that does not begin with an "=", slurp the immediately following source lines until that literal appears by itself (modulo whitespace) on a line. Initial whitespace on the terminator line would be stripped from the content lines. * If the operand is a filehandle, slurp it. Oh, and the section formerly known as: __DATA__ would become a POD section: =data [OPTIONAL_NAME] So we get the old heredoc behaviour: my $contents = << 'EOCONTENTS' Are you content? Yes, thanks, I am very content. And you? I am content too! EOCONTENTS Plus access to any pod section we might need, including the new =data section: print << '=head1 Usage' if $cmdline_error; my $contents = << '=data'; # and much later... =head1 Usage format <filename> [options] =data Fascinating. I appear to be unable to use contractions. Plus we get all of Inline::File's handy multiple-data functionality: my $contents = << '=data CONTENTS'; my $commentary = << '=data COMMENTARY'; # and much later... =data CONTENTS I am very content, even though I am unable to use contractions. =data COMMENTARY Subject reports he's very content, even though he's unable to use contractions like a real boy. Nose is unusually elongated too. =end Plus we get a slurp operator on regular filehandles: my $contents = << open $filename; Not bad, huh? :-) The only real issue is how to let such a "Swiss Army Slurp" operator co-exist with Larry's proposed ASCII: <<list of words>> synonym for: «list of words» And, whilst I have several ideas on achieving that, so far all of them are unsatisfactory (because they tend to rely on whitespace becoming significant). :-( Damian ]