> Alex, you might want to explain to people (such as myself)
> who don't know how Perl etc decide how much white space to insert
> in the string that's broken across a line.  One space?  None?
> What of the indentation spaces on the new line?   What if
> you really want those spaces to appear in the string?

Use whatever space is in the file.   e.g. in perl:
---
#!/usr/bin/perl

print "hello 
  world\n";

-----------
Will output:
hello 
  world
-------
(there are 2 spaces after hello)

If you are generating HTML, XML, SQL, or even Haskell then white space
doesn't matter.  What matters here is convenience to the programmer
generating the text.  Obviously if whitespace layout is important that you
don't want to leave things up to the handling of the programming language
syntax. But, in that case, you are free to use the more traditional:
----
print "hello\n  world".
      "more text";
print "the . operator in perl is concatenation";
----------
The feature I am describing does not take anything away from the
programmer, it just makes it easier in the 80-99% case when the consumer
of the data does not care about whitespace.

The biggest subtlety for Haskell is not the core language per se, but the
interaction with the > literate programming style.  My instinct is that
the correct answer is that filtering on "^>" should be turned off inside
"". So that:
> main = do 
>       putStr "hello
world"
>       putStr "more text"

would parse correctly.  On the other hand an XML-like delimiter like
<haskell>
main = do putStr "hello
 world"
</haskell> 
would be a nicer and more modern formalism that would not have this
problem.   (the xml tags would have to be at the beginning of a line so as
not to be confused with "if 2<haskell && x>3").

-Alex-


___________________________________________________________________
S. Alexander Jacobson                   Shop.Com
1-212-697-0184 voice                    The Easiest Way To Shop



Reply via email to