This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A useful syntax for regexps and other things


   Date: Wed, 5 Nov 1997 11:58:27 +0100
   From: roland.kaufmann@shraero.shraero.co.at
   Reply-to: roland.kaufmann@shraero.shraero.co.at
   Sender: owner-guile@cygnus.com
   Precedence: bulk
   Content-Type: text
   Content-Length: 552


   guile> (display (string-append "        Hello all,\n"
				  "we don't need new syntax to make strings"
				  " look pretty in the source.\n"
				  "              ----------\n"))
	   Hello all,
   we don't need new syntax to make strings look pretty in the source.
		 ----------

I would argue that this isn't pretty.  You break a line in the source
where it wouldn't be broken in the output.  Furthermore, you can't
apply formatting tools to fix it up if you add some more text,
fill-paragraph in emacs, for example.

This suggests another solution, which comes from a general
principle I like to promote:

   Don't add a feature to the language when a user interface technique
   would suffice.

In this case, perhaps a feature in the Scheme editing mode to
recognize long strings and format them differently would do the trick.
I suggest using the shell syntax in comments to specify this mode
explicitly as the default.  The function ``fill-paragraph'' would then
treat the #<<EOT\n...#EOT\n as a block.  Lines in the block without an
explicit '\n' (or the paragraph marker of the user's choice) would be
filled.  The whole block would be indented according to some
user-defined rule, the default being flush with the left margin.

The above code might be formatted to look like this:

    (display (string-append
#<<EOT
" Hello all,\n"
"we don't need new syntax to make strings look pretty in the source.\n"
"  ----------\n"
#EOT
              ))

That's probably not the correct result for this particular string,
because the underscores look special, but it's consistent with normal
emacs behavior.

If people don't like emacs, or don't have it, then perhaps the guile
group could distribute the formatting code, written in Guile Scheme,
with the hope of it becoming the standard extension language... 


-- 
Clifford Beshers                     Computer Graphics and User Interfaces Lab
beshers@cs.columbia.edu                         Department of Computer Science
http://www.cs.columbia.edu/~beshers                        Columbia University