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
Language Feature Request: String Evaluation
S. Alexander Jacobson Mon, 7 Jun 1999 15:36:32 -0400 (Eastern Daylight Time)
- Re: 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