HacWrite certainly seems like an improvement over Haskell.
However, it is just not as good as the scripting languages.
HacWrite still requires the author to differentiate between strings and
other types, still requires explicit use of show and still requires more
typing and curly balancing. Isn't this nicer?
"insert into mytable values (NULL,'$var1','$(var2+var3)','$var3')
-Alex-
___________________________________________________________________
S. Alexander Jacobson Shop.Com
1-212-697-0184 voice The Easiest Way To Shop
On Tue, 8 Jun 1999, Magnus Carlsson wrote:
> I've been using a preprocessor to Haskell that I call HacWrite, which
> adds a new kind of string appropriate for entering text. Such strings
> can span multiple lines and can be escaped using curly brackets:
>
> var1 = 2*2
> var2 = 4*var1
> var3 = �Foobar�
> sqlstring = �insert into mytable values
> (NULL,'{show(var1)}','{show(var2)}','{var3}');�
>
> Text is enclosed within �these characters� (which are hard to find on
> my keyboard, so I let Emacs insert them when I press '"'). To support
> markup, stuff that follows a space inside an escape is treated as
> text:
>
> �This {bf sentence contains words in boldface}.�
>
> Here, `bf' is a markup function from text to text.
>
> I've found HacWrite quite useful for document writing (see
> http://www.cs.chalmers.se/~hallgren/Thesis/ for a longer example :-),
> but I'm sure it could be useful for CGI-scripting and the like as
> well.
>
> /M
>
> S. Alexander Jacobson writes:
> > A popular thing to do with computer languages (especially scripting
> > languages) is to manipulate text and insert variables into strings.
> > It is extremely irritating to escape in and out of strings via ++ in
> > Haskell or + in Java/Javascript.
> > e.g.
> > > var1 = 2*2
> > > var2 = 4*var1
> > > var3 = "Foobar""
> > > sqlstring = "insert into mytable values "++
> > > "(NULL,'"++(show var1)++"','"++(show var2)++"','"++var3"');"
> >
> > It would be much nicer if Haskell did what perl,php, and tcl do:
> > > sqlstring="insert into mytable values (NULL,'$var1','$var2','$var3')".
> > Even nicer would be:
> > > sqlstring="insert into mytable values
> > (NULL,'$var1','$(var1+var2)','$var3')".
> >
> > (Notice both the embedded evaluation and the fact that the string runs
> > accross multiple lines)
> >
> > Supporting this feature involves either:
> > a. a syntactic transformation after you have type information (don't
> > 'show' strings)
> > or
> > b. redefining show string not to return quotation marks
> >
> > To me the second makes more sense, but either way, this feature would make
> > haskell programming much less annoying.
> >
> >
> > -Alex-
> >
> > PS Why does show string return quotation marks? It seems inconsistent.
> >
> > ___________________________________________________________________
> > S. Alexander Jacobson Shop.Com
> > 1-212-697-0184 voice The Easiest Way To Shop
>
Re: Language Feature Request: String Evaluation
S. Alexander Jacobson Tue, 8 Jun 1999 13:53:15 -0400 (Eastern Daylight Time)
- Language Feature Request: String Evaluation S. Alexander Jacobson
- Re: Language Feature Request: String Evaluation Paul Hudak
- Re: Language Feature Request: String Evaluation S. Alexander Jacobson
- Re: Language Feature Request: String Evaluation Martin Norb{ck
- Re: Language Feature Request: String Evaluation S. Alexander Jacobson
- RE: Language Feature Request: String Evaluation S. Alexander Jacobson
- Re: Language Feature Request: String Evaluation Magnus Carlsson
- Re: Language Feature Request: String Evaluation Jon . Fairbairn
- Re: Language Feature Request: String Evaluation Keith Wansbrough
- Re: Language Feature Request: String Evaluation S. Alexander Jacobson
- Re: Language Feature Request: String Evaluation Lennart Augustsson
- Re: Language Feature Request: String Evaluation john
- Re: Language Feature Request: String Evaluation S. Alexander Jacobson
- RE: Language Feature Request: String Evaluation Frank A. Christoph
- Re: Language Feature Request: String Evaluation Magnus Carlsson
