On 19/02/06 03:48, Jonathan Lang wrote:
I don't see why you'd need a universal anti-backwhack, any more than
you need universal quote delimiters.

Here-docs are usually safe to quote any amount of line noise,
but I take your point.

                                     I could see introducing an
adverb to the quoting mechanism that lets you define a custom
backwhack character in qq strings (for those rare cases where literal
backslashes are common occurrences), and then press the same adverb
into service in q strings to define a custom anti-backwhack.  The only
difference is that there's a default backwhack character (the
backslash), but there is no default anti-backwhack.  So:

  my $code = q:interp(`){
      package `$package_name;

      sub `$sub_name {
          `$the_complex_value_we_want_to_use_in_generated_code
      }

      sub `$another_sub_name {
          [EMAIL PROTECTED](';')}
      }
  };

This would scratch my itch.  The interpolated bits are more visually
distinct than in my by-name proposal, which is a clear advantage. (No pun intented)

I don't like the idea of sharing the adverb between escaping and
force-interpolating since stacking other adverbs can turn q into qq
and vice-versa.  That's a minor quibble though.

I'd go so far as to say that the anti-backwhack would only have a
special meaning in front of a $, @, %, {, \, or another
anti-backwhack; in all other cases, it gets treated as a literal
character just like anything else.  There may be some edge conditions
that I haven't thought of; but I think that this is a decent baseline
to work from.

In cases like q:c:interp(`) { ... }, then only `{...} would need a
special meaning.
The only disadvantage that has occured to me is the complexity
of adding yet another feature.  Syntax highlighters and other
tools would have to handle it.
I think the Huffman encoding is correct on this, up to and including
the length of the adverb needed to define a custom backwhack or
anti-backwhack.

I agree.  This can be kept in Perl 6's attic most of the time.

Alternatively, it can be a user-defined capability since S06 specifically
allows such tinkering.  Whether to include the feature in basic Perl
depends on the utility-complexity trade off.  I don't have a strong
preference either way, as long as it can be done somehow.

Analogous issues occur with quasiquoting, so a solution that can be naturally shared would be ideal. CODE :interp(`) { say `$a + $b } ... hmm, looks ok...
Brad

--
After reading books and the like it is best to burn them or throw them away.
                                   -- Hagakure http://bereft.net/hagakure/

Reply via email to