Andy Wardley wrote:
>
> For example, it might be possible to do something like this:
>
>   use Perl6::XML;
>
>     <thingy>
>         <blah>blah blah</blah>
>     </thingy>
>
>   use Perl6;
>
>     print $thingy.blah;


We already have the ability to embed foreign languages (XML, HTML,
whatever) using here docs:

 $myml = MyXmlParser->new(<< '(MARKUP)');
  <thingy>
      <blah>blah blah</blah>
  </thingy>
 (MARKUP)

So I guess I don't see the point in adding another way to say "the foreign
syntax starts HERE and ends HERE". (Is that why they're called "here"
documents? I've always wondered about that name.)

And now to make a bit of a tangent... I've always thought it would be nice
to have an official way to indicate the foreign language in the here doc.
That way my editor could do syntax highlighting for HTML, JavaScript,
whatever.  I suppose it could even do grammar and spell checking on
English content.

It wouldn't have to be much of an extension to the here doc syntax to
allow for a language indicator:

 $myml = MyXmlParser->new(<< '(MARKUP)', type=>'text/xml');

or

 print << '(MARKUP)', type=>'human/en';


-Miko


Miko O'Sullivan
Programmer Analyst
Rescue Mission of Roanoke



Reply via email to