syntax...(strings/interpolation/here docs)

Mark P Jones mpj@cse.ogi.edu
Thu, 14 Feb 2002 12:25:22 -0800


|   Usually, I wouldn't make such a fuss, but here documents are really
|   not some new and experimental feature. They're an old hat, and a
|   very useful hat. The only question is how to integrate them into the
|   rest of Haskell.

At a time when many developers pay careful attention to
internationalization ("I18n"), which requires careful
separation of program text (functionality) and user text
(display), a feature that instead ties them more closely
together seems to be a step in the wrong direction.

The same argument can be made with respect to the widely
recognized advantages of separating functionality (e.g.,
model/controller) from user interface (e.g., view).

Personally, I would prefer a Haskell without Here documents.
Instead of:

    greeting = "..."
    main     = putStrLn $ trim text

I would be happy to write:

    main = displayResource "greeting"

leaving the system to locate the text of the greeting from
a separate (perhaps locale sensitive) source at runtime, and
to display it in an appropriate manner.  In other words, I'd
prefer to see the effort that might be spent on standardizing
and implementing Here documents instead directed to designing
and building I18n libraries (probably based on a more general
"resource bundle" mechanism).

Ultimately, it comes down to a question of what you're
trying to achieve.  Do you envisage Haskell as an elegant
scripting language that competes with perl and ruby for
quick but useful hacks?  Or do you think it might better
serve as a platform for writing significant user level
applications with fancy user interfaces and international
appeal?  Of course, the two are not mutually exclusive,
and the presence or absence of Here documents or resource
bundles will not force the language in either way.  But
it will determine the "feel" of the language, and so have
an impact on the way that it is perceived and used.

All the best,
Mark