One of Masak's irritations with perl6 (http://use.perl.org/~masak/journal/39334) concerns interspacing POD and code.

I ran into an analogous problem with a project I am trying to do with perl6. Since perl6 doesnt yet link to the gd library, and I need graphical output, I use perl6 to compile a script for another utility (in my case ploticus). The result is that I have code which looks a bit like


   perl6 code;
   perl6 code;
   $script.say("
output code
output code
");
   perl6 code {
      perl6 code
      perl6 code
      $script.say("
output code
   indented output code
   indented output code
");
   }
   perl6 code

In other words, I have two languages intermixed, each with its own indentation.

I would like to have the indentation of the output (or secondary language) to be dependent on the primary languages indentation. As in the comments to masak's blog, I use indentation to help me with understanding the structure of my program (in perl6). When the output language over-rides the indentation hierarchy in the primary language, I loose the usefulness of indentation.

Thus I would like to be able to see:

   perl6 code;
   perl6 code;
   $script.say('
       output code
       output code
   ');
   perl6 code {
      perl6 code
      perl6 code
      $script.say('
           output code
               indented output code
               indented output code
       ');
   }
   perl6 code

For this case, a solution that occurs to me is to add an optional parameter to 'say', eg., unspace=' ' which would remove that amount of white space to the start of the output line.

The difference between this form of unspace and the one already in the spec is that there is an end to the unspace string, which can then be followed by white space.

It seems to me that some sort of approach like this could be very useful, for example, when using perl6 to generate html pages.

Richard (finanalyst)

Reply via email to