Michael G Schwern <[EMAIL PROTECTED]> writes:

[...]

> I propose that this work out to 
> 
>     "    The old lie\n  Dulce et decorum est\n      Pro patria mori.\n"
> 
> and always work out to that, no matter how far left or right the
> expression be indented.
> 
>    { { { { {
>              if( $is_fitting && $is_just ) {
>                 die <<POEM;
>                     The old lie
>                   Dulce et decorum est
>                       Pro patria mori.
>                 POEM
>    } } } } }
>         
> Four spaces, two spaces, six spaces.  Makes sense, everything lines
> up.  So far I have yet to see a regex or dequote() style proposal
> which can accomdate this.

I really like this.

[...]

> Show me where this fails and I'll shut up about it.

Here are 2 problems I can think of.  But please don't "shut up about
it" -- I like the solution, but these need to be sorted out!

1. It requires the perl parser know about indentation.  Of course we
   all know that tabs are 8 characters wide (I myself make a point of
   bludgeoning anyone who says otherwise), but do we really want to
   open this can of worms?

2. Existing practice for here docs will have the contents of the here
   doc on the left margin.  People might want to preserve that.  For
   instance, it makes sense if you're here-docking a bunch of 80 char
   lines.

(2) can be solved, and the ambiguous "no matter how far left or right
the expression be be indented" resolved, by saying that indentation of 
the here doc is relative to the terminator (*not* the statement that
launched it).  This might also make slightly better sense when you
have 2 here docs in one line:

    print << FIRST_HERE_DOC; print << SECOND_HERE_DOC;
    This is on the left margin.
     This is indented one char.
    FIRST_HERE_DOC
      This is indented one char.
     This is on the left margin.
     SECOND_HERE_DOC

But (1) needs to be resolved (and don't say "use tabs 8"!).

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to