Robert Ennals <Robert.Ennals@cl.cam.ac.uk> wrote:
I personally much prefer the syntax currently used in Haskell, which is also essentially what is used in most other recent languages, including Java, C++, and (god help me) Perl.
In the example given, I could write:
"I have " ++ action ++ " " ++ number ++ " " ++ whatas where action = "trained" number = show 1 whatas = "Jedi"
This is all fine and dandy, but how would you translate this to 42 different languages your customers want supported, with different word order and all that?
Surely that problem only arises if one insists on encoding all the relevant information inside a string. An alternative would be to encode all user-visible messages in an external module, with a Haskell function for each message. The translator would then redefine this module for each language. It doesn't involve any more complexity - it just shifts the complexity into a more expressive language. For example: module Messages -- English language version where stuffDone :: String -> Int -> String -> String stuffDone action number whatas = "I have " ++ action ++ " " ++ (show number) ++ " " ++ whatas jedi = "Jedi" trained = "Trained" Normal code then does the following: import qualified Messages as M putStrLn $ M.stuffDone M.trained 1 M.jedi Much nicer IMHO. -Rob